@@ -70,8 +70,8 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
7070 __populateLayout : function ( ) {
7171 this . _removeAll ( ) ;
7272
73- const licensedItemBundleData = this . getAnatomicalModelsData ( ) ;
74- if ( licensedItemBundleData && licensedItemBundleData [ "licensedResources" ] . length ) {
73+ const licensedItem = this . getAnatomicalModelsData ( ) ;
74+ if ( licensedItem && licensedItem . getLicensedResources ( ) . length ) {
7575 this . __addModelsInfo ( ) ;
7676 this . __addSeatsSection ( ) ;
7777 this . __addPricing ( ) ;
@@ -99,9 +99,9 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
9999
100100 this . __populateModelsInfo ( ) ;
101101
102- const licensedItemBundleData = this . getAnatomicalModelsData ( ) ;
103- const modelsInfo = licensedItemBundleData [ "licensedResources" ] ;
104- if ( modelsInfo . length > 1 ) {
102+ const licensedItem = this . getAnatomicalModelsData ( ) ;
103+ const licensedResources = licensedItem . getLicensedResources ( ) ;
104+ if ( licensedResources . length > 1 ) {
105105 const modelSelectionLayout = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 4 ) ) ;
106106 const titleLabel = new qx . ui . basic . Label ( this . tr ( "This bundle contains:" ) ) ;
107107 modelSelectionLayout . add ( titleLabel ) ;
@@ -121,15 +121,15 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
121121 } ) ;
122122 }
123123
124- modelsInfo . forEach ( ( modelInfo , idx ) => {
124+ licensedResources . forEach ( ( licensedResource , idx ) => {
125125 const modelLayout = new qx . ui . container . Composite ( new qx . ui . layout . HBox ( 4 ) ) . set ( {
126126 allowGrowX : false ,
127127 } ) ;
128- const miniThumbnail = this . self ( ) . createThumbnail ( modelInfo [ "source" ] [ "thumbnail" ] , 32 ) ;
128+ const miniThumbnail = this . self ( ) . createThumbnail ( licensedResource [ "thumbnail" ] , 32 ) ;
129129 osparc . utils . Utils . addBorder ( miniThumbnail ) ;
130130 modelLayout . add ( miniThumbnail ) ;
131131 const title = new qx . ui . basic . Label ( ) . set ( {
132- value : osparc . store . LicensedItems . licensedResourceTitle ( modelInfo ) ,
132+ value : osparc . data . model . LicensedItem . licensedResourceTitle ( licensedResource ) ,
133133 alignY : "middle"
134134 } ) ;
135135 modelLayout . add ( title ) ;
@@ -148,17 +148,15 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
148148 __populateModelsInfo : function ( ) {
149149 this . __modelsInfoStack . removeAll ( ) ;
150150
151- const licensedItemBundleData = this . getAnatomicalModelsData ( ) ;
152- const modelsInfo = licensedItemBundleData [ "licensedResources" ] ;
153- modelsInfo . forEach ( ( modelInfo , index ) => {
151+ const licensedItem = this . getAnatomicalModelsData ( ) ;
152+ const licensedResources = licensedItem . getLicensedResources ( ) ;
153+ licensedResources . forEach ( ( licensedResource , index ) => {
154154 const modelInfoLayout = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 4 ) ) ;
155155
156- const anatomicalModel = modelInfo [ "source" ] ;
157-
158156 const topGrid = new qx . ui . layout . Grid ( 8 , 6 ) ;
159157 topGrid . setColumnFlex ( 0 , 1 ) ;
160158 const headerLayout = new qx . ui . container . Composite ( topGrid ) ;
161- let description = anatomicalModel [ "description" ] || "" ;
159+ let description = licensedResource [ "description" ] || "" ;
162160 description = description . replace ( / S P E A G / g, " " ) ; // remove SPEAG substring
163161 const delimiter = " - " ;
164162 let titleAndSubtitle = description . split ( delimiter ) ;
@@ -190,13 +188,13 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
190188 row : 1 ,
191189 } ) ;
192190 }
193- if ( anatomicalModel [ "thumbnail" ] ) {
191+ if ( licensedResource [ "thumbnail" ] ) {
194192 const manufacturerData = { } ;
195- if ( anatomicalModel [ "thumbnail" ] . includes ( "itis.swiss" ) ) {
193+ if ( licensedResource [ "thumbnail" ] . includes ( "itis.swiss" ) ) {
196194 manufacturerData [ "label" ] = "IT'IS Foundation" ;
197195 manufacturerData [ "link" ] = "https://itis.swiss/virtual-population/" ;
198196 manufacturerData [ "icon" ] = "https://media.licdn.com/dms/image/v2/C4D0BAQE_FGa66IyvrQ/company-logo_200_200/company-logo_200_200/0/1631341490431?e=2147483647&v=beta&t=7f_IK-ArGjPrz-1xuWolAT4S2NdaVH-e_qa8hsKRaAc" ;
199- } else if ( anatomicalModel [ "thumbnail" ] . includes ( "speag.swiss" ) ) {
197+ } else if ( licensedResource [ "thumbnail" ] . includes ( "speag.swiss" ) ) {
200198 manufacturerData [ "label" ] = "Speag" ;
201199 manufacturerData [ "link" ] = "https://speag.swiss/products/em-phantoms/overview-2/" ;
202200 manufacturerData [ "icon" ] = "https://media.licdn.com/dms/image/v2/D4E0BAQG2CYG28KAKbA/company-logo_200_200/company-logo_200_200/0/1700045977122/schmid__partner_engineering_ag_logo?e=2147483647&v=beta&t=6CZb1jjg5TnnzQWkrZBS9R3ebRKesdflg-_xYi4dwD8" ;
@@ -228,10 +226,10 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
228226
229227
230228 const middleLayout = new qx . ui . container . Composite ( new qx . ui . layout . HBox ( 16 ) ) ;
231- const thumbnail = this . self ( ) . createThumbnail ( anatomicalModel [ "thumbnail" ] , 256 ) ;
229+ const thumbnail = this . self ( ) . createThumbnail ( licensedResource [ "thumbnail" ] , 256 ) ;
232230 middleLayout . add ( thumbnail ) ;
233231
234- const features = anatomicalModel [ "features" ] ;
232+ const features = licensedResource [ "features" ] ;
235233 const featuresGrid = new qx . ui . layout . Grid ( 8 , 8 ) ;
236234 const featuresLayout = new qx . ui . container . Composite ( featuresGrid ) ;
237235 let idx = 0 ;
@@ -280,7 +278,7 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
280278 }
281279 } ) ;
282280
283- if ( anatomicalModel [ "doi" ] ) {
281+ if ( licensedResource [ "doi" ] ) {
284282 const doiTitle = new qx . ui . basic . Label ( ) . set ( {
285283 value : "DOI" ,
286284 font : "text-14" ,
@@ -307,22 +305,22 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
307305 }
308306 return doiLabel ;
309307 } ;
310- featuresLayout . add ( doiToLink ( anatomicalModel [ "doi" ] ) , {
308+ featuresLayout . add ( doiToLink ( licensedResource [ "doi" ] ) , {
311309 column : 1 ,
312310 row : idx ,
313311 } ) ;
314312 idx ++ ;
315313 }
316314
317- if ( licensedItemBundleData [ "termsOfUseUrl" ] || anatomicalModel [ "termsOfUseUrl" ] ) { // remove the first one when this info goes down to the model
315+ if ( licensedItem [ "termsOfUseUrl" ] || licensedResource [ "termsOfUseUrl" ] ) { // remove the first one when this info goes down to the model
318316 const tAndC = new qx . ui . basic . Label ( ) . set ( {
319317 font : "text-14" ,
320318 value : this . tr ( "<u>Terms and Conditions</u>" ) ,
321319 rich : true ,
322320 anonymous : false ,
323321 cursor : "pointer" ,
324322 } ) ;
325- tAndC . addListener ( "tap" , ( ) => this . __openLicense ( licensedItemBundleData [ "termsOfUseUrl" ] || anatomicalModel [ "termsOfUseUrl" ] ) ) ;
323+ tAndC . addListener ( "tap" , ( ) => this . __openLicense ( licensedItem [ "termsOfUseUrl" ] || licensedResource [ "termsOfUseUrl" ] ) ) ;
326324 featuresLayout . add ( tAndC , {
327325 column : 1 ,
328326 row : idx ,
@@ -334,7 +332,7 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
334332
335333 modelInfoLayout . add ( middleLayout ) ;
336334
337- const importSection = this . __createImportSection ( licensedItemBundleData , index ) ;
335+ const importSection = this . __createImportSection ( licensedItem , index ) ;
338336 modelInfoLayout . add ( importSection ) ;
339337
340338 this . __modelsInfoStack . add ( modelInfoLayout ) ;
@@ -372,15 +370,15 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
372370 } ) ;
373371 importButton . addListener ( "execute" , ( ) => {
374372 this . fireDataEvent ( "modelImportRequested" , {
375- modelId : anatomicalModelsData [ "licensedResources" ] [ selectedIdx ] [ "source" ] [ "id" ] ,
376- categoryId : anatomicalModelsData [ "categoryId" ] ,
373+ modelId : anatomicalModelsData . getLicensedResources ( ) [ selectedIdx ] [ "id" ] ,
374+ categoryId : anatomicalModelsData . getCategoryId ( ) ,
377375 } ) ;
378376 } , this ) ;
379377
380- osparc . store . Pricing . getInstance ( ) . fetchPricingUnits ( anatomicalModelsData [ "pricingPlanId" ] )
378+ osparc . store . Pricing . getInstance ( ) . fetchPricingUnits ( anatomicalModelsData . getPricingPlanId ( ) )
381379 . then ( pricingUnits => {
382380 if (
383- anatomicalModelsData [ "seats" ] . length ||
381+ anatomicalModelsData . getSeats ( ) . length ||
384382 ( pricingUnits . length === 1 && pricingUnits [ 0 ] . getCost ( ) === 0 )
385383 ) {
386384 importSection . add ( importButton ) ;
@@ -404,8 +402,8 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
404402 const pricingUnitsLayout = new qx . ui . container . Composite ( new qx . ui . layout . HBox ( 10 ) . set ( {
405403 alignX : "center"
406404 } ) ) ;
407- const licensedItemData = this . getAnatomicalModelsData ( ) ;
408- osparc . store . Pricing . getInstance ( ) . fetchPricingUnits ( licensedItemData [ "pricingPlanId" ] )
405+ const licensedItem = this . getAnatomicalModelsData ( ) ;
406+ osparc . store . Pricing . getInstance ( ) . fetchPricingUnits ( licensedItem . getPricingPlanId ( ) )
409407 . then ( pricingUnits => {
410408 if ( pricingUnits . length === 1 && pricingUnits [ 0 ] . getCost ( ) === 0 ) {
411409 const availableForImporting = new qx . ui . basic . Label ( ) . set ( {
@@ -428,8 +426,8 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
428426 } ) ;
429427 pUnit . addListener ( "rentPricingUnit" , ( ) => {
430428 this . fireDataEvent ( "modelPurchaseRequested" , {
431- licensedItemId : licensedItemData [ "licensedItemId" ] ,
432- pricingPlanId : licensedItemData [ "pricingPlanId" ] ,
429+ licensedItemId : licensedItem . getLicensedItemId ( ) ,
430+ pricingPlanId : licensedItem . getPricingPlanId ( ) ,
433431 pricingUnitId : pricingUnit . getPricingUnitId ( ) ,
434432 } ) ;
435433 } , this ) ;
@@ -445,15 +443,15 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
445443 } ,
446444
447445 __addSeatsSection : function ( ) {
448- const licensedItemData = this . getAnatomicalModelsData ( ) ;
449- if ( licensedItemData [ "seats" ] . length === 0 ) {
446+ const licensedItem = this . getAnatomicalModelsData ( ) ;
447+ if ( licensedItem . getSeats ( ) . length === 0 ) {
450448 return ;
451449 }
452450 const seatsSection = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 5 ) . set ( {
453451 alignX : "left" ,
454452 } ) ) ;
455453
456- licensedItemData [ "seats" ] . forEach ( purchase => {
454+ licensedItem . getSeats ( ) . forEach ( purchase => {
457455 const nSeats = purchase [ "numOfSeats" ] ;
458456 const seatsText = "seat" + ( nSeats > 1 ? "s" : "" ) ;
459457 const entry = new qx . ui . basic . Label ( ) . set ( {
0 commit comments