2022-06-13 08:50:32 -04:00
|
|
|
@page "/accounts"
|
2022-06-15 21:56:30 -04:00
|
|
|
@using SqliteWasmHelper
|
|
|
|
|
@using BlazorWasmExample.Data
|
|
|
|
|
@using Microsoft.EntityFrameworkCore
|
|
|
|
|
@inject ISqliteWasmDbContextFactory<ThingContext> Factory
|
2022-06-13 08:50:32 -04:00
|
|
|
|
|
|
|
|
<PageTitle>Accounts</PageTitle>
|
|
|
|
|
|
|
|
|
|
<h1>Accounts</h1>
|
|
|
|
|
|
2022-06-14 17:10:04 -04:00
|
|
|
<body>
|
|
|
|
|
<div class="box-wrapper">
|
|
|
|
|
<div class="left-column">
|
|
|
|
|
<p>Assigned Company Names</p>
|
|
|
|
|
<input placeholder="Accounts Added" @bind="newAccount" />
|
|
|
|
|
<button @onclick="addAccount">Add Account</button>
|
|
|
|
|
<ul>
|
|
|
|
|
@foreach (var account in accounts)
|
|
|
|
|
{
|
|
|
|
|
<td>
|
2022-06-15 21:30:14 -04:00
|
|
|
<input type="checkbox" bind="@accountboxvalue" /> @account.AccountName<br />
|
|
|
|
|
Boolvalue: @accountboxvalue<br />
|
|
|
|
|
<button onclick="@toggle">toggle</button>
|
2022-06-14 17:10:04 -04:00
|
|
|
</td>
|
|
|
|
|
}
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="middle-column">
|
|
|
|
|
<h3>Tasks</h3>
|
|
|
|
|
{
|
|
|
|
|
@foreach (var tasks in accounts)
|
|
|
|
|
{
|
|
|
|
|
<li>@tasks.Tasks</li>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
<input placeholder="Tasks Added" @bind="newTask" />
|
|
|
|
|
<button @onclick="addTask">Add Task</button>
|
|
|
|
|
<ul>
|
2022-06-15 21:30:14 -04:00
|
|
|
@foreach (var task in )
|
2022-06-14 17:10:04 -04:00
|
|
|
{
|
|
|
|
|
<li>
|
|
|
|
|
@task.TaskName
|
|
|
|
|
</li>
|
|
|
|
|
}
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</body>
|
2022-06-13 08:50:32 -04:00
|
|
|
|
|
|
|
|
@code {
|
2022-06-15 21:30:14 -04:00
|
|
|
public string? TaskNote;
|
2022-06-13 08:50:32 -04:00
|
|
|
private string? newAccount;
|
2022-06-15 21:30:14 -04:00
|
|
|
private List<Account> accounts = new List<Account>();
|
|
|
|
|
private Dictionary<string, string> tasks = new();
|
2022-06-14 17:10:04 -04:00
|
|
|
private string? newTask;
|
2022-06-15 21:30:14 -04:00
|
|
|
private bool accountboxvalue { get; set; }
|
2022-06-13 08:50:32 -04:00
|
|
|
|
2022-06-15 21:30:14 -04:00
|
|
|
private void toggle()
|
|
|
|
|
{
|
|
|
|
|
accountboxvalue = !accountboxvalue;
|
|
|
|
|
}
|
2022-06-14 17:10:04 -04:00
|
|
|
private void addAccount()
|
2022-06-13 08:50:32 -04:00
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(newAccount))
|
|
|
|
|
{
|
2022-06-15 21:30:14 -04:00
|
|
|
Account accounts = new Account(AccountName, tasks, LastContacted);
|
|
|
|
|
accounts.Add(accounts);
|
|
|
|
|
Account newAccount = new Account{newAccount};
|
|
|
|
|
accounts.Add(new Account { AccountName = newAccount });
|
2022-06-13 08:50:32 -04:00
|
|
|
newAccount = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-06-14 17:10:04 -04:00
|
|
|
private void addTask()
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(newTask))
|
|
|
|
|
{
|
2022-06-15 21:30:14 -04:00
|
|
|
if (Account.Equals(accountboxvalue));
|
|
|
|
|
{
|
|
|
|
|
tasks.Add(newTask, "");
|
|
|
|
|
newTask = string.Empty;
|
|
|
|
|
}
|
2022-06-14 17:10:04 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-06-13 08:50:32 -04:00
|
|
|
}
|