152 lines
5.5 KiB
Plaintext
152 lines
5.5 KiB
Plaintext
@page "/user/serviceproviderold/{id}"
|
|
@using AyCode.Core
|
|
@using AyCode.Services.Loggers
|
|
@using TIAM.Entities.ServiceProviders
|
|
@using TIAM.Resources
|
|
@using TIAM.Services
|
|
@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>@CompanyName</h1>
|
|
<h2 style="font-size:small">Manage your service provider details</h2>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<div class="w-100 ch-220">
|
|
<CompanyByIdDetailGrid @ref="_gridCompany"
|
|
Context="myContext"
|
|
ContextIds="@(CompanyId?.Cast<object>().ToArray())"
|
|
Logger="_logger"
|
|
SignalRClient="AdminSignalRClient"
|
|
CustomizeElement="Grid_CustomizeElement"
|
|
CustomizeEditModel="Grid_CustomizeEditModel"
|
|
EditMode="GridEditMode.EditForm"
|
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
|
ShowFilterRow="true">
|
|
|
|
<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" />
|
|
</DetailRowTemplate> *@
|
|
<DetailRowTemplate>
|
|
<DxTabs>
|
|
<DxTabPage Text="Profile">
|
|
<ProfileGridComponent ParentData="((Company)myContext.DataItem)" />
|
|
</DxTabPage>
|
|
<DxTabPage Text="Products">
|
|
<ProductDetailGridComponent GetAllTag="SignalRTags.GetProductsByOwnerId" ContextId="((Company)myContext.DataItem).Id" ParentData="((Company)myContext.DataItem)" />
|
|
</DxTabPage>
|
|
<DxTabPage Text="Address">
|
|
<AddressDetailGridComponent ParentData="((Company)myContext.DataItem).Profile" />
|
|
</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>
|
|
</CompanyByIdDetailGrid>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
@code {
|
|
[Parameter]
|
|
public string Id { get; set; }
|
|
|
|
private Guid[] CompanyId = new Guid[1];
|
|
|
|
private CompanyByIdDetailGrid _gridCompany;
|
|
|
|
public string ProfileUrl => $"/images/serviceprovider/{Id}.png";
|
|
|
|
private LoggerClient<ServiceProvider> _logger;
|
|
|
|
private string CompanyName;
|
|
|
|
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[0] = Guid.Parse(Id);
|
|
var result = serviceProviderDataService.GetServiceProviderByIdAsync(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();
|
|
}
|
|
}
|
|
}
|