161 lines
6.8 KiB
Plaintext
161 lines
6.8 KiB
Plaintext
@page "/user/serviceprovider/{id}"
|
|
@using AyCode.Core
|
|
@using AyCode.Services.Loggers
|
|
@using TIAM.Entities.ServiceProviders
|
|
@using TIAM.Resources
|
|
@using TIAMSharedUI.Pages.User.SysAdmins
|
|
@using TIAMSharedUI.Shared
|
|
@using TIAMSharedUI.Shared.Components.Grids
|
|
@using TIAMWebApp.Shared.Application.Interfaces
|
|
@using TIAMWebApp.Shared.Application.Services
|
|
@using TIAMWebApp.Shared.Application.Utility
|
|
@layout AdminLayout
|
|
@inject NavigationManager navigationManager
|
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
|
@inject IStringLocalizer<TIAMResources> localizer
|
|
@inject IServiceProviderDataService serviceProviderDataService
|
|
@inject IUserDataService userDataService
|
|
@inject ISessionService sessionService
|
|
@inject AdminSignalRClient AdminSignalRClient;
|
|
<PageTitle>Admin - Companies</PageTitle>
|
|
|
|
<div class="text-center m-5">
|
|
<h1>Company: @Id</h1>
|
|
<h2 style="font-size:small">Manage your service provider details</h2>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<div class="w-100 ch-220">
|
|
<CompanyGrid @ref="_gridCompany"
|
|
ContextId="@CompanyId"
|
|
Logger="_logger"
|
|
SignalRClient="AdminSignalRClient"
|
|
|
|
AutoCollapseDetailRow="false"
|
|
KeyboardNavigationEnabled="true"
|
|
CustomizeElement="Grid_CustomizeElement"
|
|
CustomizeEditModel="Grid_CustomizeEditModel"
|
|
EditMode="GridEditMode.EditForm"
|
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
|
ShowFilterRow="true"
|
|
KeyFieldName="Id">
|
|
|
|
<Columns>
|
|
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
|
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
|
<DxGridDataColumn FieldName="Name" />
|
|
|
|
<DxGridDataColumn FieldName="AffiliateId" DisplayFormat="N" />
|
|
<DxGridDataColumn FieldName="CommissionPercent" />
|
|
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="140" />
|
|
<DxGridDataColumn FieldName="Modified" DisplayFormat="g" Width="140" />
|
|
@* <DxGridDataColumn FieldName="ContactEmail">
|
|
|
|
</DxGridDataColumn> *@
|
|
|
|
</Columns>
|
|
@* <DetailRowTemplate>
|
|
<CompaniesNestedUserProductMapping CurrentCompany="(TIAM.Entities.ServiceProviders.Company)context.DataItem" KeyboardNavigationEnabled="true" />
|
|
</DetailRowTemplate> *@
|
|
<DetailRowTemplate>
|
|
<DxTabs>
|
|
<DxTabPage Text="Profile">
|
|
<ProfileGridComponent ParentData="((Company)context.DataItem)" KeyboardNavigationEnabled="true" />
|
|
</DxTabPage>
|
|
<DxTabPage Text="Products">
|
|
<ProductDetailGridComponent ContextId="((Company)context.DataItem).Id" KeyboardNavigationEnabled="true" />
|
|
</DxTabPage>
|
|
<DxTabPage Text="Address">
|
|
<AddressDetailGridComponent ParentData="((Company)context.DataItem).Profile" KeyboardNavigationEnabled="true" />
|
|
</DxTabPage>
|
|
</DxTabs>
|
|
</DetailRowTemplate>
|
|
<EditFormTemplate Context="EditFormContext">
|
|
@{
|
|
var transfer2 = (Company)EditFormContext.EditModel;
|
|
}
|
|
<DxFormLayout CssClass="w-100">
|
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.LastName) ColSpanMd="6" ColSpanLg="6" ColSpanSm="12">
|
|
@EditFormContext.GetEditor("Name")
|
|
</DxFormLayoutItem>
|
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.LastName) ColSpanMd="6" ColSpanLg="6" ColSpanSm="12">
|
|
@EditFormContext.GetEditor("CommissionPercent")
|
|
</DxFormLayoutItem>
|
|
</DxFormLayout>
|
|
</EditFormTemplate>
|
|
</CompanyGrid>
|
|
|
|
<DxTabs>
|
|
@* <DxTabPage Text="Profile">
|
|
<ProfileComponent></ProfileComponent>
|
|
</DxTabPage> *@
|
|
@* <DxTabPage Text="Profile 2">
|
|
<ProfileGridComponent ProfileId="((Company)context.DataItem).ProfileId" KeyboardNavigationEnabled="true" />
|
|
</DxTabPage> *@
|
|
<DxTabPage Text="Products">
|
|
<ProductDetailGridComponent ContextId="@CompanyId" KeyboardNavigationEnabled="true" />
|
|
</DxTabPage>
|
|
@* <DxTabPage Text="Address">
|
|
<AddressDetailGridComponent ParentData="((Company)context.DataItem).Profile" KeyboardNavigationEnabled="true" />
|
|
</DxTabPage> *@
|
|
</DxTabs>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
@code {
|
|
[Parameter]
|
|
public string Id { get; set; }
|
|
|
|
private Guid CompanyId;
|
|
|
|
private CompanyGrid _gridCompany;
|
|
|
|
public string ProfileUrl => $"/images/serviceprovider/{Id}.png";
|
|
|
|
private LoggerClient<ServiceProvider> _logger;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
base.OnInitialized();
|
|
_logger = new LoggerClient<ServiceProvider>(LogWriters.ToArray());
|
|
}
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
if (string.IsNullOrEmpty(Id))
|
|
{
|
|
navigationManager.NavigateTo("/user/properties");
|
|
}
|
|
else
|
|
{
|
|
CompanyId = Guid.Parse(Id);
|
|
}
|
|
base.OnParametersSet();
|
|
}
|
|
|
|
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
|
|
{
|
|
//TODO mark non active partners
|
|
|
|
}
|
|
|
|
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
|
{
|
|
if (!e.IsNew)
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
var companyEditModel = (Company)e.EditModel; //TODO not valid cast
|
|
companyEditModel.Id = Guid.NewGuid();
|
|
companyEditModel.AffiliateId = Guid.NewGuid();
|
|
companyEditModel.Name = "Company name";
|
|
companyEditModel.OwnerId = Guid.Empty;
|
|
companyEditModel.ProfileId = Guid.NewGuid();
|
|
}
|
|
}
|
|
}
|