From 49de4f2ff874718b41a40f421081a5db7ce89576 Mon Sep 17 00:00:00 2001 From: RidaAhmad Date: Thu, 19 Jul 2018 19:24:48 +0500 Subject: [PATCH 1/2] [MNOE-1263] Updated local products provision button on the basis of currency --- .../mno-local-products/mno-local-product.coffee | 17 +++++++++++++++++ .../mno-local-products/mno-local-product.html | 7 ++++--- 2 files changed, 21 insertions(+), 3 deletions(-) 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..f84bdf65 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}}
From 87621f97ed5b2ac61aa9e9d350ff30fd4e513b8e Mon Sep 17 00:00:00 2001 From: RidaAhmad Date: Tue, 24 Jul 2018 18:43:45 +0500 Subject: [PATCH 2/2] [MNOE-1263] Updated safe navigation operator --- src/app/components/mno-local-products/mno-local-product.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 f84bdf65..6b8ade24 100644 --- a/src/app/components/mno-local-products/mno-local-product.coffee +++ b/src/app/components/mno-local-products/mno-local-product.coffee @@ -57,7 +57,7 @@ angular.module 'mnoEnterpriseAngular' # 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.orderPossible = !_.isEmpty(availablePlans) || (vm.product.pricing_plans?[0].default?[0] && currencySelection) vm.buttonDisabledTooltip = vm.updateButtonDisabledTooltip() $state.go(vm.parentState) unless vm.product?