Add Patient QuickAdd
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 14m58s

This commit is contained in:
Leandro Hernan Rojas 2025-05-22 09:28:06 -03:00
parent acd6672040
commit ee013c952c
14 changed files with 159 additions and 1 deletions

View File

@ -26,6 +26,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {

View File

@ -33,6 +33,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {

View File

@ -26,6 +26,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
@ -91,6 +92,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {

View File

@ -4042,6 +4042,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {

View File

@ -26,6 +26,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {

View File

@ -1264,6 +1264,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {

View File

@ -26,6 +26,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
@ -101,6 +102,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
@ -187,6 +189,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
@ -252,6 +255,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
@ -333,6 +337,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
@ -500,6 +505,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
@ -579,6 +585,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {

View File

@ -9668,6 +9668,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {

View File

@ -26,6 +26,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
@ -125,6 +126,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {

View File

@ -2413,6 +2413,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {

View File

@ -0,0 +1,121 @@
@using phronCare.UIBlazor.Services.Sales
@using Blazored.Modal
@using Blazored.Modal.Services
@using Domain.Entities
@inject DocumentTypeService documentTypeService
@inject PatientService patientService
@inject IToastService Toast
@inherits OwningComponentBase
<EditForm Model="_model" OnValidSubmit="HandleValidSubmit">
<DataAnnotationsValidator />
<ValidationSummary />
<div class="card" style="zoom: 80%;">
<div class="card-header">
<h5 class="card-title mb-0">Nuevo Paciente</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label">Nombre *</label>
<InputText class="form-control" @bind-Value="_model.Firstname" />
<ValidationMessage For="@(() => _model.Firstname)" />
</div>
<div class="col-md-6 mb-3">
<label class="form-label">Apellido *</label>
<InputText class="form-control" @bind-Value="_model.Lastname" />
<ValidationMessage For="@(() => _model.Lastname)" />
</div>
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label">Tipo Documento *</label>
<InputSelect class="form-select" @bind-Value="_model.DocumenttypesId">
<option value="">Seleccione...</option>
@foreach (var doc in documentTypes)
{
<option value="@doc.Id">@doc.Description</option>
}
</InputSelect>
<ValidationMessage For="@(() => _model.DocumenttypesId)" />
</div>
<div class="col-md-6 mb-3">
<label class="form-label">Nro Documento *</label>
<InputText class="form-control" @bind-Value="_model.DocumentNumber" />
<ValidationMessage For="@(() => _model.DocumentNumber)" />
</div>
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label">Fecha Nacimiento</label>
<InputDate class="form-control" @bind-Value="_model.Birthdate" />
</div>
<div class="col-md-6 mb-3">
<label class="form-label">Nro Afiliado</label>
<InputText class="form-control" @bind-Value="_model.AffiliateNumber" />
</div>
</div>
<div class="row">
<div class="col-md-12 mb-3">
<label class="form-label d-block">Género</label>
<InputRadioGroup @bind-Value="_model.Gender">
<div class="form-check form-check-inline">
<InputRadio class="form-check-input" Value="@( "Masculino")" id="radioM" />
<label class="form-check-label" for="radioM">Masculino</label>
</div>
<div class="form-check form-check-inline">
<InputRadio class="form-check-input" Value="@( "Femenino")" id="radioF" />
<label class="form-check-label" for="radioF">Femenino</label>
</div>
<div class="form-check form-check-inline">
<InputRadio class="form-check-input" Value="@( "Otro")" id="radioO" />
<label class="form-check-label" for="radioO">Otro</label>
</div>
</InputRadioGroup>
</div>
</div>
</div>
<div class="card-footer text-end">
<button type="submit" class="btn btn-success">Guardar</button>
<button type="button" class="btn btn-secondary ms-2" @onclick="Cancelar">Cancelar</button>
</div>
</div>
</EditForm>
@code {
[CascadingParameter] public BlazoredModalInstance ModalInstance { get; set; } = default!;
private EPatient _model = new();
private List<EDocumentType> documentTypes = new();
protected override async Task OnInitializedAsync()
{
documentTypes = await documentTypeService.GetAllAsync();
}
private async Task HandleValidSubmit()
{
var result = await patientService.CreateAsync(_model);
if (result.IsSuccessStatusCode)
{
Toast.ShowSuccess("Paciente creado.");
var newItem = new ELookUpItem { Id = _model.Id, Nombre = $"{_model.Firstname} {_model.Lastname}" };
await ModalInstance.CloseAsync(ModalResult.Ok(newItem));
}
else
{
var error = await result.Content.ReadAsStringAsync();
Toast.ShowError($"Error: {error}");
}
}
private async Task Cancelar()
{
await ModalInstance.CancelAsync();
}
}

View File

@ -84,7 +84,7 @@
<ResultTemplate Context="item">@item.Nombre</ResultTemplate>
<SelectedTemplate Context="item">@item.Nombre</SelectedTemplate>
</BlazoredTypeahead>
<button type="button" class="add-btn" title="Agregar paciente">+</button>
<button type="button" class="add-btn" title="Agregar paciente" @onclick="AddNewPatient">+</button>
</div>
</div>
<!-- FILA 3: Institución, Unidad de negocio -->
@ -361,6 +361,21 @@
_quoteModel.PhSQuoteDetails.Add(newDetail);
}
}
private async Task AddNewPatient()
{
var options = new ModalOptions()
{
Size = ModalSize.Large,
HideHeader = true
};
var modal = Modal.Show<PatientQuickAddModal>(options);
var result = await modal.Result;
if (!result.Cancelled && result.Data is ELookUpItem nuevo)
{
_selectedPatient = nuevo;
}
}
private async Task AddNewProfessional()
{
var options = new ModalOptions()

View File

@ -26,6 +26,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
@ -91,6 +92,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
@ -213,6 +215,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {

View File

@ -10362,6 +10362,7 @@
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {