3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Frequencies › Serials › Koha</title>
5 [% INCLUDE 'doc-head-close.inc' %]
8 <body id="ser_subscription_frequencies" class="ser">
9 [% WRAPPER 'header.inc' %]
10 [% INCLUDE 'serials-search.inc' %]
13 [% BLOCK translate_frequnit %]
15 [% CASE 'day' %]<span> day</span>
16 [% CASE 'week' %]<span> week</span>
17 [% CASE 'month' %]<span> month</span>
18 [% CASE 'year' %]<span> year</span>
22 [% WRAPPER 'sub-header.inc' %]
23 [% WRAPPER breadcrumbs %]
24 [% WRAPPER breadcrumb_item %]
25 <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a>
27 [% WRAPPER breadcrumb_item bc_active= 1 %]
28 <span>Frequencies</span>
30 [% END #/ WRAPPER breadcrumbs %]
31 [% END #/ WRAPPER sub-header.inc %]
33 <div class="main container-fluid">
35 <div class="col-sm-10 col-sm-push-2">
38 [% IF (new or modify) %]
40 <h1>New frequency</h1>
42 <h1>Edit frequency: [% description | html %]</h1>
44 <form action="/cgi-bin/koha/serials/subscription-frequencies.pl" id="add_frequency_form" method="post">
46 <input type="hidden" name="id" value="[% id | html %]" />
47 <input type="hidden" name="op" value="savemod" />
49 <input type="hidden" name="op" value="savenew" />
51 <fieldset class="rows">
54 <label class="required" for="description">Description: </label>
55 <input type="text" id="description" name="description" value="[% description | html %]" class="required" required="required" /> <span class="required">Required</span>
58 <label for="unit">Unit: </label>
59 <select id="unit" name="unit">
60 <option value="">None</option>
61 [% FOREACH unit IN units_loop %]
62 [% IF (unit.selected) %]
63 <option selected="selected" value="[% unit.val | html %]">
65 <option value="[% unit.val | html %]">
67 [% PROCESS translate_frequnit frequnit=unit.val %]
72 <li><span class="hint">Note: one of the two following fields must be equal to 1</span></li>
74 <label for="issuesperunit">Issues per unit: </label>
76 <input type="text" id="issuesperunit" name="issuesperunit" value="1" size="3" />
78 <input type="text" id="issuesperunit" name="issuesperunit" value="[% issuesperunit | html %]" size="3" />
82 <label for="unitsperissue">Units per issue: </label>
84 <input type="text" id="unitsperissue" name="unitsperissue" value="1" size="3" />
86 <input type="text" id="unitsperissue" name="unitsperissue" value="[% unitsperissue | html %]" size="3" />
90 <label for="displayorder">Display order: </label>
91 <input type="text" id="displayorder" name="displayorder" value="[% displayorder | html %]" size="3" />
95 <fieldset class="action">
96 <input type="submit" class="btn btn-primary" value="Save" />
97 <a href="/cgi-bin/koha/serials/subscription-frequencies.pl" class="cancel">Cancel</a>
102 <div id="toolbar" class="btn-toolbar">
103 <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>
108 <div class="dialog alert">
110 This frequency is still used by [% subscriptions.size | html %]
111 subscription(s). Do you still want to delete it?
113 <p><a href="#" id="show_blocking_subs">Show subscriptions</a></p>
114 <ul id="blocking_subs" style="display:none">
115 [% FOREACH sub IN subscriptions %]
116 <li style="list-style-type:none">
117 <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% sub.subscriptionid | uri %]">[% sub.title | html %]</a>
122 <form action="/cgi-bin/koha/serials/subscription-frequencies.pl" method="get">
123 <input type="hidden" name="op" value="del" />
124 <input type="hidden" name="confirm" value="1" />
125 <input type="hidden" name="frequencyid" value="[% frequencyid | html %]" />
126 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
128 <form action="/cgi-bin/koha/serials/subscription-frequencies.pl" method="get">
129 <button type="submit" class="deny"><i class="fa fa-fw fa-times"></i> No, do not delete</button>
134 [% IF (frequencies_loop.size) %]
135 <div class="page-section">
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-solid fa-pencil" aria-hidden="true"></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-can"></i> Delete</a>
163 </div> <!-- /.page-section -->
165 <p>There is no defined frequency.</p>
170 </div> <!-- /.col-sm-10.col-sm-push-2 -->
172 <div class="col-sm-2 col-sm-pull-10">
174 [% INCLUDE 'serials-menu.inc' %]
176 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
177 </div> <!-- /.row -->
179 [% MACRO jsinclude BLOCK %]
181 function confirmDelete() {
182 return confirm(_("Are you sure you want to delete this subscription frequency?"));
185 function check_form() {
186 var description = $("#description").val();
187 var unit = $("#unit").val();
188 var issuesperunit = $("#issuesperunit").val();
189 var unitsperissue = $("#unitsperissue").val();
190 var alert_msg = _("Some fields are not valid:") + "\n";
193 if(description.length == 0) {
194 alert_msg += "\t - " + _("Description is required");
197 if(unit.length > 0) {
198 if(isNaN(issuesperunit) || issuesperunit == 0) {
199 alert_msg += "\n\t - " + _("Issues per unit is required")
200 + " " + _("(must be a number greater than 0)");
203 if(isNaN(unitsperissue) || unitsperissue == 0) {
204 alert_msg += "\n\t - " + _("Units per issue is required")
205 + " " + _("(must be a number greater than 0)");
208 if(issuesperunit > 1 && unitsperissue > 1) {
209 alert_msg += "\n\t - " + _("One of 'issues per unit' and 'units per issue' must be equal to 1");
222 $(document).ready(function() {
223 $("#issuesperunit").change(function() {
224 var value = $(this).val();
225 if(!isNaN(value) && value > 1) {
226 $("#unitsperissue").val(1);
229 $("#unitsperissue").change(function() {
230 var value = $(this).val();
231 if(!isNaN(value) && value > 1) {
232 $("#issuesperunit").val(1);
235 $(".delete_frequency").on("click",function(){
236 return confirmDelete();
238 $("#add_frequency_form").on("submit",function(){
241 $("#show_blocking_subs").on("click",function(e){
243 $("#blocking_subs").show();
249 [% INCLUDE 'intranet-bottom.inc' %]