157 lines
5.1 KiB
Plaintext
157 lines
5.1 KiB
Plaintext
@namespace Oqtane.Modules.Admin.Sites
|
|
@inherits ModuleBase
|
|
@inject NavigationManager NavigationManager
|
|
@inject ISiteService SiteService
|
|
@inject IThemeService ThemeService
|
|
|
|
@if (themes == null)
|
|
{
|
|
<p><em>Loading...</em></p>
|
|
}
|
|
else
|
|
{
|
|
<table class="table table-borderless">
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Name: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@name" disabled />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Aliases: </label>
|
|
</td>
|
|
<td>
|
|
<textarea class="form-control" @bind="@urls" rows="3" disabled />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Logo: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@logo" disabled />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Default Theme: </label>
|
|
</td>
|
|
<td>
|
|
<select class="form-control" @bind="@themetype" disabled>
|
|
<option value=""><Select Theme></option>
|
|
@foreach (KeyValuePair<string, string> item in themes)
|
|
{
|
|
<option value="@item.Key">@item.Value</option>
|
|
}
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Default Layout: </label>
|
|
</td>
|
|
<td>
|
|
<select class="form-control" @bind="@layouttype" disabled>
|
|
<option value=""><Select Layout></option>
|
|
@foreach (KeyValuePair<string, string> panelayout in panelayouts)
|
|
{
|
|
<option value="@panelayout.Key">@panelayout.Value</option>
|
|
}
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Is Deleted? </label>
|
|
</td>
|
|
<td>
|
|
<select class="form-control" @bind="@isdeleted" disabled>
|
|
<option value="True">Yes</option>
|
|
<option value="False">No</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<button type="button" class="btn btn-success" @onclick="DeleteSite">Delete</button>
|
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
|
<br />
|
|
<br />
|
|
<AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon" DeletedBy="@deletedby" DeletedOn="@deletedon"></AuditInfo>
|
|
}
|
|
|
|
@code {
|
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
|
|
|
Dictionary<string, string> themes = new Dictionary<string, string>();
|
|
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
|
|
|
|
Alias Alias;
|
|
int siteid;
|
|
string name = "";
|
|
List<Alias> aliases;
|
|
string urls = "";
|
|
string logo = "";
|
|
string themetype;
|
|
string layouttype;
|
|
string createdby;
|
|
DateTime createdon;
|
|
string modifiedby;
|
|
DateTime modifiedon;
|
|
string deletedby;
|
|
DateTime? deletedon;
|
|
string isdeleted;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
try
|
|
{
|
|
themes = ThemeService.GetThemeTypes(PageState.Themes);
|
|
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
|
|
Alias = PageState.Aliases.Where(item => item.AliasId == Int32.Parse(PageState.QueryString["id"])).FirstOrDefault();
|
|
|
|
siteid = Alias.SiteId;
|
|
Site site = await SiteService.GetSiteAsync(siteid, Alias);
|
|
if (site != null)
|
|
{
|
|
name = site.Name;
|
|
aliases = PageState.Aliases.Where(item => item.SiteId == site.SiteId && item.TenantId == site.TenantId).ToList();
|
|
foreach (Alias alias in aliases)
|
|
{
|
|
urls += alias.Name + "\n";
|
|
}
|
|
logo = site.Logo;
|
|
themetype = site.DefaultThemeType;
|
|
layouttype = site.DefaultLayoutType;
|
|
|
|
createdby = site.CreatedBy;
|
|
createdon = site.CreatedOn;
|
|
modifiedby = site.ModifiedBy;
|
|
modifiedon = site.ModifiedOn;
|
|
deletedby = site.DeletedBy;
|
|
deletedon = site.DeletedOn;
|
|
isdeleted = site.IsDeleted.ToString();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
AddModuleMessage(ex.Message, MessageType.Error);
|
|
}
|
|
}
|
|
|
|
private async Task DeleteSite()
|
|
{
|
|
try
|
|
{
|
|
await SiteService.DeleteSiteAsync(siteid, Alias);
|
|
NavigationManager.NavigateTo(NavigateUrl());
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
AddModuleMessage(ex.Message, MessageType.Error);
|
|
}
|
|
}
|
|
}
|