Api-PWA/DocuMed.PWA/Pages/MedicalHistoryTemplateActio.../MedicalHistoryTemplateActio...

72 lines
3.1 KiB
Plaintext

@inject IRestWrapper RestWrapper
@inject IUserUtility UserUtility
<MudStack class="my-auto text-center font-iranyekan">
<p class="text-lg font-extrabold">افزودن پیش نویس شرح حال جدید</p>
<p class="text-center text-md">
لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از
طراحان گرافیک است چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی
مورد ده
</p>
<BasePartDivider Index="1" Title="شکایت اصلی بیمار" />
<MudTextField T="string" Value="@ChiefComplaint" ValueChanged="async cc => {ChiefComplaint=cc; await ChiefComplaintChanged.InvokeAsync(ChiefComplaint); }"
Label="شکایت اصلی بیمار ( CC )" Variant="Variant.Outlined" Margin="Margin.Normal" />
<MudAutocomplete Value="@SelectedSection" T="SectionSDto" Label="بخش بیمار" Variant="Variant.Outlined"
ToStringFunc="dto => dto.Name"
SearchFunc="@SearchSection"
ValueChanged="async dto => { SelectedSection=dto; await SelectedSectionChanged.InvokeAsync(SelectedSection); }">
<ProgressIndicatorInPopoverTemplate>
<MudList Clickable="false">
<MudListItem>
<div class="flex flex-row w-full mx-auto">
<MudProgressCircular class="my-auto mr-1 -ml-4" Size="Size.Small" Indeterminate="true" />
<p class="font-bold my-1 mx-auto text-md">منتظر بمانید</p>
</div>
</MudListItem>
</MudList>
</ProgressIndicatorInPopoverTemplate>
<ItemTemplate Context="e">
<p>@e.Name</p>
</ItemTemplate>
</MudAutocomplete>
</MudStack>
@code {
[Parameter]
public string ChiefComplaint { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> ChiefComplaintChanged { get; set; }
[Parameter]
public SectionSDto SelectedSection { get; set; } = new();
[Parameter]
public EventCallback<SectionSDto> SelectedSectionChanged { get; set; }
private MedicalHistoryTemplateLDto _editingTemplate = new();
public List<SectionSDto> Sections { get; private set; } = new List<SectionSDto>();
public async Task<IEnumerable<SectionSDto>> SearchSection(string section)
{
try
{
var token = await UserUtility.GetBearerTokenAsync();
var user = await UserUtility.GetUserAsync();
Sections = await RestWrapper.SectionRestApi.GetByUniversityAsync(user.UniversityId, token);
if (section.IsNullOrEmpty())
return Sections;
return Sections.Where(c => c.Name.Contains(section));
}
catch (ApiException ex)
{
var exe = await ex.GetContentAsAsync<ApiResult>();
return Sections;
}
catch (Exception e)
{
return Sections;
}
}
}