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 [% WRAPPER 'header.inc' %]
12 [% INCLUDE 'cat-search.inc' %]
15 [% WRAPPER 'sub-header.inc' %]
16 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
19 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
22 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
25 <a href="#" aria-current="page">
33 <div class="main container-fluid">
35 <div class="col-sm-10 col-sm-push-2">
38 [% FOREACH m IN messages %]
39 <div class="dialog [% m.type | html %]" id="quote_action_result_dialog">
41 [% CASE 'error_on_update' %]
42 <span>An error occurred when updating this quote. Perhaps it already exists</span>
43 [% CASE 'error_on_insert' %]
44 <span>An error occurred when adding this quote</span>
45 [% CASE 'success_on_update' %]
46 <span>Quote updated successfully</span>
47 [% CASE 'success_on_insert' %]
48 <span>Quote added successfully</span>
50 <span>[% m.code | html %]</span>
55 <div class="dialog message" id="quote_delete_success" style="display: none;"></div>
56 <div class="dialog alert" id="quote_delete_error" style="display: none;"></div>
59 <div id="toolbar" class="btn-toolbar">
60 <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>
61 <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>
65 [% IF op == 'add_form' %]
66 <h1>[% IF quote %]Modify quote[% ELSE %]New quote[% END %]</h1>
67 <form action="/cgi-bin/koha/tools/quotes.pl" id="Aform" name="Aform" class="validated" method="post">
68 <fieldset class="rows">
69 <input type="hidden" name="op" value="add_validate" />
72 <label for="text" class="required">Source: </label>
73 <input type="text" name="source" id="source" value="[% quote.source | html %]" class="required" required="required" />
74 <span class="required">Required</span>
77 <label for="text" class="required">Text: </label>
78 <textarea name="text" id="text" class="required" required="required" />[% quote.text | html %]</textarea>
79 <span class="required">Required</span>
83 <fieldset class="action">
84 <input type="hidden" name="id" value="[% quote.id | html %]" />
85 <input type="submit" class="btn btn-primary" value="Submit" />
86 <a class="cancel" href="/cgi-bin/koha/tools/quotes.pl">Cancel</a>
91 [% IF op == 'delete_confirm' %]
92 <div class="dialog alert">
93 <form action="/cgi-bin/koha/tools/quotes.pl" method="post">
94 <h1>Are you sure you want to delete the following quote?</h1>
95 [% quote.source | html %] - [% quote.text | html %]
96 <input type="hidden" name="op" value="delete_confirmed" />
97 <input type="hidden" name="id" value="[% quote.id | html %]" />
98 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
100 <form action="/cgi-bin/koha/tools/quotes.pl" method="get">
101 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
106 [% IF op == 'list' %]
108 [% IF quotes_count > 0 %]
115 <th>Last display</th>
116 <th data-class-name="actions" class="noExport">Actions</th>
121 <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>
124 <div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true">
125 <div class="modal-dialog">
126 <div class="modal-content">
127 <div class="modal-header">
128 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
129 <h3 id="delete_confirm_modal_label">Delete quote</h3>
131 <div class="modal-body">
132 <div id="delete_confirm_dialog"></div>
134 <div class="modal-footer">
135 <a href="#" class="btn btn-default" id="delete_confirm_modal_button" role="button" data-toggle="modal">Delete</a>
136 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
138 </div> <!-- /.modal-content -->
139 </div> <!-- /.modal-dialog -->
140 </div> <!-- #delete_confirm_modal -->
144 </div> <!-- /.col-sm-10.col-sm-push-2 -->
146 <div class="col-sm-2 col-sm-pull-10">
148 [% INCLUDE 'tools-menu.inc' %]
150 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
151 </div> <!-- /.row -->
153 [% MACRO jsinclude BLOCK %]
154 [% Asset.js("js/tools-menu.js") | $raw %]
155 [% INCLUDE 'datatables.inc' %]
158 $(document).ready(function() {
160 var quotes_url = '/api/v1/quotes';
161 var quotes = $("#quotes").kohaTable({
165 '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>',
167 "targets": [0,1,2,3],
168 "render": function (data, type, row, meta) {
169 if ( type == 'display' ) {
170 if ( data != null ) {
171 return data.escapeHtml();
197 "data": "displayed_on",
198 "render": function(data, type, row, meta) {
199 return $datetime(row.displayed_on);
205 "data": function( row, type, val, meta ) {
207 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>';
208 result += '<form action="/cgi-bin/koha/tools/quotes.pl" method="post">';
209 result += '<input type="hidden" name="id" value="'+row.quote_id.escapeHtml()+'" />'+"\n";
211 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>';
221 $('#quotes').on( "click", '.delete_quote', function () {
222 var quote_id = decodeURIComponent($(this).data('quote-id'));
224 $("#delete_confirm_dialog").html(
225 _("You are about to delete the quote #%s.").format(quote_id)
228 $("#delete_confirm_modal_button").unbind("click").on( "click", function () {
231 url: "/api/v1/quotes/"+quote_id
232 }).success(function() {
233 $("#delete_confirm_modal").modal('hide');
234 quotes.api().ajax.reload(function (data) {
235 $("#quote_action_result_dialog").hide();
236 $("#quote_delete_success").html(_("Quote #%s deleted successfully.").format(quote_id)).show();
238 }).error(function () {
239 $("#quote_delete_error").html(_("Error deleting quote #%s. Check the logs.").format(quote_id)).show();
248 [% INCLUDE 'intranet-bottom.inc' %]