Registro de doctores
This commit is contained in:
parent
a92c145e0a
commit
b30fe35494
|
@ -12,6 +12,9 @@
|
|||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.MedicalHealth"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".RegistrarDActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ConsultarPacientesActivity"
|
||||
android:exported="false" />
|
||||
|
|
|
@ -37,6 +37,10 @@ class MainActivity : AppCompatActivity() {
|
|||
val intent = Intent(this@MainActivity, ConsultarPacientesActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
binding.tvRegistrarme.setOnClickListener{
|
||||
val intent = Intent(this@MainActivity, RegistrarDActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
@SuppressLint("SuspiciousIndentation")
|
||||
private fun cargarDatos(){
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package com.terratenientes.medicalhealth
|
||||
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import com.terratenientes.medicalhealth.databinding.ActivityRegistrarDactivityBinding
|
||||
|
||||
class RegistrarDActivity : AppCompatActivity() {
|
||||
private lateinit var binding : ActivityRegistrarDactivityBinding
|
||||
private lateinit var db : DoctorDataBaseHelper
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityRegistrarDactivityBinding.inflate(layoutInflater)
|
||||
val view = binding.root
|
||||
setContentView(view)
|
||||
db= DoctorDataBaseHelper(this@RegistrarDActivity)
|
||||
binding.btnRegistrar.setOnClickListener {
|
||||
registrarUsuario()
|
||||
}
|
||||
}
|
||||
private fun registrarUsuario(){
|
||||
val cedula=binding.etCedelaRegistro.text.toString()
|
||||
val nombre=binding.etNombreRegistro.text.toString()
|
||||
val apellido=binding.etApellidoRegistro.text.toString()
|
||||
val telefono=binding.etTelefonoRegisto.text.toString()
|
||||
val domicilio = binding.etDomicilio.text.toString()
|
||||
val contrasena= binding.etContrasenaRegistro.text.toString()
|
||||
val usuario=Doctor(cedula,nombre,apellido,telefono,domicilio.toInt())
|
||||
db.agregarDoctores(usuario,contrasena)
|
||||
Toast.makeText(this@RegistrarDActivity,"USUARIO AGREGADO",Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".RegistrarDActivity"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<TextView
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/et_activity_registrar_titulo"
|
||||
android:textSize="32sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/primaryColor"
|
||||
android:gravity="center_horizontal"
|
||||
/>
|
||||
<EditText
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_width="300dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/et_cedula_registrar"
|
||||
android:id="@+id/et_cedela_registro"
|
||||
android:textColorHint="@color/black"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/et_nombre_registrar"
|
||||
android:id="@+id/et_nombre_registro"
|
||||
android:textColorHint="@color/black"
|
||||
android:layout_gravity="center_horizontal"
|
||||
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:layout_gravity="center_horizontal"
|
||||
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/et_apellido_registrar"
|
||||
android:id="@+id/et_apellido_registro"
|
||||
android:textColorHint="@color/black"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:layout_gravity="center_horizontal"
|
||||
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/et_telefono_registrar"
|
||||
android:id="@+id/et_telefono_registo"
|
||||
android:textColorHint="@color/black"
|
||||
/>
|
||||
<EditText
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/et_domicilio_registrar"
|
||||
android:id="@+id/et_domicilio"
|
||||
android:textColorHint="@color/black"
|
||||
android:inputType="number"
|
||||
android:maxLength="2"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:id="@+id/et_contrasena_registro"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="textPassword"
|
||||
android:hint="@string/et_contrasena_registrar"
|
||||
android:textColorHint="@color/black"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_width="300dp"
|
||||
android:id="@+id/btn_registrar_"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/btn_registrar_activity"
|
||||
android:backgroundTint="@color/primaryColor"
|
||||
|
||||
/>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -24,5 +24,14 @@
|
|||
|
||||
<!-- Consultar Pacientes Activity -->
|
||||
<string name="tv_titulo_consultar">Pacientes</string>
|
||||
<!--Registrar Doctor activity-->
|
||||
<string name="et_activity_registrar_titulo">Registrar</string>
|
||||
<string name="et_nombre_registrar">Nombre</string>
|
||||
<string name="et_apellido_registrar">Apellido</string>
|
||||
<string name="et_cedula_registrar">Cédula Profesional</string>
|
||||
<string name="et_telefono_registrar">Telefono</string>
|
||||
<string name="et_domicilio_registrar">Consultorio</string>
|
||||
<string name="et_contrasena_registrar">Contraseña</string>
|
||||
<string name="btn_registrar_activity">Registrar</string>
|
||||
|
||||
</resources>
|
Loading…
Reference in New Issue