@using System.Globalization; @using System.Linq @using Leica.Spider.BusinessCenter.Core.GlobalUtils @using Leica.Spider.BusinessCenter.Core.Model @using Leica.Spider.BusinessCenter.Frontend.FeatureManager; @using Leica.Spider.BusinessCenter.Frontend.Models; @using Leica.Spider.BusinessCenter.Frontend.Utils @using Leica.Spider.BusinessCenter.WCFInterfaces @using Microsoft.AspNetCore.Html @using QuotaCode = Leica.Spider.BusinessCenter.WCFInterfaces.QuotaCode @using ServicePackageRestrictionType = Leica.Spider.BusinessCenter.WCFInterfaces.ServicePackageRestrictionType @using SubscriptionStatus = Leica.Spider.BusinessCenter.WCFInterfaces.SubscriptionStatus @model Leica.Spider.BusinessCenter.Frontend.Areas.User.Models.ShowSubscriptionsViewModel @{ var currentPrivilege = Session.UserPrivileges.ToCoreModel(); } @for (var i = 0; i < Model.Subscriptions.Count; i++) {
@Model.Subscriptions[i].SubscriptionId
@{ var sub = Model.Subscriptions[i]; if (sub.CanBeRenewed && Model.CanRenewSubscriptions) { @Lang.Html("IDS_SUBSCRIPTIONS_RENEW") } else if (sub.MarkForAutoRenewal) {
@Lang.Html("IDS_SUBSCRIPTIONS_RENEW_CONFIRMATION")
} if (Model.Subscriptions[i].IsEnterprise) { @Lang.Html("IDS_USER_MANAGE_ES_CONSUMERS_LABEL") } }
@if (!string.IsNullOrEmpty(Model.Subscriptions[i].LeicaSensorSerialNumber)) {
@Model.Subscriptions[i].LeicaSensorSerialNumber
}
@if (!currentPrivilege.IsDealerLevel()) {
}
@{ IHtmlContent labelText = null; string labelClass = null; switch (Model.Subscriptions[i].Status) { case SubscriptionStatus.Active: labelText = Lang.Html("IDS_SUBSCRIPTION_STATUS_ACTIVE"); break; case SubscriptionStatus.Pending: if (Model.Subscriptions[i].ServicePackageId == Model.NewlySubscribedPackageId) { labelText = Lang.Html("IDS_USER_SUBSCRPTIONS_VIEW_AWAITING_ACTIVATION_MESSAGE"); labelClass = "text-warning"; } else { labelText = Lang.Html("IDS_SUBSCRIPTION_STATUS_PENDING"); } break; case SubscriptionStatus.Inactive: labelText = Lang.Html("IDS_SUBSCRIPTION_STATUS_EXCEEDED"); labelClass = "stateIndicator text-danger"; break; case SubscriptionStatus.ActiveAndExpired: labelText = Lang.Html("IDS_SUBSCRIPTION_STATUS_EXPIRED"); labelClass = "stateIndicator text-danger"; break; } } @if (Model.Subscriptions[i].IsXposExceeded) { (@Lang.Html("IDS_SUBSCRIPTION_STATUS_RINEXEXCEEDED")) }

@Lang.Html("IDS_PACKAGES_VIEW_DF_LIFETIME_LABEL")

@if (Model.Subscriptions[i].Status != SubscriptionStatus.Pending) { var totalDays = Model.Subscriptions[i].RenewalDate != null && Model.Subscriptions[i].StartDate != null ? (Convert.ToDateTime(Model.Subscriptions[i].RenewalDate).Date - Convert.ToDateTime(Model.Subscriptions[i].StartDate)).TotalDays : 0; var remainingDays = Model.Subscriptions[i].RenewalDate != null ? (Convert.ToDateTime(Model.Subscriptions[i].RenewalDate).Date - DateTime.Today.Date).TotalDays : 0; var renewalDays = Model.Subscriptions[i].RenewalDate != null && Model.Subscriptions[i].ExpiryDate != null ? (Convert.ToDateTime(Model.Subscriptions[i].ExpiryDate).Date - Convert.ToDateTime(Model.Subscriptions[i].RenewalDate).Date).TotalDays : 0; var daysPercentage = totalDays > 0 ? remainingDays / totalDays : 0; var daysToExceed = Model.Subscriptions[i].ExpiryDate != null ? (Convert.ToDateTime(Model.Subscriptions[i].ExpiryDate) - DateTime.Today).TotalDays : 0;
@Lang.Html("IDS_SUBSCRIPTIONS_VIEW_DF_START_DATE_LABEL")
@if (remainingDays < 0 && renewalDays >= 0) { if (Model.Subscriptions[i].Status == SubscriptionStatus.ActiveAndExpired) { @Lang.Html("IDS_SUBSCRIPTIONS_PROGRESSBAR_EXPIRED_MESSAGE") } else { @(daysToExceed >= 0 ? Lang.Html("IDS_SUBSCRIPTIONS_PROGRESSBAR_GRACE_PERIOD") : Lang.Html("IDS_SUBSCRIPTIONS_PROGRESSBAR_EXPIRED_MESSAGE")) } } else { if (Model.Subscriptions[i].Status == SubscriptionStatus.ActiveAndExpired) { @Lang.Html("IDS_SUBSCRIPTIONS_PROGRESSBAR_EXPIRED_MESSAGE") } else { @Lang.Html("IDS_SUBSCRIPTIONS_PROGRESSBAR_CONSUMING") } }
@Lang.Html("IDS_SUBSCRIPTIONS_MOBILE_VIEW_DF_RENEWAL_DATE_LABEL")
@if (remainingDays < 0 && renewalDays >= 0) { if (Model.Subscriptions[i].Status == SubscriptionStatus.ActiveAndExpired) {
} else {
} } else { if (Model.Subscriptions[i].Status == SubscriptionStatus.ActiveAndExpired) {
} else {
1 ? 1.0 : daysPercentage)">
} }
@($"{Convert.ToDateTime(Model.Subscriptions[i].StartDate):yyyy-MM-dd}")
@if (Model.Subscriptions[i].Status != SubscriptionStatus.ActiveAndExpired) { if (remainingDays < 0 && renewalDays >= 0) { @Lang.Html("IDS_SUBSCRIPTIONS_PROGRESSBAR_RENEWAL_MESSAGE", (Convert.ToDateTime(Model.Subscriptions[i].ExpiryDate) - DateTime.Today).TotalDays) } else { @Lang.Html("IDS_SUBSCRIPTIONS_PROGRESSBAR_DAYS_REMAINING", remainingDays) } }
@($"{Model.Subscriptions[i].RenewalDate:yyyy-MM-dd}")
}
@if (Model.Subscriptions[i].SubscriptionConsumptionLimit > 0) {

@Lang.Html(Model.Subscriptions[i].QuotaCode == QuotaCode.ConnectionTime ? "IDS_SUBSCRIPTIONS_VIEW_CONSUMPTION_RTK_CHART" : "IDS_SUBSCRIPTIONS_VIEW_CONSUMPTION_XPOS_RINEX_CHART")

if (Model.Subscriptions[i].Status != SubscriptionStatus.Pending) { var usagePercentage = 1 - (double) (Model.Subscriptions[i].SubscriptionConsumptionLimit - Model.Subscriptions[i].Remaining) / Model.Subscriptions[i].SubscriptionConsumptionLimit; if (usagePercentage <= 0) { usagePercentage = 1; }
1 ? 1.0 : usagePercentage)">
@(Model.Subscriptions[i].QuotaCode == QuotaCode.ConnectionTime ? Lang.FormatDuration("IDS_UNIT_HOURS", 0) : Lang.FormatEpochs(0))
@(Model.Subscriptions[i].Remaining < 1 ? (object)Lang.Html(Model.Subscriptions[i].QuotaCode == QuotaCode.ConnectionTime ? "IDS_SUBSCRIPTIONS_VIEW_ALL_HOURS_CONSUMED" : "IDS_SUBSCRIPTIONS_VIEW_ALL_EPOCHS_CONSUMED") : string.Format("{0} {1}", Model.Subscriptions[i].QuotaCode == QuotaCode.ConnectionTime ? Lang.FormatDurationToHoursMinutes(Model.Subscriptions[i].Remaining) : Lang.FormatEpochs(Model.Subscriptions[i].Remaining), Lang.Raw("IDS_SUBSCRIPTIONS_MOBILE_VIEW_DF_REMAINING_LABEL")))
@(Model.Subscriptions[i].QuotaCode == QuotaCode.ConnectionTime ? Lang.FormatDuration("IDS_SUBSCRIPTIONS_MOBILE_UNIT_CONSUMED_REMAINING_HRS", Model.Subscriptions[i].SubscriptionConsumptionLimit) : Lang.FormatEpochs(Model.Subscriptions[i].SubscriptionConsumptionLimit))
} }
@if (Model.Subscriptions[i].InstallationQuotaHistory!= null && Model.Subscriptions[i].InstallationQuotaHistory.Count() > 0) { } @if (Model.Subscriptions[i].RestrictionType == ServicePackageRestrictionType.Region) {

@Lang.Html("IDS_WORKING_AREA")

}
}