4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Quote editor › Tools › Koha</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% Asset.css("css/quotes.css") | $raw %]
10 <body id="tools_quotes" class="tools">
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'cat-search.inc' %]
14 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
17 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
20 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
23 <a href="#" aria-current="page">
30 <div class="main container-fluid">
32 <div class="col-sm-10 col-sm-push-2">
35 [% FOREACH m IN messages %]
36 <div class="dialog [% m.type | html %]" id="quote_action_result_dialog">
38 [% CASE 'error_on_update' %]
39 An error occurred when updating this quote. Perhaps it already exists.
40 [% CASE 'error_on_insert' %]
41 An error occurred when adding this quote.
42 [% CASE 'success_on_update' %]
43 Quote updated successfully.
44 [% CASE 'success_on_insert' %]
45 Quote added successfully.
52 <div class="dialog message" id="quote_delete_success" style="display: none;"></div>
53 <div class="dialog alert" id="quote_delete_error" style="display: none;"></div>
56 <div id="toolbar" class="btn-toolbar">
57 <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>
58 <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>
62 [% IF op == 'add_form' %]
63 <h3>[% IF quote %]Modify quote[% ELSE %]New quote[% END %]</h3>
64 <form action="/cgi-bin/koha/tools/quotes.pl" id="Aform" name="Aform" class="validated" method="post">
65 <fieldset class="rows">
66 <input type="hidden" name="op" value="add_validate" />
69 <label for="text" class="required">Source: </label>
70 <input type="text" name="source" id="source" value="[% quote.source | html %]" class="required" required="required" />
71 <span class="required">Required</span>
74 <label for="text" class="required">Text: </label>
75 <textarea name="text" id="text" class="required" required="required" />[% quote.text | html %]</textarea>
76 <span class="required">Required</span>
80 <fieldset class="action">
81 <input type="hidden" name="id" value="[% quote.id | html %]" />
82 <input type="submit" value="Submit" />
83 <a class="cancel" href="/cgi-bin/koha/tools/quotes.pl">Cancel</a>
88 [% IF op == 'delete_confirm' %]
89 <div class="dialog alert">
90 <form action="/cgi-bin/koha/tools/quotes.pl" method="post">
91 <h3>Are you sure you want to delete the following quote?</h3>
92 [% quote.source | html %] - [% quote.text | html %]
93 <input type="hidden" name="op" value="delete_confirmed" />
94 <input type="hidden" name="id" value="[% quote.id | html %]" />
95 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
97 <form action="/cgi-bin/koha/tools/quotes.pl" method="get">
98 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
103 [% IF op == 'list' %]
105 [% IF quotes_count > 0 %]
112 <th>Last display</th>
113 <th data-class-name="actions" class="noExport">Actions</th>
118 <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>
121 <div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true">
122 <div class="modal-dialog">
123 <div class="modal-content">
124 <div class="modal-header">
125 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
126 <h3 id="delete_confirm_modal_label">Delete quote</h3>
128 <div class="modal-body">
129 <div id="delete_confirm_dialog"></div>
131 <div class="modal-footer">
132 <a href="#" class="btn btn-default" id="delete_confirm_modal_button" role="button" data-toggle="modal">Delete</a>
133 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
135 </div> <!-- /.modal-content -->
136 </div> <!-- /.modal-dialog -->
137 </div> <!-- #delete_confirm_modal -->
141 </div> <!-- /.col-sm-10.col-sm-push-2 -->
143 <div class="col-sm-2 col-sm-pull-10">
145 [% INCLUDE 'tools-menu.inc' %]
147 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
148 </div> <!-- /.row -->
150 [% MACRO jsinclude BLOCK %]
151 [% Asset.js("js/tools-menu.js") | $raw %]
152 [% INCLUDE 'js-date-format.inc' %]
153 [% INCLUDE 'datatables.inc' %]
156 $(document).ready(function() {
158 var quotes_url = '/api/v1/quotes';
159 var quotes = $("#quotes").api({
163 '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>',
165 "targets": [0,1,2,3],
166 "render": function (data, type, row, meta) {
167 if ( type == 'display' ) {
168 if ( data != null ) {
169 return data.escapeHtml();
195 "data": "displayed_on",
196 "render": function(data, type, row, meta) {
197 return $datetime(row.displayed_on);
203 "data": function( row, type, val, meta ) {
205 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 fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>';
206 result += '<form action="/cgi-bin/koha/tools/quotes.pl" method="post">';
207 result += '<input type="hidden" name="id" value="'+row.quote_id.escapeHtml()+'" />'+"\n";
209 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" aria-hidden="true"></i> '+_("Delete")+'</a>';
219 $('#quotes').on( "click", '.delete_quote', function () {
220 var quote_id = decodeURIComponent($(this).data('quote-id'));
222 $("#delete_confirm_dialog").html(
223 _("You are about to delete the quote #%s.").format(quote_id)
226 $("#delete_confirm_modal_button").unbind("click").on( "click", function () {
229 url: "/api/v1/quotes/"+quote_id
230 }).success(function() {
231 $("#delete_confirm_modal").modal('hide');
232 quotes.api().ajax.reload(function (data) {
233 $("#quote_action_result_dialog").hide();
234 $("#quote_delete_success").html(_("Quote #%s deleted successfully.").format(quote_id)).show();
236 }).error(function () {
237 $("#quote_delete_error").html(_("Error deleting quote #%s. Check the logs.").format(quote_id)).show();
246 [% INCLUDE 'intranet-bottom.inc' %]