@page "/HomePage"
@inject NavigationManager NavigationManager


<MudStack class="w-screen h-screen bg-[#356859]">
    <div class="flex flex-row mt-4 mb-3">
        <MudStack Row="true" @onclick="ProfileClicked">
            <MudAvatar Size="Size.Large" Class="mr-5">
                <MudImage
                    Src="https://qph.cf2.quoracdn.net/main-thumb-161841968-200-xtisrhulnnwiuyeojsvojtoqjrqsglrj.jpeg">
                </MudImage>
            </MudAvatar>
            <MudStack class="justify-center ">
                <p class="font-bold text-lg text-white font-iranyekan">امیرحسین خادمی</p>
                <p class="-mt-3 text-white font-light font-iranyekan">09214802813</p>
            </MudStack>
        </MudStack>
        <MudButton class="my-auto ml-5 mr-auto font-extrabold bg-white rounded-lg">اطفال</MudButton>
    </div>
    <div class="bg-[#EEEEEE] w-full h-full flex flex-col rounded-t-xl">
        <MudStack class="pb-20 bg-[#EEEEEE] rounded-t-xl">
            <div class="flex flex-row mx-5 mt-5">
                <div>
                    <p class="font-extrabold text-[#356859]">شرح حال های امروز شما</p>
                    <p class="text-xs font-light ">لیست شرح حال های انجام شده در امروز</p>
                </div>
                <MudButton DisableElevation="false" @onclick="CreateMedicalHistoryClicked" class="text-[#356859] my-auto mr-auto font-extrabold bg-white rounded-lg drop-shadow-md">+ افزودن</MudButton>
            </div>
            
            <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-2 ">
                @foreach(var item in _medicalHistories)
                {
                    <MedicalHistoryItemTemplate MedicalHistory="@item" />
                }
            </div>

        </MudStack>

        <MudPaper class="fixed bottom-0 py-1 left-0 z-50 w-full bg-white rounded-t-xl">
            <div class="grid h-full max-w-lg grid-cols-4 mx-auto font-medium">


                <button type="button" class="inline-flex flex-col items-center justify-center px-1 group">

                    <MudIcon Icon="@Icons.Material.Outlined.MedicalInformation"
                             class="w-8 h-8 mb-2 text-[--color-primary]" />
                    <span class="-mt-1 text-sm text-[--color-primary]">شرح حال</span>
                </button>

                <button @onclick="MedicalHistoryTemplatesClicked" type="button" class="inline-flex flex-col items-center justify-center px-1 group">

                    <MudIcon Icon="@Icons.Material.Outlined.Difference"
                             Class="w-8 h-8 mb-2 text-gray-400 group-hover:text-[--color-primary]" />
                    <span class="-mt-1 text-sm text-gray-400 group-hover:text-[--color-primary]">پیش نویس</span>
                </button>

                <button @onclick="MedicalOrdersClicked" type="button" class="inline-flex flex-col items-center justify-center px-1 py-1 group">

                    <MudIcon Icon="@Icons.Material.Outlined.PostAdd"
                             Class="w-8 h-8 mb-2 text-gray-400 group-hover:text-[--color-primary]" />
                    <span class="-mt-1 text-sm text-gray-400 group-hover:text-[--color-primary]">اوردر ها</span>
                </button>

                <button @onclick="ProfileClicked" type="button"
                    class="inline-flex flex-col items-center justify-center px-1 group">

                    <MudIcon Icon="@Icons.Material.Filled.PersonOutline"
                             Class="w-8 h-8 mb-2 text-gray-400 group-hover:text-[--color-primary]" />
                    <span class="-mt-1 text-sm text-gray-400 group-hover:text-[--color-primary]">پروفایل</span>
                </button>
            </div>
        </MudPaper>
    </div>
</MudStack>

@code {
    public void ProfileClicked() => NavigationManager.NavigateTo("ProfilePage");

    public void CreateMedicalHistoryClicked() => NavigationManager.NavigateTo("MedicalHistoryActionPage");

    public void MedicalHistoryTemplatesClicked() => NavigationManager.NavigateTo("MedicalHistoryTemplatesPage");
    public void MedicalOrdersClicked() => NavigationManager.NavigateTo("MedicalOrdersPage");

    private List<MedicalHistory> _medicalHistories = new List<MedicalHistory>();
    protected override void OnInitialized()
    {
        _medicalHistories.Add(new MedicalHistory
        {
            Name = "امیرحسین معتمدی",
            Aag = 35,
            CC = "سردرد",
            Section = "داخلی",
            Gender = Gender.Male
        });
        _medicalHistories.Add(new MedicalHistory
        {
            Name = "محمد امینی",
            Aag = 40,
            CC = "معده درد",
            Section = "داخلی",
            Gender = Gender.Male
        });
        _medicalHistories.Add(new MedicalHistory
        {
            Name = "زیبا بروفه",
            Aag = 20,
            CC = "سوختگی",
            Section = "سوختگی",
            Gender = Gender.Female
        });
        _medicalHistories.Add(new MedicalHistory
        {
            Name = "روشنک فدایی",
            Aag = 18,
            CC = "دردسینه",
            Section = "داخلی",
            Gender = Gender.Female
        });
        _medicalHistories.Add(new MedicalHistory
        {
            Name = "سطلان محمدی",
            Aag = 28,
            CC = "روانی",
            Section = "روان",
            Gender = Gender.Male
        });
        _medicalHistories.Add(new MedicalHistory
            {
                Name = "سعید سعیدی",
                Aag = 60,
                CC = "بی هوشی",
                Section = "داخلی",
                Gender = Gender.Male
            });
        base.OnInitialized();
    }

}