diff --git a/src/app/components/mno-local-products/mno-local-product.coffee b/src/app/components/mno-local-products/mno-local-product.coffee index e71a4190..6b8ade24 100644 --- a/src/app/components/mno-local-products/mno-local-product.coffee +++ b/src/app/components/mno-local-products/mno-local-product.coffee @@ -11,6 +11,7 @@ angular.module 'mnoEnterpriseAngular' vm.isProvisioningEnabled = !vm.isPublic && MnoeConfig.isProvisioningEnabled() vm.canProvision = false + vm.buttonDisabledTooltip = '' vm.isLoading = true @@ -23,6 +24,15 @@ angular.module 'mnoEnterpriseAngular' vm.hideNoPricingFound = (plan) -> vm.isPublic || vm.planAvailableForCurrency(plan) || !vm.pricedPlan(plan) + vm.buttonDisabled = () -> + !vm.canProvision || !vm.orderPossible + + vm.updateButtonDisabledTooltip = () -> + if !vm.canProvision + 'mno_enterprise.templates.components.app_install_btn.insufficient_privilege' + else if !vm.orderPossible + 'mno_enterprise.templates.dashboard.marketplace.show.no_pricing_plans_found_tooltip' + # Retrieve the products vm.initialize = -> MnoeMarketplace.getApps().then( @@ -42,6 +52,13 @@ angular.module 'mnoEnterpriseAngular' productId = $stateParams.productId vm.product = _.findWhere(vm.products, { nid: productId }) vm.product ||= _.findWhere(vm.products, { id: productId }) + # Is currency selection enabled + currencySelection = MnoeConfig.isCurrencySelectionEnabled() + # Are there any available plans + availablePlans = ProvisioningHelper.plansForCurrency(vm.product.pricing_plans, vm.orgCurrency) + + vm.orderPossible = !_.isEmpty(availablePlans) || (vm.product.pricing_plans?[0].default?[0] && currencySelection) + vm.buttonDisabledTooltip = vm.updateButtonDisabledTooltip() $state.go(vm.parentState) unless vm.product? ).finally(-> vm.isLoading = false) diff --git a/src/app/components/mno-local-products/mno-local-product.html b/src/app/components/mno-local-products/mno-local-product.html index 405e9f47..2d501a52 100644 --- a/src/app/components/mno-local-products/mno-local-product.html +++ b/src/app/components/mno-local-products/mno-local-product.html @@ -34,11 +34,11 @@

{{vm.product.name}}

- + mno_enterprise.templates.dashboard.marketplace.show.provision -
+
mno_enterprise.templates.dashboard.marketplace.show.provision
@@ -68,7 +68,7 @@

{{vm.product.name}}

{{ 'mno_enterprise.templates.dashboard.marketplace.show.price' | translate }}

-
    +
    • {{ 'mno_enterprise.templates.dashboard.marketplace.show.free_trial_duration' | translate }}: {{vm.product.free_trial_duration}} {{vm.product.free_trial_unit}}
    • @@ -85,6 +85,7 @@

      {{ 'mno_enterprise.templates.dashboard.marketplace.show.price' | translate } {{'mno_enterprise.templates.dashboard.marketplace.show.pricing.payg' | translate}}

    +
    {{'mno_enterprise.templates.dashboard.marketplace.show.no_pricing_plans_found' | translate}}