Koha/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/vendor_issues.tt
Owen Leonard ff08d49680
Bug 37732: Update templates to use Bootstrap styles when alert class comes from the perl script
Many pages can have alerts that get their style from a variable passed
by the script, e.g.:

push @messages, { type => 'message', code => 'success_on_update' };

Rather than change these to match Bootstrap 5 styles, I propose we add a
copy of the existing Bootstrap style using the existing vocabulary:

message -> info
alert  -> warning
error -> danger

To test, apply the patch and rebuild CSS for the staff interface and
OPAC: (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_interface)

- Clear your browser cache if necessary.
- Navigate to pages which have been updated by this patch. Many pages
  will implement this kind of alert after saving an edit, especially
  administration pages, e.g.

  Administration -> Libraries -> Edit library -> Save.

- You can test the various alert classes by adding this HTML to
  IntranetMainUserBlock and OpacMainUserBlock and viewing the staff
  interface and OPAC main pages.:

<div class="alert alert-danger">A standard Bootstrap danger alert with
  <a href="#" class="alert-link">an example link</a>.</div>
<div class="alert alert-warning">A standard Bootstrap warning alert with
  <a href="#" class="alert-link">an example link</a>.</div>
<div class="alert alert-info">A standard Bootstrap info alert with
  <a href="#" class="alert-link">an example link</a>.</div>
<div class="alert alert-error">A Koha error alert with
  <a href="#" class="alert-link">an example link</a>.</div>
<div class="alert alert-alert">A Koha alert alert with
  <a href="#" class="alert-link">an example link</a>.</div>
<div class="alert alert-message">A Koha info alert with
  <a href="#" class="alert-link">an example link</a>.</div>

Sponsored-by: Athens County Public Libraries

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-13 12:02:52 +02:00

