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 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
23 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
26 <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a>
29 <a href="#" aria-current="page">Frequencies</a>
34 <div class="main container-fluid">
36 <div class="col-sm-10 col-sm-push-2">
39 [% IF (new or modify) %]
41 <h1>New frequency</h1>
43 <h1>Edit frequency: [% description | html %]</h1>
45 <form action="/cgi-bin/koha/serials/subscription-frequencies.pl" id="add_frequency_form" method="post">
47 <input type="hidden" name="id" value="[% id | html %]" />
48 <input type="hidden" name="op" value="savemod" />
50 <input type="hidden" name="op" value="savenew" />
52 <fieldset class="rows">
55 <label class="required" for="description">Description: </label>
56 <input type="text" id="description" name="description" value="[% description | html %]" class="required" required="required" /> <span class="required">Required</span>
59 <label for="unit">Unit: </label>
60 <select id="unit" name="unit">
61 <option value="">None</option>
62 [% FOREACH unit IN units_loop %]
63 [% IF (unit.selected) %]
64 <option selected="selected" value="[% unit.val | html %]">
66 <option value="[% unit.val | html %]">
68 [% PROCESS translate_frequnit frequnit=unit.val %]
73 <li><span class="hint">Note: one of the two following fields must be equal to 1</span></li>
75 <label for="issuesperunit">Issues per unit: </label>
77 <input type="text" id="issuesperunit" name="issuesperunit" value="1" size="3" />
79 <input type="text" id="issuesperunit" name="issuesperunit" value="[% issuesperunit | html %]" size="3" />
83 <label for="unitsperissue">Units per issue: </label>
85 <input type="text" id="unitsperissue" name="unitsperissue" value="1" size="3" />
87 <input type="text" id="unitsperissue" name="unitsperissue" value="[% unitsperissue | html %]" size="3" />
91 <label for="displayorder">Display order: </label>
92 <input type="text" id="displayorder" name="displayorder" value="[% displayorder | html %]" size="3" />
96 <fieldset class="action">
97 <input type="submit" value="Save" />
98 <a href="/cgi-bin/koha/serials/subscription-frequencies.pl" class="cancel">Cancel</a>
103 <div id="toolbar" class="btn-toolbar">
104 <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>
109 <div class="dialog alert">
111 This frequency is still used by [% subscriptions.size | html %]
112 subscription(s). Do you still want to delete it?
114 <p><a href="#" id="show_blocking_subs">Show subscriptions</a></p>
115 <ul id="blocking_subs" style="display:none">
116 [% FOREACH sub IN subscriptions %]
117 <li style="list-style-type:none">
118 <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% sub.subscriptionid | uri %]">[% sub.title | html %]</a>
123 <form action="/cgi-bin/koha/serials/subscription-frequencies.pl" method="get">
124 <input type="hidden" name="op" value="del" />
125 <input type="hidden" name="confirm" value="1" />
126 <input type="hidden" name="frequencyid" value="[% frequencyid | html %]" />
127 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
129 <form action="/cgi-bin/koha/serials/subscription-frequencies.pl" method="get">
130 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
135 [% IF (frequencies_loop.size) %]
136 <table id="frequenciest">
141 <th>Issues per unit</th>
142 <th>Units per issue</th>
143 <th>Display order</th>
144 <th class="noExport">Actions</th>
148 [% FOREACH frequency IN frequencies_loop %]
150 <td>[% frequency.description | html %]</td>
151 <td>[% PROCESS translate_frequnit frequnit=frequency.unit %]</td>
152 <td>[% frequency.issuesperunit | html %]</td>
153 <td>[% frequency.unitsperissue | html %]</td>
154 <td>[% frequency.displayorder | html %]</td>
156 <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>
157 <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>
164 <p>There is no defined frequency.</p>
169 </div> <!-- /.col-sm-10.col-sm-push-2 -->
171 <div class="col-sm-2 col-sm-pull-10">
173 [% INCLUDE 'serials-menu.inc' %]
175 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
176 </div> <!-- /.row -->
178 [% MACRO jsinclude BLOCK %]
180 function confirmDelete() {
181 return confirm(_("Are you sure you want to delete this subscription frequency?"));
184 function check_form() {
185 var description = $("#description").val();
186 var unit = $("#unit").val();
187 var issuesperunit = $("#issuesperunit").val();
188 var unitsperissue = $("#unitsperissue").val();
189 var alert_msg = _("Some fields are not valid:") + "\n";
192 if(description.length == 0) {
193 alert_msg += "\t - " + _("Description is required");
196 if(unit.length > 0) {
197 if(isNaN(issuesperunit) || issuesperunit == 0) {
198 alert_msg += "\n\t - " + _("Issues per unit is required")
199 + " " + _("(must be a number greater than 0)");
202 if(isNaN(unitsperissue) || unitsperissue == 0) {
203 alert_msg += "\n\t - " + _("Units per issue is required")
204 + " " + _("(must be a number greater than 0)");
207 if(issuesperunit > 1 && unitsperissue > 1) {
208 alert_msg += "\n\t - " + _("One of 'issues per unit' and 'units per issue' must be equal to 1");
221 $(document).ready(function() {
222 $("#issuesperunit").change(function() {
223 var value = $(this).val();
224 if(!isNaN(value) && value > 1) {
225 $("#unitsperissue").val(1);
228 $("#unitsperissue").change(function() {
229 var value = $(this).val();
230 if(!isNaN(value) && value > 1) {
231 $("#issuesperunit").val(1);
234 $(".delete_frequency").on("click",function(){
235 return confirmDelete();
237 $("#add_frequency_form").on("submit",function(){
240 $("#show_blocking_subs").on("click",function(e){
242 $("#blocking_subs").show();
248 [% INCLUDE 'intranet-bottom.inc' %]