@attribute [Route(RouteConstants.Profile.Personal)]

<PageTitle>اطلاعات شخصی</PageTitle>

<MudContainer MaxWidth="MaxWidth.Medium" Class="py-6">
    <MudStack Spacing="3">
        <PageHeader Title="اطلاعات شخصی" BackHref="@RouteConstants.Profile.Index" />

        <MudPaper Elevation="2" Class="pa-4 rounded-lg">
            <MudForm @ref="_personalForm" Model="_updateUserRequest">
                <MudGrid Spacing="3">
                    <MudItem xs="12" md="6">
                        <MudTextField @bind-Value="_updateUserRequest.FirstName"
                                      For="@(() => _updateUserRequest.FirstName)"
                                      Label="نام"
                                      Variant="Variant.Outlined" />
                    </MudItem>
                    <MudItem xs="12" md="6">
                        <MudTextField @bind-Value="_updateUserRequest.LastName"
                                      For="@(() => _updateUserRequest.LastName)"
                                      Label="نام خانوادگی"
                                      Variant="Variant.Outlined" />
                    </MudItem>
                    <MudItem xs="12" md="6">
                        <MudTextField @bind-Value="_updateUserRequest.NationalCode"
                                      For="@(() => _updateUserRequest.NationalCode)"
                                      Disabled="@(!string.IsNullOrWhiteSpace(_updateUserRequest.NationalCode))"
                                      Label="کد ملی"
                                      Variant="Variant.Outlined"
                                      InputType="InputType.Text" />
                    </MudItem>
                    <MudItem xs="12" md="6">
                        <MudDatePicker Label="تاریخ تولد"
                                       @bind-Date="_date"
                                       OpenTo="OpenTo.Year"
                                       Variant="Variant.Outlined"
                                       Culture="@Extensions.GetPersianCulture()"
                                       TitleDateFormat="dddd, dd MMMM" />
                    </MudItem>
                </MudGrid>
                <MudStack Row="true" Spacing="2" Justify="Justify.FlexEnd" Class="mt-4">
                    <MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="SavePersonalInfo" Disabled="_isPersonalSaving">
                        ذخیره تغییرات
                    </MudButton>
                </MudStack>
            </MudForm>
        </MudPaper>
    </MudStack>
</MudContainer>
