From 7e95307909a968322d7c7725c1de3dcf3f477791 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 5 Dec 2024 18:10:15 +0100 Subject: [PATCH] rentAnatomicalModel --- .../source/class/osparc/data/Resources.js | 6 +++- .../source/class/osparc/study/PricingUnit.js | 3 +- .../vipMarket/AnatomicalModelDetails.js | 33 +++---------------- 3 files changed, 12 insertions(+), 30 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/data/Resources.js b/services/static-webserver/client/source/class/osparc/data/Resources.js index 86622354105..88be975041d 100644 --- a/services/static-webserver/client/source/class/osparc/data/Resources.js +++ b/services/static-webserver/client/source/class/osparc/data/Resources.js @@ -1250,7 +1250,11 @@ qx.Class.define("osparc.data.Resources", { get: { method: "GET", url: statics.API + "/catalog/licensed-items" - } + }, + purchase: { + method: "GET", + url: statics.API + "/catalog/licensed-items/{licensedItemId}:purchase" + }, } } }; diff --git a/services/static-webserver/client/source/class/osparc/study/PricingUnit.js b/services/static-webserver/client/source/class/osparc/study/PricingUnit.js index f9268131d32..c2de6606e30 100644 --- a/services/static-webserver/client/source/class/osparc/study/PricingUnit.js +++ b/services/static-webserver/client/source/class/osparc/study/PricingUnit.js @@ -31,7 +31,8 @@ qx.Class.define("osparc.study.PricingUnit", { }, events: { - "editPricingUnit": "qx.event.type.Event" + "editPricingUnit": "qx.event.type.Event", + "rentPricingUnit": "qx.event.type.Event", }, properties: { diff --git a/services/static-webserver/client/source/class/osparc/vipMarket/AnatomicalModelDetails.js b/services/static-webserver/client/source/class/osparc/vipMarket/AnatomicalModelDetails.js index 02f38b35476..d456b6e46a5 100644 --- a/services/static-webserver/client/source/class/osparc/vipMarket/AnatomicalModelDetails.js +++ b/services/static-webserver/client/source/class/osparc/vipMarket/AnatomicalModelDetails.js @@ -192,40 +192,17 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", { showRentButton: true, allowGrowY: false }); + pUnit.addListener("rentPricingUnit", () => this.__rentAnatomicalModel(anatomicalModelsData, pricingUnit)); pricingUnitsLayout.add(pUnit); }); }) .catch(err => console.error(err)); - /* - if (anatomicalModelsData["leased"]) { - const leaseModelButton = new qx.ui.form.Button().set({ - label: this.tr("3 seats Leased (27 days left)"), - appearance: "strong-button", - center: true, - enabled: false, - }); - buttonsLayout.add(leaseModelButton, { - flex: 1 - }); - } - const leaseModelButton = new osparc.ui.form.FetchButton().set({ - label: this.tr("Lease model (2 for months)"), - appearance: "strong-button", - center: true, - }); - leaseModelButton.addListener("execute", () => { - leaseModelButton.setFetching(true); - setTimeout(() => { - leaseModelButton.setFetching(false); - this.fireDataEvent("modelLeased", this.getAnatomicalModelsData()["modelId"]); - }, 2000); - }); - buttonsLayout.add(leaseModelButton, { - flex: 1 - }); - */ return pricingUnitsLayout; }, + + __rentAnatomicalModel: function(anatomicalModelsData, pricingUnit) { + console.log(":puschase", anatomicalModelsData["licensedItemId"], pricingUnit["pricingUnitId"]); + }, } });