3 [% PROCESS 'i18n.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>[% FILTER collapse %]
7 [% IF op == 'add_form' %]
9 [% t("Modify quote") | html %]
11 [% t("New quote") | html %]
14 [% t("Quote editor") | html %] ›
15 [% t("Tools") | html %] ›
16 [% t("Koha") | html %]
18 [% INCLUDE 'doc-head-close.inc' %]
21 <body id="tools_quotes" class="tools">
22 [% WRAPPER 'header.inc' %]
23 [% INCLUDE 'cat-search.inc' %]
26 [% WRAPPER 'sub-header.inc' %]
27 [% WRAPPER breadcrumbs %]
28 [% WRAPPER breadcrumb_item %]
29 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
31 [% IF op == 'add_form' %]
32 [% WRAPPER breadcrumb_item %]
33 <a href="/cgi-bin/koha/tools/quotes.pl">Quote editor</a>
35 [% WRAPPER breadcrumb_item bc_active= 1 %]
37 [% t("Modify quote") | html %]
39 [% t("New quote") | html %]
43 [% WRAPPER breadcrumb_item bc_active= 1 %]
44 <span>Quote editor</span>
47 [% END #/ WRAPPER breadcrumbs %]
48 [% END #/ WRAPPER sub-header.inc %]
50 <div class="main container-fluid">
52 <div class="col-sm-10 col-sm-push-2">
55 [% FOREACH m IN messages %]
56 <div class="dialog [% m.type | html %]" id="quote_action_result_dialog">
58 [% CASE 'error_on_update' %]
59 <span>An error occurred when updating this quote. Perhaps it already exists</span>
60 [% CASE 'error_on_insert' %]
61 <span>An error occurred when adding this quote</span>
62 [% CASE 'success_on_update' %]
63 <span>Quote updated successfully</span>
64 [% CASE 'success_on_insert' %]
65 <span>Quote added successfully</span>
67 <span>[% m.code | html %]</span>
72 <div class="dialog message" id="quote_delete_success" style="display: none;"></div>
73 <div class="dialog alert" id="quote_delete_error" style="display: none;"></div>
76 <div id="toolbar" class="btn-toolbar">
77 <a class="btn btn-default" id="newquote" href="/cgi-bin/koha/tools/quotes.pl?op=add_form"><i class="fa fa-plus"></i> New quote</a>
78 <a class="btn btn-default" id="import_quotes" href="/cgi-bin/koha/tools/quotes-upload.pl"><i class="fa fa-folder-open"></i> Import quotes</a>
82 [% IF op == 'add_form' %]
83 <h1>[% IF quote %]Modify quote[% ELSE %]New quote[% END %]</h1>
84 <form action="/cgi-bin/koha/tools/quotes.pl" id="Aform" name="Aform" class="validated" method="post">
85 <fieldset class="rows">
86 <input type="hidden" name="op" value="add_validate" />
89 <label for="text" class="required">Source: </label>
90 <input type="text" name="source" id="source" value="[% quote.source | html %]" class="required" required="required" />
91 <span class="required">Required</span>
94 <label for="text" class="required">Text: </label>
95 <textarea name="text" id="text" class="required" required="required" />[% quote.text | html %]</textarea>
96 <span class="required">Required</span>
100 <fieldset class="action">
101 <input type="hidden" name="id" value="[% quote.id | html %]" />
102 <input type="submit" class="btn btn-primary" value="Submit" />
103 <a class="cancel" href="/cgi-bin/koha/tools/quotes.pl">Cancel</a>
108 [% IF op == 'delete_confirm' %]
109 <div class="dialog alert">
110 <form action="/cgi-bin/koha/tools/quotes.pl" method="post">
111 <h1>Are you sure you want to delete the following quote?</h1>
112 [% quote.source | html %] - [% quote.text | html %]
113 <input type="hidden" name="op" value="delete_confirmed" />
114 <input type="hidden" name="id" value="[% quote.id | html %]" />
115 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
117 <form action="/cgi-bin/koha/tools/quotes.pl" method="get">
118 <button type="submit" class="deny"><i class="fa fa-fw fa-times"></i> No, do not delete</button>
123 [% IF op == 'list' %]
125 [% IF quotes_count > 0 %]
126 <div class="page-section">
133 <th>Last display</th>
134 <th data-class-name="actions" class="noExport">Actions</th>
138 </div> <!-- /.page-section -->
140 <div class="dialog message">There are no quotes defined. <a href="/cgi-bin/koha/tools/quotes.pl?op=add_form">Start defining quotes</a>.</div>
143 <div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true">
144 <div class="modal-dialog">
145 <div class="modal-content">
146 <div class="modal-header">
147 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
148 <h3 id="delete_confirm_modal_label">Delete quote</h3>
150 <div class="modal-body">
151 <div id="delete_confirm_dialog"></div>
153 <div class="modal-footer">
154 <a href="#" class="btn btn-default" id="delete_confirm_modal_button" role="button" data-toggle="modal">Delete</a>
155 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
157 </div> <!-- /.modal-content -->
158 </div> <!-- /.modal-dialog -->
159 </div> <!-- #delete_confirm_modal -->
163 </div> <!-- /.col-sm-10.col-sm-push-2 -->
165 <div class="col-sm-2 col-sm-pull-10">
167 [% INCLUDE 'tools-menu.inc' %]
169 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
170 </div> <!-- /.row -->
172 [% MACRO jsinclude BLOCK %]
173 [% Asset.js("js/tools-menu.js") | $raw %]
174 [% INCLUDE 'datatables.inc' %]
177 $(document).ready(function() {
179 var quotes_url = '/api/v1/quotes';
180 var quotes = $("#quotes").kohaTable({
184 'emptyTable': '<div class="dialog message">'+_("There are no quotes defined.")+' <a href="/cgi-bin/koha/tools/quotes.pl?op=add_form">'+_("Start defining quotes")+'</a>.</div>',
186 "targets": [0,1,2,3],
187 "render": function (data, type, row, meta) {
188 if ( type == 'display' ) {
189 if ( data != null ) {
190 return data.escapeHtml();
216 "data": "displayed_on",
217 "render": function(data, type, row, meta) {
218 return $datetime(row.displayed_on);
224 "data": function( row, type, val, meta ) {
226 var result = '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/quotes.pl?op=add_form&id='+encodeURIComponent(row.quote_id)+'" role="button"><i class="fa-solid fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>';
227 result += '<form action="/cgi-bin/koha/tools/quotes.pl" method="post">';
228 result += '<input type="hidden" name="id" value="'+row.quote_id.escapeHtml()+'" />'+"\n";
230 result += '<a class="btn btn-default btn-xs delete_quote" role="button" href="#" data-toggle="modal" data-target="#delete_confirm_modal" data-quote-id="'+ encodeURIComponent(row.quote_id) +'"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Delete")+'</a>';
240 $('#quotes').on( "click", '.delete_quote', function () {
241 var quote_id = decodeURIComponent($(this).data('quote-id'));
243 $("#delete_confirm_dialog").html(
244 _("You are about to delete the quote #%s.").format(quote_id)
247 $("#delete_confirm_modal_button").unbind("click").on( "click", function () {
250 url: "/api/v1/quotes/"+quote_id
251 }).success(function() {
252 $("#delete_confirm_modal").modal('hide');
253 quotes.api().ajax.reload(function (data) {
254 $("#quote_action_result_dialog").hide();
255 $("#quote_delete_success").html(_("Quote #%s deleted successfully.").format(quote_id)).show();
257 }).error(function () {
258 $("#quote_delete_error").html(_("Error deleting quote #%s. Check the logs.").format(quote_id)).show();
267 [% INCLUDE 'intranet-bottom.inc' %]