@@ -, +, @@ providers management - Moving JavaScript to a separate file - Adding a toolbar with a "New SMS provider" button. - Adding the "generic" catalog search header form to the top of the page. - Adding "Required" classes to required fields so that the staff client's built-in JS validation library can be used. - Confirm that the add/edit form is hidden initially. A toolbar with a "New SMS provider" button should appear with existing SMS cellular providers in a table below. If there are no existing providers a message dialog should say so. - Confirm that the "New SMS provider" button works: - The table should be hidden and an empty "add" form displayed. - Confirm that an empty form cannot be submitted. - Confirm that submitting valid data works. - Confirm that clicking the "Cancel" button hides the form and redisplays the table. - Test the "edit" button for an existing provider: - Confirm that the edit form is displayed and populated with the correct data. - Confirm that edits are saved correctly. - When viewing the table of existing providers, confirm that clicking the "Delete" button triggers a confirmation dialog. Test both cancelling and confirming that dialog. - Ponder whether all this is an improvement or not. --- .../intranet-tmpl/prog/en/js/sms_providers.js | 58 +++++++ .../prog/en/modules/admin/sms_providers.tt | 191 ++++++++++----------- 2 files changed, 144 insertions(+), 105 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/sms_providers.js --- a/koha-tmpl/intranet-tmpl/prog/en/js/sms_providers.js +++ a/koha-tmpl/intranet-tmpl/prog/en/js/sms_providers.js @@ -0,0 +1,58 @@ +$(document).ready(function() { + $('#submit_update').hide(); + $("#name").focus(); + $("#sms_add_form").hide(); + $("#new_provider").on("click",function(){ + add_provider(); + }); +}); + +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(); + } +} --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt @@ -1,128 +1,109 @@ [% INCLUDE 'doc-head-open.inc' %] Koha › Administration › SMS cellular providers [% INCLUDE 'doc-head-close.inc' %] - - + + + [% INCLUDE 'header.inc' %] +[% INCLUDE 'cat-search.inc' %]
-
+
+ + +

SMS cellular providers

- - - - - - - - - - + [% IF providers.size %] - - [% FOREACH p IN providers %] +
NameDomainPatrons  
+ - - - - - + + + + + - [% END %] - - - - + + + + [% FOREACH p IN providers %] + + + + + + + + [% END %] + +
[% p.name %][% p.domain %][% p.patrons_using %] - - Edit - - - [% IF p.patrons_using %] - - Delete - - [% ELSE %] - - Delete - - [% END %] - NameDomainPatrons  
[% p.name %][% p.domain %][% p.patrons_using %] + + Edit + + + [% IF p.patrons_using %] + + Delete + + [% ELSE %] + + Delete + + [% END %] +
+ + [% ELSE %] + +
+ There are no SMS cellular providers defined. +
+ + [% END %] + +
+ +
+ Add an SMS cellular provider - - - - - - - - - - Cancel - - - - - - +
    +
  1. + + + Required +
  2. +
  3. + + + Required +
  4. +
+
+
+ + + Cancel +
+ +
+
--