diff --git a/app/views/index.jade b/app/views/index.jade index 3831edc..022b7fa 100644 --- a/app/views/index.jade +++ b/app/views/index.jade @@ -27,10 +27,6 @@ html(lang="en") img(src='img/OpenHMIS-logo.jpg') div#search h1 Client Search - form(action="/upload", method="post", enctype="multipart/form-data" id="importForm") - input#import_file(type='file' name="import.csv") - button#importAll(type='button') - div#duplicate_notification form#searchForm div.form-group input#searchField.form-control(name='searchField', type='text', placeholder='search by first or last name') @@ -40,6 +36,9 @@ html(lang="en") div.buttonBox button#addNewClient(type='button') button#exportAll(type='button') + form(action="/upload", method="post", enctype="multipart/form-data" id="importForm") + input#import_file(type='file' name="import.csv" style="opacity:0; height: 5px;") + button#importAll(type='button') div#intake h1 Client Intake form#intakeForm diff --git a/public/js/index.js b/public/js/index.js index fa6efa2..aabfdba 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -24,6 +24,7 @@ $(function() { }).done(function(data) { $("#index").data("full-data", data); $("#searchForm #searchField").keyup(function() { + $("#duplicate_box").remove(); var userString = $("#searchForm #searchField").val(); if (userString.length >= minSearchLength) { var dataLength = data.length; @@ -60,7 +61,10 @@ $(function() { exportAll(); }); $("#importAll").click(function() { - importAll(); + $("#import_file").trigger('click'); + $('#import_file').change(function(click) { + importAll(); + }); }); $("#intakeForm input").keyup(function(e) { @@ -1004,14 +1008,16 @@ $(function() { } // loop through array var line_counter = 0; - var duplicate_lines = ""; + var duplicate_lines = "