139 lines
3.7 KiB
Plaintext
139 lines
3.7 KiB
Plaintext
@using MP.AppAuth.Models
|
|
@using MP.Land.Data
|
|
@using Microsoft.Extensions.Configuration
|
|
|
|
@inject IConfiguration Configuration
|
|
@inject AppAuthService DataService
|
|
@inject LicenseService LicServ
|
|
|
|
<div class="card">
|
|
<div class="card-header">
|
|
@if (authOk())
|
|
{
|
|
<a target="_blank" href="@(fullUrl(CurrItem.AppUrl))" class="btn btn-outline-info btn-block" title="Apri">
|
|
<h3 class="mb-0">@CurrItem.AppName <i class="fas fa-angle-double-right"></i></h3>
|
|
</a>
|
|
}
|
|
else
|
|
{
|
|
<del>
|
|
<h3 class="mb-0 text-secondary">@CurrItem.AppName</h3>
|
|
</del>
|
|
}
|
|
</div>
|
|
<div class="card-body pt-2 pb-0">
|
|
<div class="row">
|
|
@if (authOk())
|
|
{
|
|
<div class="col-3 text-info">
|
|
<i class="@(traduci($"{CurrItem.AppName}-ICON"))"></i>
|
|
</div>
|
|
<div class="col-9" style="overflow-y: auto; height: 7.5em;">
|
|
<b>@(traduci($"{CurrItem.AppName}-TITLE"))</b>
|
|
<ul class="mb-0 small">
|
|
@(traduci($"{CurrItem.AppName}-LIST"))
|
|
</ul>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<div class="col-3 text-secondary">
|
|
<i class="@(traduci($"{CurrItem.AppName}-ICON"))"></i>
|
|
</div>
|
|
<div class="col-9 text-secondary" style="overflow-y: auto; height: 8em;">
|
|
<b>@(traduci($"{CurrItem.AppName}-TITLE"))</b>
|
|
<ul class="mb-0 small">
|
|
@(traduci($"{CurrItem.AppName}-LIST"))
|
|
</ul>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
<div class="card-footer text-danger py-1">
|
|
@if (authOk())
|
|
{
|
|
<span class="text-success">Programma Attivato</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="text-danger">Licenza non attivata!</span>
|
|
}
|
|
</div>
|
|
</div>
|
|
@code {
|
|
|
|
[Parameter]
|
|
public UpdMan CurrItem { get; set; }
|
|
|
|
protected List<AnagKeyValueModel> AKVList
|
|
{
|
|
get
|
|
{
|
|
return LicServ.AKVList;
|
|
}
|
|
set
|
|
{
|
|
LicServ.AKVList = value;
|
|
}
|
|
}
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
// check init AKV
|
|
if (AKVList == null || AKVList.Count == 0)
|
|
{
|
|
AKVList = await DataService.AnagKeyValList();
|
|
LicServ.InitAkv();
|
|
}
|
|
//return base.OnInitializedAsync();
|
|
}
|
|
|
|
|
|
protected string getAKVString(string nomeVar)
|
|
{
|
|
string answ = "";
|
|
if (AKVList != null)
|
|
{
|
|
var currRec = AKVList.FirstOrDefault(x => x.NomeVar == nomeVar);
|
|
if (currRec != null)
|
|
{
|
|
answ = currRec.ValString;
|
|
}
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
protected AnagKeyValueModel getAKVRec(string nomeVar)
|
|
{
|
|
AnagKeyValueModel answ = new AnagKeyValueModel();
|
|
if (AKVList != null)
|
|
{
|
|
answ = AKVList.FirstOrDefault(x => x.NomeVar == nomeVar);
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
protected bool authOk()
|
|
{
|
|
bool allOk = !string.IsNullOrEmpty(CurrItem.LicenseKey);
|
|
if (allOk)
|
|
{
|
|
allOk = LicServ.checkLicenseActive(CurrItem.LicenseKey);
|
|
}
|
|
return allOk;
|
|
}
|
|
|
|
protected string fullUrl(string relUrl)
|
|
{
|
|
return $"{Configuration["BaseUrl"]}{relUrl}";
|
|
}
|
|
|
|
protected MarkupString traduci(string lemma)
|
|
{
|
|
MarkupString answ;
|
|
string rawHtml = DataService.Traduci(lemma, "IT");
|
|
answ = new MarkupString(rawHtml);
|
|
return answ;
|
|
}
|
|
} |