Koha/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-frequencies.tt
Josef Moravec 804677265e Bug 16239: Update templates
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2017-01-13 14:41:22 +00:00

234 lines
8.8 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Serials &rsaquo; Frequencies</title>
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript">
//<![CDATA[
function confirmDelete() {
return confirm(_("Are you sure you want to delete this subscription frequency?"));
}
function check_form() {
var description = $("#description").val();
var unit = $("#unit").val();
var issuesperunit = $("#issuesperunit").val();
var unitsperissue = $("#unitsperissue").val();
var alert_msg = _("Some fields are not valid:") + "\n";
var errors = 0;
if(description.length == 0) {
alert_msg += "\t - " + _("Description is required");
errors ++;
}
if(unit.length > 0) {
if(isNaN(issuesperunit) || issuesperunit == 0) {
alert_msg += "\n\t - " + _("Issues per unit is required")
+ " " + _("(must be a number greater than 0)");
errors ++;
}
if(isNaN(unitsperissue) || unitsperissue == 0) {
alert_msg += "\n\t - " + _("Units per issue is required")
+ " " + _("(must be a number greater than 0)");
errors ++;
}
if(issuesperunit > 1 && unitsperissue > 1) {
alert_msg += "\n\t - " + _("One of 'issues per unit' and 'units per issue' must be equal to 1");
errors ++;
}
}
if(errors == 0) {
return true;
}
alert(alert_msg);
return false;
}
$(document).ready(function() {
$("#issuesperunit").change(function() {
var value = $(this).val();
if(!isNaN(value) && value > 1) {
$("#unitsperissue").val(1);
}
});
$("#unitsperissue").change(function() {
var value = $(this).val();
if(!isNaN(value) && value > 1) {
$("#issuesperunit").val(1);
}
});
$(".delete_frequency").on("click",function(){
return confirmDelete();
});
$("#add_frequency_form").on("submit",function(){
return check_form();
});
$("#show_blocking_subs").on("click",function(e){
e.preventDefault();
$("#blocking_subs").show();
});
});
//]]>
</script>
</head>
<body id="ser_subscription_frequencies" class="ser">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'serials-search.inc' %]
[% BLOCK translate_frequnit %]
[% SWITCH frequnit %]
[% CASE 'day' %] day
[% CASE 'week' %] week
[% CASE 'month' %] month
[% CASE 'year' %] year
[% END %]
[% END %]
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
<a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo;
<a href="/cgi-bin/koha/serials/subscription-frequencies.pl">Frequencies</a>
</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% IF (new or modify) %]
[% IF (new) %]
<h1>New frequency</h1>
[% ELSE %]
<h1>Edit frequency: [% description %]</h1>
[% END %]
<form action="/cgi-bin/koha/serials/subscription-frequencies.pl" id="add_frequency_form" method="post">
[% IF (modify) %]
<input type="hidden" name="id" value="[% id %]" />
<input type="hidden" name="op" value="savemod" />
[% ELSE %]
<input type="hidden" name="op" value="savenew" />
[% END %]
<fieldset class="rows">
<ol>
<li>
<label class="required" for="description">Description: </label>
<input type="text" id="description" name="description" value="[% description %]" class="required" required="required" /> <span class="required">Required</span>
</li>
<li>
<label for="unit">Unit: </label>
<select id="unit" name="unit">
<option value="">None</option>
[% FOREACH unit IN units_loop %]
[% IF (unit.selected) %]
<option selected="selected" value="[% unit.val %]">
[% ELSE %]
<option value="[% unit.val %]">
[% END %]
[% PROCESS translate_frequnit frequnit=unit.val %]
</option>
[% END %]
</select>
</li>
<li><span class="hint">Note: one of the two following fields must be equal to 1</span></li>
<li>
<label for="issuesperunit">Issues per unit: </label>
[% IF (new) %]
<input type="text" id="issuesperunit" name="issuesperunit" value="1" size="3" />
[% ELSE %]
<input type="text" id="issuesperunit" name="issuesperunit" value="[% issuesperunit %]" size="3" />
[% END %]
</li>
<li>
<label for="unitsperissue">Units per issue: </label>
[% IF (new) %]
<input type="text" id="unitsperissue" name="unitsperissue" value="1" size="3" />
[% ELSE %]
<input type="text" id="unitsperissue" name="unitsperissue" value="[% unitsperissue %]" size="3" />
[% END %]
</li>
<li>
<label for="displayorder">Display order: </label>
<input type="text" id="displayorder" name="displayorder" value="[% displayorder %]" size="3" />
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Save" />
<a href="/cgi-bin/koha/serials/subscription-frequencies.pl" class="cancel">Cancel</a>
</fieldset>
</form>
[% ELSE %]
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-default btn-sm" id="newfrequency" href="/cgi-bin/koha/serials/subscription-frequencies.pl?op=new"><i class="fa fa-plus"></i> New frequency</a>
</div>
<h1>Frequencies</h1>
[% IF still_used %]
<div class="dialog alert">
<p>
This frequency is still used by [% subscriptions.size %]
subscription(s). Do you still want to delete it?
</p>
<p><a href="#" id="show_blocking_subs">Show subscriptions</a></p>
<ul id="blocking_subs" style="display:none">
[% FOREACH sub IN subscriptions %]
<li style="list-style-type:none">
<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% sub.subscriptionid %]">[% sub.title %]</a>
</li>
[% END %]
</ul>
<form action="/cgi-bin/koha/serials/subscription-frequencies.pl" method="get">
<input type="hidden" name="op" value="del" />
<input type="hidden" name="confirm" value="1" />
<input type="hidden" name="frequencyid" value="[% frequencyid %]" />
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
</form>
<form action="/cgi-bin/koha/serials/subscription-frequencies.pl" method="get">
<button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
</form>
</div>
[% END %]
[% IF (frequencies_loop.size) %]
<table id="frequenciest">
<thead>
<tr>
<th>Description</th>
<th>Unit</th>
<th>Issues per unit</th>
<th>Units per issue</th>
<th>Display order</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
[% FOREACH frequency IN frequencies_loop %]
<tr>
<td>[% frequency.description %]</td>
<td>[% PROCESS translate_frequnit frequnit=frequency.unit %]</td>
<td>[% frequency.issuesperunit %]</td>
<td>[% frequency.unitsperissue %]</td>
<td>[% frequency.displayorder %]</td>
<td class="actions">
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/subscription-frequencies.pl?op=modify&frequencyid=[% frequency.id %]"><i class="fa fa-pencil"></i> Edit</a>
<a class="delete_frequency btn btn-default btn-xs" href="/cgi-bin/koha/serials/subscription-frequencies.pl?op=del&frequencyid=[% frequency.id %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
</tbody>
</table>
[% ELSE %]
<p>There is no defined frequency.</p>
[% END %]
[% END %]
</div>
</div>
<div class="yui-b">
[% INCLUDE 'serials-menu.inc' %]
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]