WIP on profile page

This commit is contained in:
2020-12-18 22:46:34 -05:00
parent 786f79a52c
commit 47e32fd475
4 changed files with 154 additions and 1 deletions

View File

@@ -25,7 +25,7 @@ else
@code {
bool retrievingProfile = true;
Profile? profile = null;
JobsJobsJobs.Shared.Profile? profile = null;
string? errorMessage = null;
protected override async Task OnInitializedAsync()

View File

@@ -0,0 +1,81 @@
@page "/citizen/profile"
@using JobsJobsJobs.Client.ViewModels
@inject HttpClient http
@inject AppState state
<h3>Employment Profile</h3>
@if (errorMessage != "")
{
<p>@errorMessage</p>
}
else if (profileForm != null)
{
<EditForm Model="@profileForm" OnValidSubmit="@SaveProfile">
<DataAnnotationsValidator />
<ValidationSummary />
<label>
<InputCheckbox @bind-Value="@profileForm.IsSeekingEmployment" />
I am currently seeking employment
</label>
<label>
<InputCheckbox @bind-Value="@profileForm.IsPublic" />
Allow my profile to be searched publicly (outside NA Social)
</label><br>
<label>
Continent
<InputSelect @bind-Value="@profileForm.ContinentId" />
</label>
<label>
Region
<InputText @bind-Value="@profileForm.Region" />
</label><br>
<label>
<InputCheckbox @bind-Value="@profileForm.RemoteWork" />
I am looking for remote work
</label>
<label>
<InputCheckbox @bind-Value="@profileForm.FullTime" />
I am looking for full-time work
</label><br>
<label>
Professional Biography
<InputTextArea @bind-Value="@profileForm.Biography" />
</label><br>
<label>
Experience
<InputTextArea @bind-Value="@profileForm.Experience" />
</label>
<p>
<button type="submit">Save</button>
</p>
</EditForm>
}
@code {
public JobsJobsJobs.Shared.Profile? profile = null;
public ProfileForm? profileForm = null;
public string errorMessage = "";
protected override async Task OnInitializedAsync()
{
var result = await ServerApi.RetrieveProfile(http, state);
if (result.IsOk)
{
profile = result.Ok;
profileForm = (profile == null) ? new ProfileForm() : ProfileForm.FromProfile(profile);
}
else
{
errorMessage = result.Error;
}
}
public void SaveProfile()
{
// TODO: save profile
}
}