Skip to content

Commit

Permalink
Inventory view
Browse files Browse the repository at this point in the history
  • Loading branch information
Linkens committed Nov 7, 2022
1 parent 4f7a768 commit 2dc632e
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 2 deletions.
57 changes: 57 additions & 0 deletions ExpertCities.Blazor/Pages/Assets/Inventory/InventoryEditView.razor
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,73 @@
<label>@Loc["Item"]</label>
<input @bind-value=@Inventory.Item class="form-control" />
}
<label>@Loc["Quantity"]</label>
<input class="form-control" type="number" @bind-value=Inventory.Quantity />
<div class="row">
<div class="col-xl-6">
<RadzenAccordion class="my-2">
<Items>
<RadzenAccordionItem Text="@Loc["Make"]" Icon="copyright" Selected=@IsMake>
<label>@Loc["Manufacturer"]</label>
<input class="form-control" @bind-value=Inventory.Manufacturer />
<label>@Loc["Brand"]</label>
<input class="form-control" @bind-value=Inventory.Brand />
<label>@Loc["Series"]</label>
<input class="form-control" @bind-value=Inventory.Series />
</RadzenAccordionItem>
</Items>
</RadzenAccordion>
</div>
<div class="col-xl-6">
<RadzenAccordion class="my-2">
<Items>
<RadzenAccordionItem Text="@Loc["Dimensions"]" Icon="extension" Selected=@IsDimension>
<label>@Loc["Length"]</label>
<input class="form-control" type="number" @bind-value=Inventory.Length />
<label>@Loc["Height"]</label>
<input class="form-control" type="number" @bind-value=Inventory.Height />
<label>@Loc["Width"]</label>
<input class="form-control" type="number" @bind-value=Inventory.Width />
<label>@Loc["Length"]</label>
<input class="form-control" type="number" @bind-value=Inventory.Length />
<label>@Loc["Surface"]</label>
<input class="form-control" type="number" @bind-value=Inventory.Surface />
<label>@Loc["Volume"]</label>
<input class="form-control" type="number" @bind-value=Inventory.Volume />
</RadzenAccordionItem>
</Items>
</RadzenAccordion>
</div>
</div>
</EditForm>
<div class="form-floating">
<textarea class="form-control" @bind=Inventory.Description style="min-height:10rem;" placeholder=" ">
</textarea>
<label>@Loc["Description"]</label>
</div>
<div class="form-floating mt-3">
<textarea class="form-control" @bind=Inventory.Comments style="min-height:10rem;" placeholder=" ">
</textarea>
<label>@Loc["Comments"]</label>
</div>
<div class="d-flex justify-content-center mt-2">
<button @onclick=Close class="btn btn-primary" type="submit"><span class="oi oi-check"></span></button>
</div>
@code {
protected bool IsDimension;
protected bool IsMake;
[Parameter] public ECContext c { get; set; }
[Parameter] public Inventory Inventory { get; set; }
[Parameter] public List<Uniformat> Formats { get; set; }
[Parameter] public IStringLocalizer Loc { get; set; }

protected override void OnInitialized()
{
IsDimension = Inventory.Length > 0 || Inventory.Surface > 0 || Inventory.Width > 0 || Inventory.Volume > 0 || Inventory.Height > 0;
IsMake = !string.IsNullOrWhiteSpace(Inventory.Manufacturer) || !string.IsNullOrWhiteSpace(Inventory.Brand) || !string.IsNullOrWhiteSpace(Inventory.Series);
base.OnInitialized();
}

protected async Task GetUniformat()
{
var Helper = new SearchHelper<Uniformat>(Formats);
Expand Down
5 changes: 3 additions & 2 deletions ExpertCities.Data/Entities/DebugBuildingEntities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ public static void CreateDebug()

private static void CreateInventory(ECContext c, Asset b1, List<Uniformat> Formats)
{
b1.Inventory = new List<Inventory> { new Inventory { Exterior = true, Uniformat = Formats.First(u => u.Code == "A202003"), Method = InventoryMethodEnum.Uniformat } };
b1.Inventory.Add(new Inventory { Exterior = true, Item = "Special item", Method = InventoryMethodEnum.Legacy });
b1.Inventory = new List<Inventory> { new Inventory { Exterior = true, Uniformat = Formats.First(u => u.Code == "A202003"), Method = InventoryMethodEnum.Uniformat, Manufacturer="GE" } };
b1.Inventory.Add(new Inventory { Exterior = true, Item = "Special item", Method = InventoryMethodEnum.Legacy ,Width = 12.5f });
b1.Inventory.Add(new Inventory { Exterior = true, Uniformat = Formats.First(u => u.Code == "A202002"), Method = InventoryMethodEnum.Uniformat });
}

static void BuildManyActions(Work w)
Expand Down
3 changes: 3 additions & 0 deletions ExpertCities.Data/Entities/Inspection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public class Inspection
public int Asset_ID { get; set; }
[ForeignKey(nameof(Asset_ID))]
public Asset Asset { get; set; }
public int? Inventory_ID { get; set; }
[ForeignKey(nameof(Inventory_ID))]
public Inventory? Inventory { get; set; }
public string? ExternalAffectation { get; set; }
public int? Workforce_ID { get; set; }
[ForeignKey(nameof(Workforce_ID))]
Expand Down

0 comments on commit 2dc632e

Please sign in to comment.