After a disaster, you may be on your own for at least 2 weeks. After you fill out your family plan, this section will help you determine what you need to build your kits for you and your family, one step at a time.
+Loading...
+Loading...
} @code { - [Parameter] - public string Id { get; set; } - - public BaseKit Kit { get; set; } + [Parameter] + public string Id { get; set; } - protected override async Task OnInitializedAsync() - { + public BaseKit Kit { get; set; } - Kit = await repository.GetBaseKitById(Id); + public void AddKitItem() + { + if (Kit != null && Kit.Items != null) + { + Kit.Items.Add(new BaseKitItem { Id = Guid.NewGuid().ToString() }); + } + } - await base.OnInitializedAsync(); + public async Task SaveBaseKit() + { + if (Kit != null) + { + if (string.IsNullOrEmpty(Kit.Id)) + { + Kit = await repository.CreateBaseKit(Kit); + } + else + { + Kit = await repository.SaveBaseKit(Kit); + } - } + await JS.InvokeVoidAsync("alert", new object[] { "Base Kit Saved" }); + } + } + protected override async Task OnInitializedAsync() + { + if (string.IsNullOrEmpty(Id)) + { + Kit = new BaseKit(); + } + else + { + Kit = await repository.GetBaseKitById(Id); + } + await base.OnInitializedAsync(); + } } diff --git a/admin/TwoWeeksReady.Admin/Pages/Kits/List.razor b/admin/TwoWeeksReady.Admin/Pages/Kits/List.razor index 7e42741..e407342 100644 --- a/admin/TwoWeeksReady.Admin/Pages/Kits/List.razor +++ b/admin/TwoWeeksReady.Admin/Pages/Kits/List.razor @@ -1,15 +1,14 @@ @page "/Kits/" @attribute [Authorize (Roles = "admin")] @inject IRepository Repository +@inject ClientImageService clientImages -Name | @@ -19,12 +18,10 @@|
---|---|
- @kit.Name + @kit.Name | @kit.Items.Count() | @@ -33,11 +30,16 @@
Loading....
} else {No base kits defined.
+ Add New Kit } @code { diff --git a/api/TwoWeeksReady/EmergencyKits/BaseKitsApi.cs b/api/TwoWeeksReady/EmergencyKits/BaseKitsApi.cs index a5a1156..cca6c09 100644 --- a/api/TwoWeeksReady/EmergencyKits/BaseKitsApi.cs +++ b/api/TwoWeeksReady/EmergencyKits/BaseKitsApi.cs @@ -81,8 +81,12 @@ public async Task