@@ -33,7 +33,27 @@ qx.Class.define("osparc.pricing.PlanDetails", {
3333 "backToPricingPlans" : "qx.event.type.Event"
3434 } ,
3535
36+ statics : {
37+ createTabPage : function ( label , icon ) {
38+ const tabPage = new qx . ui . tabview . Page ( ) . set ( {
39+ layout : new qx . ui . layout . VBox ( )
40+ } ) ;
41+ if ( label ) {
42+ tabPage . setLabel ( label ) ;
43+ }
44+ if ( icon ) {
45+ tabPage . setIcon ( icon ) ;
46+ }
47+ tabPage . getChildControl ( "button" ) . set ( {
48+ font : "text-13"
49+ } ) ;
50+ return tabPage ;
51+ }
52+ } ,
53+
3654 members : {
55+ __servicesPage : null ,
56+
3757 _createChildControlImpl : function ( id ) {
3858 let control ;
3959 let layout ;
@@ -68,7 +88,7 @@ qx.Class.define("osparc.pricing.PlanDetails", {
6888 break ;
6989 case "pricing-units" : {
7090 control = new osparc . pricing . UnitsList ( ) ;
71- const tabPage = this . __createTabPage ( this . tr ( "Pricing Units" ) , "@FontAwesome5Solid/paw/14" ) ;
91+ const tabPage = this . self ( ) . createTabPage ( this . tr ( "Pricing Units" ) , "@FontAwesome5Solid/paw/14" ) ;
7292 tabPage . add ( control , {
7393 flex : 1
7494 } ) ;
@@ -78,7 +98,7 @@ qx.Class.define("osparc.pricing.PlanDetails", {
7898 }
7999 case "service-list" : {
80100 control = new osparc . pricing . ServicesList ( ) ;
81- const tabPage = this . __createTabPage ( this . tr ( "Services" ) , "@FontAwesome5Solid/cogs/14" ) ;
101+ const tabPage = this . __servicesPage = this . self ( ) . createTabPage ( this . tr ( "Services" ) , "@FontAwesome5Solid/cogs/14" ) ;
82102 tabPage . add ( control , {
83103 flex : 1
84104 } ) ;
@@ -90,38 +110,27 @@ qx.Class.define("osparc.pricing.PlanDetails", {
90110 return control || this . base ( arguments , id ) ;
91111 } ,
92112
93- setCurrentPricingPlan : function ( pricingPlanModel ) {
94- if ( pricingPlanModel === null ) {
113+ setCurrentPricingPlan : function ( pricingPlan ) {
114+ if ( pricingPlan === null ) {
95115 return ;
96116 }
97117
98118 const pricingPlanListItem = this . getChildControl ( "pricing-plan-details" ) ;
99- pricingPlanModel . bind ( "model" , pricingPlanListItem , "model" ) ;
100- pricingPlanModel . bind ( "ppId" , pricingPlanListItem , "ppId" ) ;
101- pricingPlanModel . bind ( "ppKey" , pricingPlanListItem , "ppKey" ) ;
102- pricingPlanModel . bind ( "title" , pricingPlanListItem , "title" ) ;
103- pricingPlanModel . bind ( "description" , pricingPlanListItem , "description" ) ;
104- pricingPlanModel . bind ( "isActive" , pricingPlanListItem , "isActive" ) ;
119+ pricingPlan . bind ( "model" , pricingPlanListItem , "model" ) ;
120+ pricingPlan . bind ( "ppId" , pricingPlanListItem , "ppId" ) ;
121+ pricingPlan . bind ( "ppKey" , pricingPlanListItem , "ppKey" ) ;
122+ pricingPlan . bind ( "title" , pricingPlanListItem , "title" ) ;
123+ pricingPlan . bind ( "description" , pricingPlanListItem , "description" ) ;
124+ pricingPlan . bind ( "isActive" , pricingPlanListItem , "isActive" ) ;
105125
106126 // set PricingPlanId to the tab views
107- this . getChildControl ( "pricing-units" ) . setPricingPlanId ( pricingPlanModel . getModel ( ) ) ;
108- this . getChildControl ( "service-list" ) . setPricingPlanId ( pricingPlanModel . getModel ( ) ) ;
109- } ,
127+ this . getChildControl ( "pricing-units" ) . setPricingPlanId ( pricingPlan . getModel ( ) ) ;
128+ this . getChildControl ( "service-list" ) . setPricingPlanId ( pricingPlan . getModel ( ) ) ;
110129
111- __createTabPage : function ( label , icon ) {
112- const tabPage = new qx . ui . tabview . Page ( ) . set ( {
113- layout : new qx . ui . layout . VBox ( )
114- } ) ;
115- if ( label ) {
116- tabPage . setLabel ( label ) ;
117- }
118- if ( icon ) {
119- tabPage . setIcon ( icon ) ;
120- }
121- tabPage . getChildControl ( "button" ) . set ( {
122- font : "text-13"
130+ // show services only if it's a TIER pricing plan
131+ this . __servicesPage . getChildControl ( "button" ) . set ( {
132+ visibility : pricingPlan . getClassification ( ) === "TIER" ? "visible" : "excluded"
123133 } ) ;
124- return tabPage ;
125- }
134+ } ,
126135 }
127136} ) ;
0 commit comments