Skip to content

Commit 85839a4

Browse files
committed
confirmation window
1 parent 331d843 commit 85839a4

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

services/static-webserver/client/source/class/osparc/study/PricingUnitLicense.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ qx.Class.define("osparc.study.PricingUnitLicense", {
3131
},
3232
},
3333

34+
statics: {
35+
getExpirationDate: function() {
36+
const expirationDate = new Date();
37+
expirationDate.setFullYear(expirationDate.getFullYear() + 1); // hardcoded for now: rented for one year from now
38+
return expirationDate;
39+
},
40+
},
41+
3442
members: {
3543
_createChildControlImpl: function(id) {
3644
let control;
@@ -77,7 +85,18 @@ qx.Class.define("osparc.study.PricingUnitLicense", {
7785
},
7886

7987
__rentUnit: function() {
80-
this.fireEvent("rentPricingUnit");
88+
const expirationDate = osparc.study.PricingUnitLicense.getExpirationDate();
89+
const msg = this.getUnitData().getName() + this.tr(" will be available until ") + osparc.utils.Utils.formatDate(expirationDate);
90+
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
91+
caption: this.tr("Rent"),
92+
confirmText: this.tr("Rent"),
93+
});
94+
confirmationWin.open();
95+
confirmationWin.addListener("close", () => {
96+
if (confirmationWin.getConfirmed()) {
97+
this.fireEvent("rentPricingUnit");
98+
}
99+
}, this);
81100
},
82101
}
83102
});

services/static-webserver/client/source/class/osparc/vipMarket/VipMarket.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,7 @@ qx.Class.define("osparc.vipMarket.VipMarket", {
229229
}
230230
licensedItemsStore.purchaseLicensedItem(licensedItemId, walletId, pricingPlanId, pricingUnitId, numberOfSeats)
231231
.then(() => {
232-
const expirationDate = new Date();
233-
expirationDate.setFullYear(expirationDate.getFullYear() + 1); // hardcoded for now: rented for one year from now
232+
const expirationDate = osparc.study.PricingUnitLicense.getExpirationDate();
234233
const purchaseData = {
235234
expiresAt: expirationDate, // get this info from the response
236235
numberOfSeats, // get this info from the response

0 commit comments

Comments
 (0)