Bug 11299: Add a button to the biblio edition page to automatically add authority...
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / js / sms_providers.js
index 23a9c12..47b20e4 100644 (file)
@@ -5,6 +5,25 @@ $(document).ready(function() {
     $("#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(){
@@ -14,7 +33,7 @@ function clear_form(){
 function add_provider(){
     clear_form();
     $(".dialog").hide();
-    $("legend").text( LABEL_SMS_ADD_PROVIDER );
+    $("legend").text( __("Add an SMS cellular provider") );
     $("#toolbar,#submit_update,#providerst").hide();
     $("#sms_add_form,#submit_save").show();
     $("#name").focus();
@@ -22,7 +41,7 @@ function add_provider(){
 
 function edit_provider( id ) {
     clear_form();
-    $("legend").text( LABEL_SMS_EDIT_PROVIDER.format( $("#name_" + id).text() ) );
+    $("legend").text( __("Edit provider %s").format($("#name_" + id).text()) );
     $("#sms_add_form,#submit_update").show();
 
     $("#id").val( id );
@@ -45,9 +64,9 @@ function cancel_edit() {
 function delete_provider( id, users ) {
     var c;
     if ( users ) {
-        c = confirm( MSG_SMS_PATRONS_USING.format( $("#name_" + id).html(), users ) );
+        c = confirm( __("Are you sure you want to delete %s? %s patron(s) are using it!").format($("#name_" + id).html(), users) );
     } else {
-        c = confirm( MSG_SMS_DELETE_CONFIRM.format( $("#name_" + id).html() ) );
+        c = confirm( __("Are you sure you want to delete %s?").format($("#name_" + id).html()) );
     }
 
     if ( c ) {
@@ -55,4 +74,4 @@ function delete_provider( id, users ) {
         $("#id").val( id );
         $("#sms_form").submit();
     }
-}
\ No newline at end of file
+}