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

118 lines
6.0 KiB
Plaintext

@page "/MedicalHistoryTemplateActionPage"
@page "/MedicalHistoryTemplateActionPage/{TemplateId}"
@inject NavigationManager NavigationManager
@inject IRestWrapper RestWrapper
@inject IUserUtility UserUtility
@inject ISnackbar Snackbar
@inject IDialogService DialogService
@inject IJSRuntime JsRuntime
<BasePageUi Title="افزودن یک پیش نویس جدید" Description="پیش نویس خود را با دقت وارد کنید">
<div class="flex flex-col w-full h-full rounded-t-xl p-1">
<MudCarousel class="w-full h-full overflow-x-hidden overflow-y-scroll"
@ref="@ViewModel.Carousel"
ShowArrows="false"
ShowBullets="false" EnableSwipeGesture="false" AutoCycle="false" TData="object">
<MudCarouselItem>
<div class="flex flex-col w-full h-full p-4">
<MedicalHistoryTemplateActionStep1
IsEditing="@ViewModel.IsEditing"
DeleteClicked="@ViewModel.DeleteMedicalHistoryTemplateAsync"
@bind-ChiefComplaint="@ViewModel.PageDto.ChiefComplaint" @bind-SelectedSection="@ViewModel.SelectedSelection" />
</div>
</MudCarouselItem>
<MudCarouselItem>
<div class="flex flex-col h-full p-4">
<MedicalHistoryTemplateActionStep2 ChiefComplaint="@ViewModel.PageDto.ChiefComplaint" PiQuestions="@ViewModel.PiQuestions" />
</div>
</MudCarouselItem>
<MudCarouselItem>
<div class="flex flex-col h-full p-4">
<MedicalHistoryTemplateActionStep3 ChiefComplaint="@ViewModel.PageDto.ChiefComplaint" PdhQuestions="@ViewModel.PdhQuestions" PshQuestions="@ViewModel.PshQuestions" />
</div>
</MudCarouselItem>
<MudCarouselItem>
<div class="flex flex-col h-full p-4">
<MedicalHistoryTemplateActionStep4 ChiefComplaint="@ViewModel.PageDto.ChiefComplaint" FamilyHistories="@ViewModel.FhQuestions" DrugHistories="@ViewModel.DhQuestions" AhMedicines="@ViewModel.AhQuestions" />
</div>
</MudCarouselItem>
<MudCarouselItem>
<div class="flex flex-col h-full p-4">
<MedicalHistoryTemplateActionStep5 ReviewOfSystems="@ViewModel.RosQuestions" GeneralAppearance="@ViewModel.GaQuestions" />
</div>
</MudCarouselItem>
<MudCarouselItem>
<div class="flex flex-col h-full p-4">
<MedicalHistoryTemplateActionStep6 SubmittedOnClick="@ViewModel.SubmitCreateTemplateAsync" />
</div>
</MudCarouselItem>
</MudCarousel>
@if (!@ViewModel.MedicalHistorySubmitted)
{
if (@ViewModel.IsProcessing)
{
<MudPaper class="bottom-0 left-0 fixed w-full bg-gray-700 px-3 pt-4 pb-3 rou nded-t-xl flex flex-row">
<div class="flex flex-row w-full mx-auto">
<MudProgressCircular class="my-auto mr-1 -ml-4" Size="Size.Small" Color="Color.Warning" Indeterminate="true" />
<p class="font-extrabold my-0 mr-7 text-lg text-[--color-medicalhistory]">منتظر بمانید</p>
</div>
</MudPaper>
}
else
{
<MudPaper class="bottom-0 left-0 fixed w-full bg-gray-700 px-3 pt-4 pb-3 rounded-t-xl flex flex-row">
@if (@ViewModel.CurrentStep == 4)
{
@if (@ViewModel.IsEditing)
{
<MudButton @onclick="@ViewModel.CompleteStepClicked" Variant="Variant.Filled"
IconSize="Size.Large" StartIcon="@Icons.Material.Filled.ChevronRight"
class="font-extrabold rounded-full bg-[--color-medicalhistory]">ویرایش</MudButton>
}
else
{
<MudButton @onclick="@ViewModel.CompleteStepClicked" Variant="Variant.Filled"
IconSize="Size.Large" StartIcon="@Icons.Material.Filled.ChevronRight"
class="font-extrabold rounded-full bg-[--color-medicalhistory]">تـــکمیل</MudButton>
}
}
else
{
<MudButton @onclick="@ViewModel.CompleteStepClicked" Variant="Variant.Outlined" IconSize="Size.Large"
StartIcon="@Icons.Material.Filled.ChevronRight" class="font-extrabold rounded-full border-[--color-medicalhistory] text-[--color-medicalhistory]">
مرحله بعد
</MudButton>
}
<p class="my-auto text-lg text-[--color-medicalhistory] font-extrabold text-center grow">@ViewModel.StepCounter</p>
<MudButton @onclick="@ViewModel.RollBackStepClicked" Disabled="@ViewModel.DisableBackButton" IconSize="Size.Large" EndIcon="@Icons.Material.Filled.ChevronLeft"
class="font-extrabold text-[--color-medicalhistory] rounded-full">مرحله قبل</MudButton>
</MudPaper>
}
}
</div>
</BasePageUi>
@code {
[Parameter]
public string TemplateId { get; set; } = string.Empty;
public MedicalHistoryTemplateActionPageViewModel ViewModel { get; set; }
protected override async Task OnInitializedAsync()
{
ViewModel = Guid.TryParse(TemplateId, out Guid templateId) ?
new MedicalHistoryTemplateActionPageViewModel(NavigationManager, Snackbar, RestWrapper, UserUtility, DialogService,JsRuntime, templateId)
: new MedicalHistoryTemplateActionPageViewModel(NavigationManager, Snackbar, RestWrapper, UserUtility);
await ViewModel.InitializeAsync();
await base.OnInitializedAsync();
}
}