| Lines 1-4
          
      
      
        Link Here | 
        
          | 1 | (function () { | 1 | (function () { | 
            
              |  |  | 2 |     // Bail if there aren't any metadata enrichment plugins installed | 
            
              | 3 |     if (typeof metadata_enrichment_services === 'undefined') { | 
            
              | 4 |         console.log('No metadata enrichment plugins found.') | 
            
              | 5 |         return; | 
            
              | 6 |     } | 
            
              | 7 |  | 
        
          | 2 |     window.addEventListener('load', onload); | 8 |     window.addEventListener('load', onload); | 
        
          | 3 |  | 9 |  | 
        
          | 4 |     // Delay between API requests | 10 |     // Delay between API requests | 
  
    | Lines 7-13
          
      
      
        Link Here | 
        
          | 7 |     // Elements we work frequently with | 13 |     // Elements we work frequently with | 
        
          | 8 |     var textarea = document.getElementById("identifiers_input"); | 14 |     var textarea = document.getElementById("identifiers_input"); | 
        
          | 9 |     var nameInput = document.getElementById("name"); | 15 |     var nameInput = document.getElementById("name"); | 
          
            
              | 10 |     var cardnumberInput = document.getElementById("cardnumber"); | 16 |     var cardnumberInput = document.getElementById("batchcardnumber"); | 
        
          | 11 |     var branchcodeSelect = document.getElementById("branchcode"); | 17 |     var branchcodeSelect = document.getElementById("branchcode"); | 
        
          | 12 |     var processButton = document.getElementById("process_button"); | 18 |     var processButton = document.getElementById("process_button"); | 
        
          | 13 |     var createButton = document.getElementById("button_create_batch"); | 19 |     var createButton = document.getElementById("button_create_batch"); | 
  
    | Lines 21-27
          
      
      
        Link Here | 
        
          | 21 |     var createRequestsButton = document.getElementById('create-requests-button'); | 27 |     var createRequestsButton = document.getElementById('create-requests-button'); | 
        
          | 22 |     var statusesSelect = document.getElementById('statuscode'); | 28 |     var statusesSelect = document.getElementById('statuscode'); | 
        
          | 23 |  | 29 |  | 
            
              | 24 |  |  |  | 
        
          | 25 |     // We need a data structure keyed on identifier type, which tells us how to parse that | 30 |     // We need a data structure keyed on identifier type, which tells us how to parse that | 
        
          | 26 |     // identifier type and what services can get its metadata. We receive an array of | 31 |     // identifier type and what services can get its metadata. We receive an array of | 
        
          | 27 |     // available services | 32 |     // available services | 
  
    | Lines 299-304
          
      
      
        Link Here | 
        
          | 299 |                 tableContent.data = tableContent.data.map(function (row) { | 304 |                 tableContent.data = tableContent.data.map(function (row) { | 
        
          | 300 |                     if (row.value === identifier) { | 305 |                     if (row.value === identifier) { | 
        
          | 301 |                         row.requestId = data.illrequest_id; | 306 |                         row.requestId = data.illrequest_id; | 
            
              |  |  | 307 |                         row.requestStatus = data.status; | 
        
          | 302 |                     } | 308 |                     } | 
        
          | 303 |                     return row; | 309 |                     return row; | 
        
          | 304 |                 }); | 310 |                 }); | 
  
    | Lines 512-518
          
      
      
        Link Here | 
        
          | 512 |             }) | 518 |             }) | 
        
          | 513 |         }) | 519 |         }) | 
        
          | 514 |             .then(function (response) { | 520 |             .then(function (response) { | 
          
            
              | 515 |                 return response.json(); | 521 |                 if ( response.ok ) { | 
            
              |  |  | 522 |                     return response.json(); | 
            
              | 523 |                 } | 
            
              | 524 |                 return Promise.reject(response); | 
        
          | 516 |             }) | 525 |             }) | 
        
          | 517 |             .then(function (body) { | 526 |             .then(function (body) { | 
        
          | 518 |                 batchId = body.id; | 527 |                 batchId = body.id; | 
  
    | Lines 528-535
          
      
      
        Link Here | 
        
          | 528 |                 }; | 537 |                 }; | 
        
          | 529 |                 initPostCreate(); | 538 |                 initPostCreate(); | 
        
          | 530 |             }) | 539 |             }) | 
          
            
              | 531 |             .catch(function () { | 540 |             .catch(function (response) { | 
            
              | 532 |                 handleApiError(ill_batch_create_api_fail); | 541 |                 response.json().then((json) => { | 
            
              |  |  | 542 |                     if( json.error ) { | 
            
              | 543 |                         handleApiError(json.error); | 
            
              | 544 |                     } else { | 
            
              | 545 |                         handleApiError(ill_batch_create_api_fail); | 
            
              | 546 |                     } | 
            
              | 547 |                 }) | 
        
          | 533 |             }); | 548 |             }); | 
        
          | 534 |     }; | 549 |     }; | 
        
          | 535 |  | 550 |  | 
  
    | Lines 893-898
          
      
      
        Link Here | 
        
          | 893 |         return data.requestId || '-'; | 908 |         return data.requestId || '-'; | 
        
          | 894 |     } | 909 |     } | 
        
          | 895 |  | 910 |  | 
            
              |  |  | 911 |     function createRequestStatus(x, y, data) { | 
            
              | 912 |         return data.requestStatus || '-'; | 
            
              | 913 |     } | 
            
              | 914 |  | 
        
          | 896 |     function buildTable(identifiers) { | 915 |     function buildTable(identifiers) { | 
        
          | 897 |         table = KohaTable('identifier-table', { | 916 |         table = KohaTable('identifier-table', { | 
        
          | 898 |             processing: true, | 917 |             processing: true, | 
  
    | Lines 918-926
          
      
      
        Link Here | 
        
          | 918 |                 }, | 937 |                 }, | 
        
          | 919 |                 { | 938 |                 { | 
        
          | 920 |                     data: 'requestId', | 939 |                     data: 'requestId', | 
          
            
              | 921 |                     width: '13%', | 940 |                     width: '6.5%', | 
        
          | 922 |                     render: createRequestId | 941 |                     render: createRequestId | 
        
          | 923 |                 }, | 942 |                 }, | 
            
              |  |  | 943 |                 { | 
            
              | 944 |                     data: 'requestStatus', | 
            
              | 945 |                     width: '6.5%', | 
            
              | 946 |                     render: createRequestStatus | 
            
              | 947 |                 }, | 
        
          | 924 |                 { | 948 |                 { | 
        
          | 925 |                     width: '18%', | 949 |                     width: '18%', | 
        
          | 926 |                     render: createActions, | 950 |                     render: createActions, | 
  
    | Lines 1021-1043
          
      
      
        Link Here | 
        
          | 1021 |     } | 1045 |     } | 
        
          | 1022 |  | 1046 |  | 
        
          | 1023 |     function patronAutocomplete() { | 1047 |     function patronAutocomplete() { | 
          
            
              | 1024 |         // Add autocomplete for patron selection | 1048 |         patron_autocomplete( | 
            
              | 1025 |         $('#batch-form #cardnumber').autocomplete({ | 1049 |             $('#batch-form #batchcardnumber'), | 
            
              | 1026 |             appendTo: '#batch-form', | 1050 |             { | 
            
              | 1027 |             source: "/cgi-bin/koha/circ/ysearch.pl", | 1051 |               'on-select-callback': function( event, ui ) { | 
            
              | 1028 |             minLength: 3, | 1052 |                 $("#batch-form #batchcardnumber").val( ui.item.cardnumber ); | 
            
              | 1029 |             select: function (event, ui) { |  |  | 
            
              | 1030 |                 var field = ui.item.cardnumber; | 
            
              | 1031 |                 $('#batch-form #cardnumber').val(field) | 
        
          | 1032 |                 return false; | 1053 |                 return false; | 
            
              |  |  | 1054 |               } | 
        
          | 1033 |             } | 1055 |             } | 
          
            
              | 1034 |         }) | 1056 |           ); | 
            
              | 1035 |             .data("ui-autocomplete")._renderItem = function (ul, item) { |  |  | 
            
              | 1036 |                 return $("<li></li>") | 
            
              | 1037 |                     .data("ui-autocomplete-item", item) | 
            
              | 1038 |                     .append("<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>") | 
            
              | 1039 |                     .appendTo(ul); | 
            
              | 1040 |             }; | 
        
          | 1041 |     }; | 1057 |     }; | 
        
          | 1042 |  | 1058 |  | 
        
          | 1043 |     function createPatronLink() { | 1059 |     function createPatronLink() { |