150 lines
5.6 KiB
Plaintext
150 lines
5.6 KiB
Plaintext
@page "/user/properties"
|
|
@using BlazorAnimation
|
|
@using TIAM.Entities.ServiceProviders
|
|
@using TIAM.Resources
|
|
@using TIAM.Services
|
|
@using TIAMSharedUI.Shared
|
|
@using TIAMWebApp.Shared.Application.Interfaces
|
|
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
|
@using TIAMWebApp.Shared.Application.Utility
|
|
@using AyCode.Services.Loggers
|
|
@using TIAMWebApp.Shared.Application.Services
|
|
@using AyCode.Core.Helpers
|
|
@using TIAMSharedUI.Shared.Components.Grids
|
|
@layout AdminLayout
|
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
|
@inject IStringLocalizer<TIAMResources> localizer
|
|
@inject ISessionService SessionService
|
|
@inject IServiceProviderDataService ServiceProviderDataService
|
|
@inject AdminSignalRClient AdminSignalRClient;
|
|
<PageTitle>User permissions</PageTitle>
|
|
|
|
<div class="text-center m-5">
|
|
<h1>My companies</h1>
|
|
<h2 style="font-size:small">Manage your companies here!</h2>
|
|
</div>
|
|
|
|
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class=" col-12">
|
|
<Animation Effect="@Effect.FadeIn" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
|
<div class="card">
|
|
<div class="d-flex flex-column mb-4 pb-2">
|
|
<div class="align-self-end pl-2 pb-2">
|
|
<DxButton Text="Column Chooser"
|
|
RenderStyle="ButtonRenderStyle.Secondary"
|
|
IconCssClass="btn-column-chooser"
|
|
Click="ColumnChooserButton_Click" />
|
|
</div>
|
|
|
|
<CompanyGrid @ref="_gridCompany"
|
|
Logger="_logger"
|
|
SignalRClient="AdminSignalRClient"
|
|
ContextIds="_contextIds.Cast<object>().ToArray()"
|
|
GetAllMessageTag="SignalRTags.GetCompaniesByContextId"
|
|
PageSize="12"
|
|
ValidationEnabled="false"
|
|
DetailRowDisplayMode="GridDetailRowDisplayMode.Always"
|
|
CustomizeEditModel="Grid_CustomizeEditModel"
|
|
EditMode="GridEditMode.EditRow">
|
|
<Columns>
|
|
<DxGridCommandColumn Width="160px" />
|
|
<DxGridDataColumn FieldName="Id" Visible="false" MinWidth="130" />
|
|
<DxGridDataColumn FieldName="Name" MinWidth="80" />
|
|
<DxGridDataColumn FieldName="AffiliateId" MinWidth="80" />
|
|
<DxGridDataColumn FieldName="Id" Width="130">
|
|
<CellDisplayTemplate>
|
|
<a class="btn btn-primary" href="user/serviceprovider/@context.Value.ToString()">Manage</a>
|
|
</CellDisplayTemplate>
|
|
</DxGridDataColumn>
|
|
<DxGridDataColumn Caption="Address" FieldName="Profile.Address.AddressText" Width="280" />
|
|
|
|
</Columns>
|
|
<DetailRowTemplate>
|
|
@{
|
|
<p>Address: @(((Company)context.DataItem).Profile.Address.AddressText)</p>
|
|
}
|
|
</DetailRowTemplate>
|
|
</CompanyGrid>
|
|
</div>
|
|
|
|
</div>
|
|
</Animation>
|
|
</div>
|
|
|
|
<div class=" col-12 col-xl-6">
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
@code {
|
|
private LoggerClient<MyServiceProviders> _logger = null!;
|
|
|
|
private CompanyGrid _gridCompany = null!;
|
|
|
|
public ServiceProviderWizardModel MyModel = new ServiceProviderWizardModel();
|
|
|
|
bool EulaAccepted { get; set; }
|
|
bool EulaVisible { get; set; }
|
|
|
|
private Guid[] _contextIds = new Guid[0];
|
|
|
|
void CancelCreateClick()
|
|
{
|
|
EulaVisible = false;
|
|
}
|
|
void EulaPopupClosed()
|
|
{
|
|
EulaAccepted = false;
|
|
|
|
}
|
|
void EulaPopupClosing(PopupClosingEventArgs args)
|
|
{
|
|
MyModel = new ServiceProviderWizardModel();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------------
|
|
|
|
|
|
public async Task SubmitForm(object result)
|
|
{
|
|
//await WizardProcessor.ProcessWizardAsync(Result.GetType(), Result);
|
|
_logger.Info($"Submitted nested form: {result.GetType().FullName}");
|
|
}
|
|
|
|
|
|
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
|
{
|
|
if (e.IsNew)
|
|
{
|
|
var newEmployee = (Company)e.EditModel;
|
|
newEmployee.Name = "Add a company name";
|
|
newEmployee.OwnerId = SessionService.User!.UserId;
|
|
newEmployee.AffiliateId = Guid.NewGuid();
|
|
}
|
|
}
|
|
|
|
protected override Task OnInitializedAsync()
|
|
{
|
|
_logger = new LoggerClient<MyServiceProviders>(LogWriters.ToArray());
|
|
|
|
var myId = SessionService.User!.UserId;
|
|
_contextIds = new Guid[1];
|
|
_contextIds[0] = myId;
|
|
// ServiceProviderDataService.GetPropertiesByOwnerIdAsync(myId, companyPropertiesByOwner =>
|
|
// {
|
|
// _logger.DetailConditional($"companyPropertiesByOwner count: {companyPropertiesByOwner?.Count.ToString() ?? "NULL"}");
|
|
// }).Forget();
|
|
|
|
return base.OnInitializedAsync();
|
|
}
|
|
|
|
void ColumnChooserButton_Click()
|
|
{
|
|
_gridCompany.ShowColumnChooser();
|
|
}
|
|
}
|