Form style / continents
Toward #2 completion; next up, Markdown input fields...
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<Router AppAssembly="@typeof(Program).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
|
||||
@@ -13,42 +13,78 @@ 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>
|
||||
<div class="form-row">
|
||||
<div class="col col-xs-12 col-sm-12 col-md-4">
|
||||
<div class="form-check">
|
||||
<InputCheckbox id="seeking" class="form-check-input" @bind-Value="@profileForm.IsSeekingEmployment" />
|
||||
<label for="seeking" class="form-check-label">I am currently seeking employment</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col col-xs-12 col-sm-12 col-md-8">
|
||||
<div class="form-check">
|
||||
<InputCheckbox id="isPublic" class="form-check-input" @bind-Value="@profileForm.IsPublic" />
|
||||
<label for="isPublic" class="form-check-label">
|
||||
Allow my profile to be searched publicly (outside NA Social)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="col col-xs-12 col-sm-12 col-md-4">
|
||||
<div class="form-check">
|
||||
<InputCheckbox id="isRemote" class="form-check-input" @bind-Value="@profileForm.RemoteWork" />
|
||||
<label for="isRemote" class="form-check-label">I am looking for remote work</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col col-xs-12 col-sm-12 col-md-8">
|
||||
<div class="form-check">
|
||||
<InputCheckbox id="isFull" class="form-check-input" @bind-Value="@profileForm.FullTime" />
|
||||
<label for="isFull" class="form-check-label">I am looking for full-time work</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="col col-xs-12 col-sm-6 col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="continentId">Continent</label>
|
||||
<InputSelect id="continentId" @bind-Value="@profileForm.ContinentId" class="form-control">
|
||||
<option>– Select –</option>
|
||||
@foreach (var (id, name) in continents)
|
||||
{
|
||||
<option value="@id">@name</option>
|
||||
}
|
||||
</InputSelect>
|
||||
<ValidationMessage For="@(() => profileForm.ContinentId)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col col-xs-12 col-sm-6 col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="region">Region</label>
|
||||
<InputText id="region" @bind-Value="@profileForm.Region" class="form-control" />
|
||||
<ValidationMessage For="@(() => profileForm.Region)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label for="bio">Professional Biography</label>
|
||||
<InputTextArea id="bio" @bind-Value="@profileForm.Biography" class="form-control" />
|
||||
<ValidationMessage For="@(() => profileForm.Biography)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<label for="experience">Experience</label>
|
||||
<InputTextArea id="experience" @bind-Value="@profileForm.Experience" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<button type="submit">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</EditForm>
|
||||
}
|
||||
|
||||
@@ -58,10 +94,22 @@ else if (profileForm != null)
|
||||
|
||||
public ProfileForm? profileForm = null;
|
||||
|
||||
private IEnumerable<Continent> continents = Enumerable.Empty<Continent>();
|
||||
|
||||
public string errorMessage = "";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var continentResult = await ServerApi.AllContinents(http, state);
|
||||
if (continentResult.IsOk)
|
||||
{
|
||||
continents = continentResult.Ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = continentResult.Error;
|
||||
}
|
||||
|
||||
var result = await ServerApi.RetrieveProfile(http, state);
|
||||
if (result.IsOk)
|
||||
{
|
||||
|
||||
@@ -77,5 +77,22 @@ namespace JobsJobsJobs.Client
|
||||
_ => Result<Profile?>.AsError(await res.Content.ReadAsStringAsync()),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all continents
|
||||
/// </summary>
|
||||
/// <param name="http">The HTTP client to use for server communication</param>
|
||||
/// <param name="state">The current application state</param>
|
||||
/// <returns>The continents, or an error message if one occurs</returns>
|
||||
public static async Task<Result<IEnumerable<Continent>>> AllContinents(HttpClient http, AppState state)
|
||||
{
|
||||
var req = WithHeader(state, "continent/all");
|
||||
var res = await http.SendAsync(req);
|
||||
if (res.IsSuccessStatusCode) {
|
||||
var continents = await res.Content.ReadFromJsonAsync<IEnumerable<Continent>>();
|
||||
return Result<IEnumerable<Continent>>.AsOk(continents ?? Enumerable.Empty<Continent>());
|
||||
}
|
||||
return Result<IEnumerable<Continent>>.AsError(await res.Content.ReadAsStringAsync());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user