4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Tools › Quote editor</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 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › Quote editor</div>
16 <div class="main container-fluid">
18 <div class="col-sm-10 col-sm-push-2">
21 [% FOREACH m IN messages %]
22 <div class="dialog [% m.type | html %]" id="quote_action_result_dialog">
24 [% CASE 'error_on_update' %]
25 An error occurred when updating this quote. Perhaps it already exists.
26 [% CASE 'error_on_insert' %]
27 An error occurred when adding this quote.
28 [% CASE 'success_on_update' %]
29 Quote updated successfully.
30 [% CASE 'success_on_insert' %]
31 Quote added successfully.
38 <div class="dialog message" id="quote_delete_success" style="display: none;"></div>
39 <div class="dialog alert" id="quote_delete_error" style="display: none;"></div>
42 <div id="toolbar" class="btn-toolbar">
43 <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>
44 <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>
48 [% IF op == 'add_form' %]
49 <h3>[% IF quote %]Modify quote[% ELSE %]New quote[% END %]</h3>
50 <form action="/cgi-bin/koha/tools/quotes.pl" id="Aform" name="Aform" class="validated" method="post">
51 <fieldset class="rows">
52 <input type="hidden" name="op" value="add_validate" />
55 <label for="text" class="required">Source: </label>
56 <input type="text" name="source" id="source" value="[% quote.source | html %]" class="required" required="required" />
57 <span class="required">Required</span>
60 <label for="text" class="required">Text: </label>
61 <textarea name="text" id="text" class="required" required="required" />[% quote.text | html %]</textarea>
62 <span class="required">Required</span>
66 <fieldset class="action">
67 <input type="hidden" name="id" value="[% quote.id | html %]" />
68 <input type="submit" value="Submit" />
69 <a class="cancel" href="/cgi-bin/koha/tools/quotes.pl">Cancel</a>
74 [% IF op == 'delete_confirm' %]
75 <div class="dialog alert">
76 <form action="/cgi-bin/koha/tools/quotes.pl" method="post">
77 <h3>Are you sure you want to delete the following quote?</h3>
78 [% quote.source | html %] - [% quote.text | html %]
79 <input type="hidden" name="op" value="delete_confirmed" />
80 <input type="hidden" name="id" value="[% quote.id | html %]" />
81 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
83 <form action="/cgi-bin/koha/tools/quotes.pl" method="get">
84 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
91 [% IF quotes_count > 0 %]
99 <th data-class-name="actions" class="noExport">Actions</th>
104 <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>
107 <div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true">
108 <div class="modal-dialog">
109 <div class="modal-content">
110 <div class="modal-header">
111 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
112 <h3 id="delete_confirm_modal_label">Delete quote</h3>
114 <div class="modal-body">
115 <div id="delete_confirm_dialog"></div>
117 <div class="modal-footer">
118 <a href="#" class="btn btn-default" id="delete_confirm_modal_button" role="button" data-toggle="modal">Delete</a>
119 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
121 </div> <!-- /.modal-content -->
122 </div> <!-- /.modal-dialog -->
123 </div> <!-- #delete_confirm_modal -->
127 </div> <!-- /.col-sm-10.col-sm-push-2 -->
129 <div class="col-sm-2 col-sm-pull-10">
131 [% INCLUDE 'tools-menu.inc' %]
133 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
134 </div> <!-- /.row -->
136 [% MACRO jsinclude BLOCK %]
137 [% Asset.js("js/tools-menu.js") | $raw %]
138 [% INCLUDE 'js-date-format.inc' %]
139 [% INCLUDE 'datatables.inc' %]
142 $(document).ready(function() {
144 var quotes_url = '/api/v1/quotes';
145 var quotes = $("#quotes").api({
149 '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>',
151 "targets": [0,1,2,3],
152 "render": function (data, type, row, meta) {
153 if ( type == 'display' ) {
154 if ( data != null ) {
155 return data.escapeHtml();
181 "data": "displayed_on",
182 "render": function(data, type, row, meta) {
183 return $datetime(row.displayed_on);
189 "data": function( row, type, val, meta ) {
191 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>';
192 result += '<form action="/cgi-bin/koha/tools/quotes.pl" method="post">';
193 result += '<input type="hidden" name="id" value="'+row.quote_id.escapeHtml()+'" />'+"\n";
195 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>';
205 $('#quotes').on( "click", '.delete_quote', function () {
206 var quote_id = decodeURIComponent($(this).data('quote-id'));
208 $("#delete_confirm_dialog").html(
209 _("You are about to delete the quote #%s.").format(quote_id)
212 $("#delete_confirm_modal_button").unbind("click").on( "click", function () {
215 url: "/api/v1/quotes/"+quote_id
216 }).success(function() {
217 $("#delete_confirm_modal").modal('hide');
218 quotes.api().ajax.reload(function (data) {
219 $("#quote_action_result_dialog").hide();
220 $("#quote_delete_success").html(_("Quote #%s deleted successfully.").format(quote_id)).show();
222 }).error(function () {
223 $("#quote_delete_error").html(_("Error deleting quote #%s. Check the logs.").format(quote_id)).show();
232 [% INCLUDE 'intranet-bottom.inc' %]