ViannyCruz commited on
Commit
59d6d13
·
verified ·
1 Parent(s): 871dd24

Update web/diagnosis.html

Browse files
Files changed (1) hide show
  1. web/diagnosis.html +9 -14
web/diagnosis.html CHANGED
@@ -904,20 +904,15 @@
904
  function handlePatientSearch() {
905
  const searchTerm = $('#patientSearch').val().trim();
906
 
907
- if (searchTerm.length < 2) {
908
- $('#patientResults').hide();
909
- return;
910
- }
911
-
912
- if (typeof eel === 'undefined') {
913
- // Simular busqueda de pacientes
914
- const mockPatients = [
915
- { patientID: 1, name: 'Juan Pérez', birthDate: '1980-05-15', diabetesType: 'Tipo 2' },
916
- { patientID: 2, name: 'María García', birthDate: '2005-08-22', diabetesType: 'Tipo 1' },
917
- { patientID: 3, name: 'Carlos López', birthDate: '1990-12-10', diabetesType: 'Tipo 2' }
918
- ].filter(p => p.name.toLowerCase().includes(searchTerm.toLowerCase()));
919
-
920
- displayPatientResults(mockPatients);
921
  return;
922
  }
923
 
 
904
  function handlePatientSearch() {
905
  const searchTerm = $('#patientSearch').val().trim();
906
 
907
+ if (searchTerm.length < 1) {
908
+ // Mostrar todos los pacientes si el campo está vacío
909
+ api.getPatients('').then(function(response) {
910
+ if (response && response.success && response.patients.length > 0) {
911
+ displayPatientResults(response.patients);
912
+ } else {
913
+ $('#patientResults').hide();
914
+ }
915
+ });
 
 
 
 
 
916
  return;
917
  }
918