From b6d8a26880e6ed8d4a00569b8505cb501b5d94b8 Mon Sep 17 00:00:00 2001 From: AngelSuarez03 Date: Sun, 12 May 2024 13:05:35 -0600 Subject: [PATCH] Modificar Receta Funcional --- app/src/main/AndroidManifest.xml | 5 +- .../medicalhealth/AgregarActivity.kt | 4 +- .../medicalhealth/EliminarActivity.kt | 6 +- .../medicalhealth/EliminarRecetaActivity.kt | 6 +- .../medicalhealth/MainActivity.kt | 4 +- .../medicalhealth/ModificarActivity.kt | 6 +- .../medicalhealth/ModificarRecetaActivity.kt | 49 +++++++++++ .../PacientePrincipalActivity.kt | 24 ++++- .../medicalhealth/RecetaActivity.kt | 6 +- .../medicalhealth/RegistrarDActivity.kt | 4 +- .../adapters/CellClickListener.kt | 4 +- .../adapters/DoctorDataBaseHelper.kt | 8 +- .../adapters/PacienteAdapter.kt | 4 +- .../medicalhealth}/adapters/RecetaAdapter.kt | 4 +- .../adapters/RecetaDataBaseHelper.kt | 21 ++++- .../adapters/RecetaViewAdapter.kt | 15 ++-- .../medicalhealth}/data/Doctor.kt | 2 +- .../medicalhealth}/data/Paciente.kt | 2 +- .../medicalhealth}/data/Receta.kt | 2 +- .../reports/ConsultarPacientesActivity.kt | 8 +- app/src/main/res/drawable/delete.xml | 9 ++ app/src/main/res/drawable/download.xml | 9 ++ app/src/main/res/drawable/update.xml | 9 ++ .../layout/activity_consultar_pacientes.xml | 2 +- .../res/layout/activity_modificar_receta.xml | 87 +++++++++++++++++++ app/src/main/res/layout/rc_receta_item.xml | 29 +++++-- app/src/main/res/values/strings.xml | 1 + 27 files changed, 273 insertions(+), 57 deletions(-) create mode 100644 app/src/main/java/com/terratenientes/medicalhealth/ModificarRecetaActivity.kt rename app/src/main/java/{ => com/terratenientes/medicalhealth}/adapters/CellClickListener.kt (55%) rename app/src/main/java/{ => com/terratenientes/medicalhealth}/adapters/DoctorDataBaseHelper.kt (97%) rename app/src/main/java/{ => com/terratenientes/medicalhealth}/adapters/PacienteAdapter.kt (91%) rename app/src/main/java/{ => com/terratenientes/medicalhealth}/adapters/RecetaAdapter.kt (91%) rename app/src/main/java/{ => com/terratenientes/medicalhealth}/adapters/RecetaDataBaseHelper.kt (85%) rename app/src/main/java/{ => com/terratenientes/medicalhealth}/adapters/RecetaViewAdapter.kt (79%) rename app/src/main/java/{ => com/terratenientes/medicalhealth}/data/Doctor.kt (73%) rename app/src/main/java/{ => com/terratenientes/medicalhealth}/data/Paciente.kt (84%) rename app/src/main/java/{ => com/terratenientes/medicalhealth}/data/Receta.kt (80%) rename app/src/main/java/{ => com/terratenientes/medicalhealth}/reports/ConsultarPacientesActivity.kt (95%) create mode 100644 app/src/main/res/drawable/delete.xml create mode 100644 app/src/main/res/drawable/download.xml create mode 100644 app/src/main/res/drawable/update.xml create mode 100644 app/src/main/res/layout/activity_modificar_receta.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d8edc91..ec0ef92 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,6 +15,9 @@ android:supportsRtl="true" android:theme="@style/Theme.MedicalHealth" tools:targetApi="31"> + @@ -32,7 +35,7 @@ android:name=".RegistrarDActivity" android:exported="false" /> , context: Context,val cellClickListener: CellClickListener) : +class RecetaViewAdapter(private var notes : List, context: Context, val cellClickListener: CellClickListener) : RecyclerView.Adapter() { class NoteViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView){ val tituloReceta : TextView = itemView.findViewById(R.id.tv_titulo_receta) val fechaReceta : TextView = itemView.findViewById(R.id.tv_fecha_receta) val nombreReceta : TextView = itemView.findViewById(R.id.tv_nombre_paciente) - val btnDescargar : Button = itemView.findViewById(R.id.btn_descargar_receta) - val btnEliminar: Button = itemView.findViewById(R.id.btn_eliminar_receta) + val btnDescargar : ImageView = itemView.findViewById(R.id.iv_descargar_receta) + val btnEliminar: ImageView = itemView.findViewById(R.id.iv_eliminar_receta) + val btnModificar : ImageView = itemView.findViewById(R.id.iv_modificar_receta) val pesoReceta : TextView = itemView.findViewById(R.id.tv_peso_paciente) val edadReceta : TextView = itemView.findViewById(R.id.tv_edad_paciente) val dosisReceta : TextView=itemView.findViewById(R.id.tv_dosis_medicamento) @@ -49,6 +51,9 @@ class RecetaViewAdapter(private var notes : List, context: Context,val c holder.btnEliminar.setOnClickListener{ cellClickListener.onEliminarClickListener(position) } + holder.btnModificar.setOnClickListener { + cellClickListener.onModifyClickListener(position) + } } fun refreshData( newNotes : List){ diff --git a/app/src/main/java/data/Doctor.kt b/app/src/main/java/com/terratenientes/medicalhealth/data/Doctor.kt similarity index 73% rename from app/src/main/java/data/Doctor.kt rename to app/src/main/java/com/terratenientes/medicalhealth/data/Doctor.kt index 72dafb6..d23ba62 100644 --- a/app/src/main/java/data/Doctor.kt +++ b/app/src/main/java/com/terratenientes/medicalhealth/data/Doctor.kt @@ -1,3 +1,3 @@ -package data +package com.terratenientes.medicalhealth.data data class Doctor(var Cedula : String ,var Nombre : String, var Apellido : String, var Telefono : String, var Consultorio : Int) diff --git a/app/src/main/java/data/Paciente.kt b/app/src/main/java/com/terratenientes/medicalhealth/data/Paciente.kt similarity index 84% rename from app/src/main/java/data/Paciente.kt rename to app/src/main/java/com/terratenientes/medicalhealth/data/Paciente.kt index ca33451..8bd4a1c 100644 --- a/app/src/main/java/data/Paciente.kt +++ b/app/src/main/java/com/terratenientes/medicalhealth/data/Paciente.kt @@ -1,4 +1,4 @@ -package data +package com.terratenientes.medicalhealth.data data class Paciente( var id: Int, // Este campo representa el ID autoincrementable en la base de datos diff --git a/app/src/main/java/data/Receta.kt b/app/src/main/java/com/terratenientes/medicalhealth/data/Receta.kt similarity index 80% rename from app/src/main/java/data/Receta.kt rename to app/src/main/java/com/terratenientes/medicalhealth/data/Receta.kt index ace1073..b41277f 100644 --- a/app/src/main/java/data/Receta.kt +++ b/app/src/main/java/com/terratenientes/medicalhealth/data/Receta.kt @@ -1,3 +1,3 @@ -package data +package com.terratenientes.medicalhealth.data data class Receta(var NombrePaciente : String, var edadPaciente : Int, var pesoPaciente: Double, var nombreMedicamento : String, var fecha : String, var dosis : String, var duracion :String) diff --git a/app/src/main/java/reports/ConsultarPacientesActivity.kt b/app/src/main/java/com/terratenientes/medicalhealth/reports/ConsultarPacientesActivity.kt similarity index 95% rename from app/src/main/java/reports/ConsultarPacientesActivity.kt rename to app/src/main/java/com/terratenientes/medicalhealth/reports/ConsultarPacientesActivity.kt index 54b6dc4..292a395 100644 --- a/app/src/main/java/reports/ConsultarPacientesActivity.kt +++ b/app/src/main/java/com/terratenientes/medicalhealth/reports/ConsultarPacientesActivity.kt @@ -1,4 +1,4 @@ -package reports +package com.terratenientes.medicalhealth.reports import android.Manifest import android.annotation.SuppressLint @@ -11,10 +11,10 @@ import android.os.Environment import android.widget.Toast import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat -import adapters.DoctorDataBaseHelper +import com.terratenientes.medicalhealth.adapters.DoctorDataBaseHelper import com.terratenientes.medicalhealth.ModificarActivity -import data.Paciente -import adapters.PacienteAdapter +import com.terratenientes.medicalhealth.data.Paciente +import com.terratenientes.medicalhealth.adapters.PacienteAdapter import com.terratenientes.medicalhealth.R import com.terratenientes.medicalhealth.databinding.ActivityConsultarPacientesBinding import java.io.File diff --git a/app/src/main/res/drawable/delete.xml b/app/src/main/res/drawable/delete.xml new file mode 100644 index 0000000..3084d69 --- /dev/null +++ b/app/src/main/res/drawable/delete.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/download.xml b/app/src/main/res/drawable/download.xml new file mode 100644 index 0000000..4ba6b80 --- /dev/null +++ b/app/src/main/res/drawable/download.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/update.xml b/app/src/main/res/drawable/update.xml new file mode 100644 index 0000000..6849a5f --- /dev/null +++ b/app/src/main/res/drawable/update.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_consultar_pacientes.xml b/app/src/main/res/layout/activity_consultar_pacientes.xml index d861a2a..b2f591a 100644 --- a/app/src/main/res/layout/activity_consultar_pacientes.xml +++ b/app/src/main/res/layout/activity_consultar_pacientes.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" - tools:context="reports.ConsultarPacientesActivity"> + tools:context=".reports.ConsultarPacientesActivity"> + + + + + + + + + + +