Koha/koha-tmpl/intranet-tmpl/prog/js/sms_providers.js
Owen Leonard 87d53fa2e5 Bug 17012 - Remove more event attributes from administration templates
There are several administration templates which still contain event
attributes. This patch move event definition to the JavaScript.

To test you must have the SMSSendDriver system preference set to
"Email." Apply the patch and go to Administration.

- In Global system preferences, change the value of any input or select
  and then click the "Cancel" link for that section. After confirming
  your choice, the page should reload with your changes reset.

- In Circulation and fine rules, edit any existing rule. In the editing
  row, click the "Clear" button. The data for that rule should be
  cleared.

- In Transport cost matrix, make any change to the matrix. Submitting
  the form should work correctly.

- In MARC bibliographic framework, choose 'MARC structure' for any
  framework.
  - Checking or unchecking the 'Display only used tags/subfields'
    checkbox should reload the page and change the display according to
    your choice.

- In Did you mean?, make changes to the existing configuration.
  - Clicking "Cancel" should reload the page and discard your changes.
  - Clicking "Save configuration" should correcly save your changes.

- In SMS cellular providers, click to edit any existing provider.
  Clicking the "Cancel" link should cancel the editing process and
  return you to the list of providers.

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-09-09 13:29:52 +00:00

77 lines
2 KiB
JavaScript

$(document).ready(function() {
$('#submit_update').hide();
$("#name").focus();
$("#sms_add_form").hide();
$("#new_provider").on("click",function(){
add_provider();
});
$(".edit").on("click",function(e){
e.preventDefault();
var providerid = $(this).data("providerid");
edit_provider( providerid );
});
$(".delete").on("click",function(e){
e.preventDefault();
var providerid = $(this).data("providerid");
var patrons_using = $(this).data("patrons_using");
if( patrons_using !== "" ){
delete_provider( providerid, patrons_using );
} else {
delete_provider( providerid );
}
});
$(".cancel_edit").on("click",function(e){
e.preventDefault();
cancel_edit();
});
});
function clear_form(){
$("#id,#name,#domain").val("");
}
function add_provider(){
clear_form();
$(".dialog").hide();
$("legend").text( LABEL_SMS_ADD_PROVIDER );
$("#toolbar,#submit_update,#providerst").hide();
$("#sms_add_form,#submit_save").show();
$("#name").focus();
}
function edit_provider( id ) {
clear_form();
$("legend").text( LABEL_SMS_EDIT_PROVIDER.format( $("#name_" + id).text() ) );
$("#sms_add_form,#submit_update").show();
$("#id").val( id );
$("#name").val( $("#name_" + id).text() );
$("#domain").val( $("#domain_" + id).text() );
$("#toolbar,#submit_save,#providerst").hide();
$("#name").focus();
}
function cancel_edit() {
clear_form();
$(".dialog").show();
$("#sms_add_form,#submit_update").hide();
$("#toolbar,#submit_save,#providerst").show();
}
function delete_provider( id, users ) {
var c;
if ( users ) {
c = confirm( MSG_SMS_PATRONS_USING.format( $("#name_" + id).html(), users ) );
} else {
c = confirm( MSG_SMS_DELETE_CONFIRM.format( $("#name_" + id).html() ) );
}
if ( c ) {
$("#op").val('delete');
$("#id").val( id );
$("#sms_form").submit();
}
}