Skip to content

Commit 0b451b9

Browse files
committed
seats wording
1 parent 37921b6 commit 0b451b9

File tree

1 file changed

+13
-66
lines changed

1 file changed

+13
-66
lines changed

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

Lines changed: 13 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
7373
const licensedItemBundleData = this.getAnatomicalModelsData();
7474
if (licensedItemBundleData && licensedItemBundleData["licensedResources"].length) {
7575
this.__addModelsInfo();
76-
this.__addPricing();
7776
this.__addSeatsSection();
77+
this.__addPricing();
7878
} else {
7979
const selectModelLabel = new qx.ui.basic.Label().set({
8080
value: this.tr("Select a model for more details"),
@@ -417,74 +417,21 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
417417
if (licensedItemData["seats"].length === 0) {
418418
return;
419419
}
420-
421-
const layout = new qx.ui.container.Composite(new qx.ui.layout.VBox().set({
422-
alignX: "center",
420+
const seatsSection = new qx.ui.container.Composite(new qx.ui.layout.VBox(5).set({
421+
alignX: "left",
423422
}));
424423

425-
osparc.store.LicensedItems.getInstance().getLicensedItems()
426-
.then(licensedItems => {
427-
const grid = new qx.ui.layout.Grid(15, 5);
428-
grid.setColumnAlign(0, "left", "middle");
429-
grid.setColumnAlign(1, "center", "middle");
430-
grid.setColumnAlign(2, "right", "middle");
431-
const seatsSection = new qx.ui.container.Composite(grid).set({
432-
allowGrowX: false,
433-
decorator: "border",
434-
padding: 10,
435-
});
436-
437-
let rowIdx = 0;
438-
seatsSection.add(new qx.ui.basic.Label("Models Rented").set({font: "title-14"}), {
439-
column: 0,
440-
row: rowIdx,
441-
});
442-
seatsSection.add(new qx.ui.basic.Label("Seats").set({font: "title-14"}), {
443-
column: 1,
444-
row: rowIdx,
445-
});
446-
seatsSection.add(new qx.ui.basic.Label("Until").set({font: "title-14"}), {
447-
column: 2,
448-
row: rowIdx,
449-
});
450-
rowIdx++;
451-
452-
const entryToGrid = (licensedResource, seat, row) => {
453-
const title = osparc.store.LicensedItems.licensedResourceTitle(licensedResource);
454-
seatsSection.add(new qx.ui.basic.Label(title).set({font: "text-14"}), {
455-
column: 0,
456-
row,
457-
});
458-
seatsSection.add(new qx.ui.basic.Label(seat["numOfSeats"].toString()).set({font: "text-14"}), {
459-
column: 1,
460-
row,
461-
});
462-
seatsSection.add(new qx.ui.basic.Label(osparc.utils.Utils.formatDate(seat["expireAt"])).set({font: "text-14"}), {
463-
column: 2,
464-
row,
465-
});
466-
};
467-
468-
licensedItemData["seats"].forEach(seat => {
469-
licensedItemData["licensedResources"].forEach(licensedResource => {
470-
entryToGrid(licensedResource, seat, rowIdx);
471-
rowIdx++;
472-
});
473-
});
474-
475-
const lowerLicensedItems = osparc.store.LicensedItems.getLowerLicensedItems(licensedItems, licensedItemData["key"], licensedItemData["version"])
476-
lowerLicensedItems.forEach(lowerLicensedItem => {
477-
lowerLicensedItem["seats"].forEach(seat => {
478-
lowerLicensedItem["licensedResources"].forEach(licensedResource => {
479-
entryToGrid(licensedResource, seat, rowIdx);
480-
rowIdx++;
481-
});
482-
});
483-
});
484-
485-
layout.add(seatsSection);
486-
this._add(layout);
424+
licensedItemData["seats"].forEach(purchase => {
425+
const nSeats = purchase["numOfSeats"];
426+
const seatsText = "seat" + (nSeats > 1 ? "s" : "");
427+
const entry = new qx.ui.basic.Label().set({
428+
value: `${nSeats} ${seatsText} available until ${osparc.utils.Utils.formatDate(purchase["expireAt"])}`,
429+
font: "text-14",
487430
});
431+
seatsSection.add(entry);
432+
});
433+
434+
this._add(seatsSection);
488435
},
489436
}
490437
});

0 commit comments

Comments
 (0)