improve UX for Extend license option
This commit is contained in:
		@ -99,47 +99,50 @@ else
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
	private List<ModuleDefinition> _moduleDefinitions;
 | 
			
		||||
	private List<Package> _packages;
 | 
			
		||||
	private List<string> _categories = new List<string>();
 | 
			
		||||
	private string _category = "Common";
 | 
			
		||||
    private List<ModuleDefinition> _moduleDefinitions;
 | 
			
		||||
    private List<Package> _packages;
 | 
			
		||||
    private List<string> _categories = new List<string>();
 | 
			
		||||
    private string _category = "Common";
 | 
			
		||||
 | 
			
		||||
	public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
 | 
			
		||||
    public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
 | 
			
		||||
 | 
			
		||||
	protected override async Task OnParametersSetAsync()
 | 
			
		||||
	{
 | 
			
		||||
		try
 | 
			
		||||
		{
 | 
			
		||||
			_moduleDefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
 | 
			
		||||
			_packages = await PackageService.GetPackagesAsync("module");
 | 
			
		||||
			_categories = _moduleDefinitions.SelectMany(m => m.Categories.Split(',')).Distinct().ToList();
 | 
			
		||||
		}
 | 
			
		||||
		catch (Exception ex)
 | 
			
		||||
		{
 | 
			
		||||
			if (_moduleDefinitions == null)
 | 
			
		||||
			{
 | 
			
		||||
				await logger.LogError(ex, "Error Loading Modules {Error}", ex.Message);
 | 
			
		||||
				AddModuleMessage(Localizer["Error.Module.Load"], MessageType.Error);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
    protected override async Task OnParametersSetAsync()
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            _moduleDefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
 | 
			
		||||
            _packages = await PackageService.GetPackagesAsync("module");
 | 
			
		||||
            _categories = _moduleDefinitions.SelectMany(m => m.Categories.Split(',')).Distinct().ToList();
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            if (_moduleDefinitions == null)
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Loading Modules {Error}", ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.Module.Load"], MessageType.Error);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	private string PurchaseLink(string packagename)
 | 
			
		||||
	{
 | 
			
		||||
		string link = "";
 | 
			
		||||
		if (!string.IsNullOrEmpty(packagename) && _packages != null)
 | 
			
		||||
		{
 | 
			
		||||
			var package = _packages.Where(item => item.PackageId == packagename).FirstOrDefault();
 | 
			
		||||
			if (package != null)
 | 
			
		||||
			{
 | 
			
		||||
				if (package.ExpiryDate != null && package.ExpiryDate.Value.Date != DateTime.MaxValue.Date)
 | 
			
		||||
				{
 | 
			
		||||
					link += "<span>" + package.ExpiryDate.Value.Date.ToString("MMM dd, yyyy") + "</span><br />";
 | 
			
		||||
					if (!string.IsNullOrEmpty(package.PaymentUrl))
 | 
			
		||||
					{
 | 
			
		||||
						link += "  <a class=\"btn btn-primary\" style=\"text-decoration: none !important\" href=\"" + package.PaymentUrl + "\" target=\"_new\">" + SharedLocalizer["Extend"] + "</a>";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
    private string PurchaseLink(string packagename)
 | 
			
		||||
    {
 | 
			
		||||
        string link = "";
 | 
			
		||||
        if (!string.IsNullOrEmpty(packagename) && _packages != null)
 | 
			
		||||
        {
 | 
			
		||||
            var package = _packages.Where(item => item.PackageId == packagename).FirstOrDefault();
 | 
			
		||||
            if (package != null)
 | 
			
		||||
            {
 | 
			
		||||
                if (package.ExpiryDate != null && package.ExpiryDate.Value.Date != DateTime.MaxValue.Date)
 | 
			
		||||
                {
 | 
			
		||||
                    if (string.IsNullOrEmpty(package.PaymentUrl))
 | 
			
		||||
                    {
 | 
			
		||||
                        link = "<span>" + package.ExpiryDate.Value.Date.ToString("MMM dd, yyyy") + "</span>";
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        link = "<a class=\"btn btn-primary\" style=\"text-decoration: none !important\" href=\"" + package.PaymentUrl + "\" target=\"_new\">" + package.ExpiryDate.Value.Date.ToString("MMM dd, yyyy") + "</a>";
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return link;
 | 
			
		||||
 | 
			
		||||
@ -100,11 +100,14 @@ else
 | 
			
		||||
            if (package != null)
 | 
			
		||||
            {
 | 
			
		||||
                if (package.ExpiryDate != null && package.ExpiryDate.Value.Date != DateTime.MaxValue.Date)
 | 
			
		||||
                {
 | 
			
		||||
                    link += "<span>" + package.ExpiryDate.Value.Date.ToString("MMM dd, yyyy") + "</span><br />";
 | 
			
		||||
                    if (!string.IsNullOrEmpty(package.PaymentUrl))
 | 
			
		||||
                { 
 | 
			
		||||
                    if (string.IsNullOrEmpty(package.PaymentUrl))
 | 
			
		||||
                    {
 | 
			
		||||
                        link += "  <a class=\"btn btn-primary\" style=\"text-decoration: none !important\" href=\"" + package.PaymentUrl + "\" target=\"_new\">" + SharedLocalizer["Extend"] + "</a>";
 | 
			
		||||
                        link = "<span>" + package.ExpiryDate.Value.Date.ToString("MMM dd, yyyy") + "</span>";
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        link = "<a class=\"btn btn-primary\" style=\"text-decoration: none !important\" href=\"" + package.PaymentUrl + "\" target=\"_new\">" + package.ExpiryDate.Value.Date.ToString("MMM dd, yyyy") + "</a>";
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user