286 lines
11 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE AuthorisedValues %]
[% USE KohaDates %]
[% PROCESS 'i18n.inc' %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% FILTER collapse %]
[% IF op =='add_form' %]
[% IF issue.issue_id %]
[% tx("Modify vendor issue {issue_number}", { issue_number = issue.issue_id }) | html %]
[% ELSE %]
[% t("New vendor issue") | html %]
[% END %] &rsaquo;
[% ELSE %]
[% IF op == 'delete_confirm' %]
[% t("Confirm deletion of vendor issue") | html %] &rsaquo;
[% END %]
[% END %]
[% t("Vendor issues") | html %] &rsaquo;
[% vendor.name | html %] &rsaquo;
[% t("Acquisition") | html %] &rsaquo;
[% t("Koha") | html %]
[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="acq_supplier_issues" class="acq">
[% WRAPPER 'header.inc' %]
[% INCLUDE 'acquisitions-search.inc' %]
[% END %]
[% WRAPPER 'sub-header.inc' %]
[% WRAPPER breadcrumbs %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
[% END %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% vendor.id | uri %]">[% vendor.name | html %]</a>
[% END %]
[% IF op == 'list' %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
[% t("Vendor issues") | html %]
[% END %]
[% ELSE %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/acqui/vendor_issues.pl?booksellerid=[% vendor.id | uri %]">Vendor issues</a>
[% END %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
[% IF issue %]
[% tx("Modify vendor issue {issue_number}", { issue_number = issue.issue_id }) | html %]
[% ELSE %]
[% t("New vendor issue") | html %]
[% END %]
[% END %]
[% END %]
[% END #/ WRAPPER breadcrumbs %]
[% END #/ WRAPPER sub-header.inc %]
<div class="main container-fluid">
<div class="row">
<div class="col-md-10 order-md-2 order-sm-2">
<main>
[% INCLUDE 'messages.inc' %]
[% FOR m IN messages %]
<div class="alert alert-[% m.type | html %]">
[% SWITCH m.code %]
[% CASE 'error_on_update' %]
<span>An error occurred when updating this issue.</span>
[% CASE 'error_on_insert' %]
<span>An error occurred when adding this issue</span>
[% CASE 'error_on_delete' %]
<span>An error occurred when deleting this issue. Check the logs for details.</span>
[% CASE 'success_on_update' %]
<span>Issue updated successfully.</span>
[% CASE 'success_on_insert' %]
<span>Issue created successfully.</span>
[% CASE 'success_on_delete' %]
<span>Issue deleted successfully.</span>
[% CASE %]
<span>[% m.code | html %]</span>
[% END %]
</div>
[% END %]
[% IF op == 'add_form' %]
[% IF issue %]
<h1>[% tx("Modify vendor issue {issue_number}", { issue_number = issue.issue_id }) | html %]</h1>
[% ELSE %]
<h1>New vendor issue</h1>
[% END %]
<form action="/cgi-bin/koha/acqui/vendor_issues.pl" name="Aform" method="post" class="validated">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-add_validate" />
<input type="hidden" name="booksellerid" value="[% vendor.id | html %]" />
<input type="hidden" name="issue_id" value="[% issue.issue_id| html %]" />
<fieldset class="rows">
<ol>
[% IF issue %]
<li><span class="label">Issue ID: </span>[% issue.issue_id | html %]</li>
[% END %]
<li>
<label for="issue_type">Type: </label>
[% PROCESS 'av-build-dropbox.inc' name="type", category="VENDOR_ISSUE_TYPE", default=issue.type, empty=1, size = 20 %]
</li>
<li>
<label for="started_on">Started on: </label>
<input type="text" size="10" id="from" name="started_on" value="[% issue.started_on| html %]" class="flatpickr" data-date_to="to" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>
<label for="ended_on">Ended on: </label>
<input type="text" size="10" id="to" name="ended_on" value="[% issue.ended_on | html %]" class="flatpickr" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>
<label for="notes">Notes: </label>
<textarea name="notes" id="notes" rows="3" cols="50">[% issue.notes | html %]</textarea>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" class="btn btn-primary" value="Submit" />
<a class="cancel" href="/cgi-bin/koha/acqui/vendor_issues.pl?booksellerid=[% vendor.id | uri %]">Cancel</a>
</fieldset>
</form>
[% END %]
[% IF op == 'delete_confirm' %]
<div class="alert alert-warning">
<h1>Delete issue [% issue.issue_id | html %]?</h1>
<form action="/cgi-bin/koha/acqui/vendor_issues.pl" method="post">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-delete_confirmed" />
<input type="hidden" name="issue_id" value="[% issue.issue_id | html %]" />
<button type="submit" class="btn btn-default approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
</form>
<form action="/cgi-bin/koha/acqui/vendor_issues.pl" method="get">
<input type="hidden" name="booksellerid" value="[% vendor.id | html %]" />
<button type="submit" class="btn btn-default deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
</form>
</div>
[% END %]
[% IF op == 'show' %]
<h1>Vendor issue [% issue.issue_id | html %]</h1>
<fieldset class="rows">
<ol>
[% IF issue %]
<li><span class="label">Issue ID: </span>[% issue.issue_id | html %]</li>
[% END %]
<li>
<label for="issue_type">Type: </label>
[% AuthorisedValues.GetByCode( 'VENDOR_ISSUE_TYPE', issue.type, 0 ) | html %]
</li>
<li>
<label for="started_on">Started on: </label>
[% issue.started_on | $KohaDates %]
</li>
<li>
<label for="ended_on">Ended on: </label>
[% issue.ended_on | $KohaDates %]
</li>
<li>
<label for="notes">Notes: </label>
[% issue.notes | html %]
</li>
</ol>
</fieldset>
<fieldset class="action">
<a href="/cgi-bin/koha/acqui/vendor_issues.pl?booksellerid=[% vendor.id | uri %]">Back</a>
</fieldset>
</form>
[% END %]
[% IF op == 'list' %]
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-default" id="new_issue" href="/cgi-bin/koha/acqui/vendor_issues.pl?booksellerid=[% vendor.id | uri %]&op=add_form"><i class="fa fa-plus"></i> New issue</a>
</div>
<h1>Vendor issues</h1>
[% IF issues_count > 0 %]
<div class="page-section">
<div class="table_vendor_issues_table_controls"></div>
<table id="vendor_issues">
<thead>
<tr>
<th>Issue ID</th>
<th>Type</th>
<th>Started on</th>
<th>Ended on</th>
<th data-class-name="actions noExport">Actions</th>
</tr>
</thead>
</table>
</div><!-- /.page-section -->
[% ELSE %]
<div class="alert alert-info">
There are no issues defined. <a href="/cgi-bin/koha/acqui/vendor_issues.pl?booksellerid=[% vendor.id | uri %]&op=add_form">Create a new issue</a>.
</div>
[% END %]
[% END %]
</main>
</div> <!-- /.col-md-10.order-md-2 -->
<div class="col-md-2 order-sm-2 order-md-1">
<aside>
[% INCLUDE 'vendor-menu.inc' %]
</aside>
</div> <!-- /.col-md-2.order-md-1 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/acquisitions-menu.js") | $raw %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function() {
var issues_table_url = '/api/v1/acquisitions/vendors/[% vendor.id | uri %]/issues?';
var issues_table = $("#vendor_issues").kohaTable({
ajax: {
url: issues_table_url
},
embed: ["+strings"],
order: [[ 0, "desc" ]],
columns: [
{
data: "issue_id",
searchable: true,
orderable: true,
render: function(data, type, row, meta) {
return '<a href="/cgi-bin/koha/acqui/vendor_issues.pl?op=show&amp;issue_id=' + encodeURIComponent(row.issue_id) +'">' + escape_str(row.issue_id) + '</a>';
},
},
{
data: "type",
searchable: true,
orderable: true,
render: function(data, type, row, meta) {
return row._strings.type ? escape_str(row._strings.type.str) : "";
}
},
{
data: "started_on",
searchable: true,
orderable: true,
render: function(data, type, row, meta) {
return $date(row.started_on);
}
},
{
data: "ended_on",
searchable: true,
orderable: true,
render: function(data, type, row, meta) {
return $date(row.ended_on);
}
},
{
data: function( row, type, val, meta ) {
var result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/acqui/vendor_issues.pl?op=add_form&amp;issue_id='+ encodeURIComponent(row.issue_id) +'"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n";
result += '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/acqui/vendor_issues.pl?op=delete_confirm&amp;issue_id='+ encodeURIComponent(row.issue_id) +'"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Delete")+'</a>';
return result;
},
searchable: false,
orderable: false
}
]
}, null, 1);
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]