@using phronCare.UIBlazor.Services.Sales @inject ProfessionalSpecialtyService specialtyService @inject DocumentTypeService documentTypeService @inject ProfessionalService ProfessionalService @inject IToastService Toast @inject Blazored.Modal.Services.IModalService ModalService Nuevo Profesional Nombre Completo * @* Tipo Doc * Seleccione... DNI CUIL LE *@ Tipo Doc * Seleccione... @foreach (var type in documentTypes) { @type.Description } Número * Matrícula Tipo de Profesional @foreach (var option in professionalTypes) { @option.Text } Especialidad --- Seleccionar --- @foreach (var s in specialties) { @s.Name } @code { [CascadingParameter] public BlazoredModalInstance ModalInstance { get; set; } = default!; private List documentTypes = new(); private List specialties = new(); private EProfessional _model = new(); protected override async Task OnInitializedAsync() { await LoadSpecialties(); await LoadDocumentTypes(); } private List<(string Value, string Text)> professionalTypes = new() { ("","--- Seleccionar ---"), ("Medico", "Médico"), ("Instrumentador", "Instrumentador quirúrgico"), ("Enfermero", "Enfermero/a"), ("Tecnico", "Técnico quirúrgico") }; private async Task LoadDocumentTypes() { documentTypes = await documentTypeService.GetAllAsync(); } private async Task LoadSpecialties() { specialties = await specialtyService.GetAllAsync(); } private async Task HandleValidSubmit() { var result = await ProfessionalService.CreateAsync(_model); if (result.IsSuccessStatusCode) { Toast.ShowSuccess("Profesional creado."); var newItem = new ELookUpItem { Id = _model.Id, Nombre = _model.Fullname }; ModalInstance.CloseAsync(ModalResult.Ok(newItem)); } else { var error = await result.Content.ReadAsStringAsync(); Toast.ShowError($"Error: {error}"); } } private async Task Cancelar() { ModalInstance.CancelAsync(); } }