iticket-seatingplan-dev 1.7.0 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Flexi.js +16 -3
- package/dist/components/HoverPopup.js +120 -0
- package/dist/components/InvalidSeatsPopup.js +3 -3
- package/dist/components/Map.js +65 -17
- package/dist/components/PriceButton.js +3 -2
- package/dist/components/PricingPopup.js +369 -87
- package/dist/components/RemoveMultipleSeatsPopup.js +3 -3
- package/dist/components/SeatingPlan.js +40 -62
- package/dist/components/SelectQuantityPopup.js +4 -4
- package/dist/components/icons/MinusIcon.js +31 -0
- package/dist/components/icons/PlusIcon.js +31 -0
- package/dist/components/styles/flexi.css +21 -3
- package/dist/components/styles/index.css +475 -2
- package/dist/components/styles/pos.css +0 -206
- package/dist/utils/helpers.js +75 -27
- package/package.json +1 -1
|
@@ -9,6 +9,9 @@ var _utils = require("../utils");
|
|
|
9
9
|
var _encodedSvgs = require("./assets/encodedSvgs");
|
|
10
10
|
var _Flexi = _interopRequireDefault(require("./Flexi"));
|
|
11
11
|
var _TicketIcon = _interopRequireDefault(require("./icons/TicketIcon"));
|
|
12
|
+
var _MinusIcon = _interopRequireDefault(require("./icons/MinusIcon"));
|
|
13
|
+
var _PlusIcon = _interopRequireDefault(require("./icons/PlusIcon"));
|
|
14
|
+
var _FlexiIcon = _interopRequireDefault(require("./icons/FlexiIcon"));
|
|
12
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -17,66 +20,302 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
17
20
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
18
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
19
22
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
-
const
|
|
23
|
+
const numOnlyRgx = /^\d+$/;
|
|
24
|
+
const FlexiDialog = _ref => {
|
|
21
25
|
let {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
price,
|
|
27
|
+
onClose,
|
|
28
|
+
onConfirm,
|
|
29
|
+
buttonText,
|
|
30
|
+
showCheckbox,
|
|
31
|
+
checkboxText,
|
|
32
|
+
initialChecked
|
|
25
33
|
} = _ref;
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
35
|
+
className: "flexi-popup",
|
|
36
|
+
role: "dialog",
|
|
37
|
+
"aria-modal": "true"
|
|
38
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
39
|
+
className: "flexi-popup-header popup-header"
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement(_FlexiIcon.default, {
|
|
41
|
+
className: "ticket-icon",
|
|
42
|
+
height: "86px",
|
|
43
|
+
width: "86px"
|
|
44
|
+
}), /*#__PURE__*/_react.default.createElement("button", {
|
|
45
|
+
className: "close-button",
|
|
46
|
+
"aria-label": "close popup",
|
|
47
|
+
onClick: onClose
|
|
48
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
49
|
+
src: _encodedSvgs.closeIconWhite,
|
|
50
|
+
alt: "close",
|
|
51
|
+
height: "20px",
|
|
52
|
+
width: "20px"
|
|
53
|
+
})), /*#__PURE__*/_react.default.createElement("h3", null, "Edit FLEXi price")), /*#__PURE__*/_react.default.createElement(_Flexi.default, {
|
|
54
|
+
isOpen: true,
|
|
55
|
+
price: price,
|
|
56
|
+
onClose: onClose,
|
|
57
|
+
onConfirm: onConfirm,
|
|
58
|
+
buttonText: buttonText,
|
|
59
|
+
showCheckbox: showCheckbox,
|
|
60
|
+
checkboxText: checkboxText,
|
|
61
|
+
initialChecked: initialChecked
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
const Option = _ref2 => {
|
|
65
|
+
let {
|
|
66
|
+
priceage,
|
|
67
|
+
qty,
|
|
68
|
+
max,
|
|
69
|
+
updateSeatGroupPriceage
|
|
70
|
+
} = _ref2;
|
|
26
71
|
const [flexiOpen, setFlexiOpen] = (0, _react.useState)(false);
|
|
27
|
-
const
|
|
72
|
+
const isAvailable = priceage.q === null || priceage.q > 0;
|
|
73
|
+
const isFlexi = !!priceage.pMax && !!priceage.pMin && priceage.pMax > priceage.pMin;
|
|
74
|
+
const handleMinus = () => {
|
|
75
|
+
if (qty <= 0) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const newValue = qty - 1;
|
|
79
|
+
updateSeatGroupPriceage(priceage, newValue);
|
|
80
|
+
};
|
|
81
|
+
const handleAdd = () => {
|
|
82
|
+
if (qty >= max) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const newValue = qty + 1;
|
|
86
|
+
updateSeatGroupPriceage(priceage, newValue);
|
|
87
|
+
};
|
|
88
|
+
const handleOnChange = event => {
|
|
89
|
+
const inputValue = event.target.value || "0";
|
|
90
|
+
if (!numOnlyRgx.test(inputValue)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const numericValue = Number(inputValue);
|
|
94
|
+
if (numericValue > max || numericValue < 0) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
updateSeatGroupPriceage(priceage, numericValue);
|
|
98
|
+
};
|
|
28
99
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
29
|
-
className: "
|
|
30
|
-
}, /*#__PURE__*/_react.default.createElement("
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
key: price.paId,
|
|
38
|
-
disabled: price.is_available === false,
|
|
39
|
-
value: price.paId
|
|
40
|
-
}, "".concat(price.paName, " ").concat(_utils.NZDollar.format(price.paId === seatGroup.priceage.paId ? seatGroup.priceage.p : price.p)).concat(price.is_available === false ? " - Allocation exhausted" : "")))), isSelectedPriceFlexi && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("button", {
|
|
100
|
+
className: "priceage-option ".concat(!isAvailable ? "sold-out" : "")
|
|
101
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
102
|
+
className: "priceage-option-header"
|
|
103
|
+
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
104
|
+
className: "pa-name"
|
|
105
|
+
}, priceage.paName), /*#__PURE__*/_react.default.createElement("div", {
|
|
106
|
+
className: "pa-price"
|
|
107
|
+
}, /*#__PURE__*/_react.default.createElement("p", null, "".concat(_utils.NZDollar.format(priceage.p)).concat(!isAvailable ? " - Allocation exhausted" : "")), isFlexi && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("button", {
|
|
41
108
|
className: "flexi-button",
|
|
42
109
|
onClick: () => setFlexiOpen(true)
|
|
43
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
44
|
-
|
|
110
|
+
}, /*#__PURE__*/_react.default.createElement(_FlexiIcon.default, {
|
|
111
|
+
className: "ticket-icon",
|
|
45
112
|
height: "18px",
|
|
46
113
|
width: "18px"
|
|
47
|
-
}), /*#__PURE__*/_react.default.createElement("span", null, "Edit FLEXi price")), flexiOpen && /*#__PURE__*/_react.default.createElement(
|
|
48
|
-
|
|
49
|
-
role: "dialog",
|
|
50
|
-
"aria-modal": "true"
|
|
51
|
-
}, /*#__PURE__*/_react.default.createElement(_Flexi.default, {
|
|
52
|
-
price: seatGroup.priceage,
|
|
114
|
+
}), /*#__PURE__*/_react.default.createElement("span", null, "Edit FLEXi price")), flexiOpen && /*#__PURE__*/_react.default.createElement(FlexiDialog, {
|
|
115
|
+
price: priceage,
|
|
53
116
|
onClose: () => setFlexiOpen(false),
|
|
54
117
|
onConfirm: value => {
|
|
55
|
-
|
|
118
|
+
updateSeatGroupPriceage(_objectSpread(_objectSpread({}, priceage), {}, {
|
|
56
119
|
p: value
|
|
57
|
-
});
|
|
58
|
-
updateSeatGroupPriceage(newPriceage);
|
|
120
|
+
}), qty);
|
|
59
121
|
},
|
|
60
122
|
buttonText: "Confirm"
|
|
123
|
+
})))), /*#__PURE__*/_react.default.createElement("div", {
|
|
124
|
+
className: "price-qty-select"
|
|
125
|
+
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
126
|
+
disabled: qty <= 0 || !isAvailable,
|
|
127
|
+
className: "price-qty-button",
|
|
128
|
+
onClick: handleMinus,
|
|
129
|
+
"aria-label": "Minus one"
|
|
130
|
+
}, /*#__PURE__*/_react.default.createElement(_MinusIcon.default, {
|
|
131
|
+
strokeWidth: "2"
|
|
132
|
+
})), /*#__PURE__*/_react.default.createElement("input", {
|
|
133
|
+
onChange: handleOnChange,
|
|
134
|
+
type: "text",
|
|
135
|
+
value: qty,
|
|
136
|
+
"aria-label": "Quantity",
|
|
137
|
+
pattern: "\\d+",
|
|
138
|
+
disabled: !isAvailable
|
|
139
|
+
}), /*#__PURE__*/_react.default.createElement("button", {
|
|
140
|
+
disabled: qty >= max || !isAvailable,
|
|
141
|
+
className: "price-qty-button",
|
|
142
|
+
onClick: handleAdd,
|
|
143
|
+
"aria-label": "Plus one"
|
|
144
|
+
}, /*#__PURE__*/_react.default.createElement(_PlusIcon.default, {
|
|
145
|
+
strokeWidth: "2"
|
|
61
146
|
}))));
|
|
62
147
|
};
|
|
63
|
-
|
|
148
|
+
const SingleSelect = _ref3 => {
|
|
149
|
+
var _seat$priceage, _seat$priceage2, _seat$priceage3, _seat$priceage4, _seat$priceage5;
|
|
150
|
+
let {
|
|
151
|
+
seat,
|
|
152
|
+
seats,
|
|
153
|
+
seatPriceages,
|
|
154
|
+
updateSeatPriceage
|
|
155
|
+
} = _ref3;
|
|
156
|
+
const [flexiOpen, setFlexiOpen] = (0, _react.useState)(false);
|
|
157
|
+
const isSelectedPriceFlexi = !!((_seat$priceage = seat.priceage) !== null && _seat$priceage !== void 0 && _seat$priceage.pMax) && !!((_seat$priceage2 = seat.priceage) !== null && _seat$priceage2 !== void 0 && _seat$priceage2.pMin) && ((_seat$priceage3 = seat.priceage) === null || _seat$priceage3 === void 0 ? void 0 : _seat$priceage3.pMax) > ((_seat$priceage4 = seat.priceage) === null || _seat$priceage4 === void 0 ? void 0 : _seat$priceage4.pMin);
|
|
158
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
159
|
+
className: "single-seat-select-wrapper"
|
|
160
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
161
|
+
className: "single-seat-header"
|
|
162
|
+
}, /*#__PURE__*/_react.default.createElement("h4", {
|
|
163
|
+
className: "seat-name"
|
|
164
|
+
}, "".concat(seat.seat.r, "-").concat(seat.seat.c)), isSelectedPriceFlexi && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("button", {
|
|
165
|
+
className: "flexi-button",
|
|
166
|
+
onClick: () => setFlexiOpen(true)
|
|
167
|
+
}, /*#__PURE__*/_react.default.createElement(_FlexiIcon.default, {
|
|
168
|
+
className: "ticket-icon",
|
|
169
|
+
height: "18px",
|
|
170
|
+
width: "18px"
|
|
171
|
+
}), /*#__PURE__*/_react.default.createElement("span", null, "Edit FLEXi price")), flexiOpen && /*#__PURE__*/_react.default.createElement(FlexiDialog, {
|
|
172
|
+
price: seat.priceage,
|
|
173
|
+
onClose: () => setFlexiOpen(false),
|
|
174
|
+
onConfirm: (value, checked) => {
|
|
175
|
+
updateSeatPriceage(seat.seat, _objectSpread(_objectSpread({}, seat.priceage), {}, {
|
|
176
|
+
p: value
|
|
177
|
+
}), checked);
|
|
178
|
+
},
|
|
179
|
+
buttonText: "Confirm",
|
|
180
|
+
showCheckbox: true,
|
|
181
|
+
checkboxText: "Apply to all FLEXi seats in this section",
|
|
182
|
+
initialChecked: true
|
|
183
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
184
|
+
className: "single-seat-select"
|
|
185
|
+
}, /*#__PURE__*/_react.default.createElement("select", {
|
|
186
|
+
onChange: e => {
|
|
187
|
+
const newPriceage = seatPriceages.find(p => p.paId.toString() === e.target.value);
|
|
188
|
+
if (newPriceage) {
|
|
189
|
+
updateSeatPriceage(seat.seat, newPriceage);
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
value: (_seat$priceage5 = seat.priceage) === null || _seat$priceage5 === void 0 ? void 0 : _seat$priceage5.paId
|
|
193
|
+
}, seatPriceages.map(price => {
|
|
194
|
+
var _seat$priceage6, _seat$priceage7;
|
|
195
|
+
const qtyBooked = seats.filter(s => {
|
|
196
|
+
var _s$priceage;
|
|
197
|
+
return ((_s$priceage = s.priceage) === null || _s$priceage === void 0 ? void 0 : _s$priceage.paId) === price.paId;
|
|
198
|
+
}).length;
|
|
199
|
+
const disabled = price.q !== null && (price.q <= 0 || price.paId !== ((_seat$priceage6 = seat.priceage) === null || _seat$priceage6 === void 0 ? void 0 : _seat$priceage6.paId) && qtyBooked >= price.q);
|
|
200
|
+
return /*#__PURE__*/_react.default.createElement("option", {
|
|
201
|
+
key: price.paId,
|
|
202
|
+
disabled: disabled,
|
|
203
|
+
value: price.paId
|
|
204
|
+
}, "".concat(price.paName, " ").concat(_utils.NZDollar.format(((_seat$priceage7 = seat.priceage) === null || _seat$priceage7 === void 0 ? void 0 : _seat$priceage7.paId) === price.paId ? seat.priceage.p : price.p)).concat(disabled ? " - Allocation exhausted" : ""));
|
|
205
|
+
}))));
|
|
206
|
+
};
|
|
207
|
+
function PricingPopup(_ref4) {
|
|
64
208
|
let {
|
|
65
209
|
onClose,
|
|
66
|
-
|
|
67
|
-
pricing,
|
|
68
|
-
priceSectionIds,
|
|
210
|
+
selectedSeats,
|
|
69
211
|
batchAddTicketsToCart,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
} =
|
|
73
|
-
const [seatGroupsToBook, setSeatGroupsToBook] = (0, _react.useState)(
|
|
74
|
-
|
|
212
|
+
pricing,
|
|
213
|
+
priceSectionIds
|
|
214
|
+
} = _ref4;
|
|
215
|
+
const [seatGroupsToBook, setSeatGroupsToBook] = (0, _react.useState)(selectedSeats.reduce((acc, curr) => {
|
|
216
|
+
if (curr.psId) {
|
|
217
|
+
const priceages = pricing.filter(price => price.psId === curr.psId && (!priceSectionIds || priceSectionIds.includes(price.psId)));
|
|
218
|
+
const availablePriceages = priceages.filter(p => p.q === null || p.q > 0);
|
|
219
|
+
const soldOutPriceages = priceages.filter(p => p.q === 0);
|
|
220
|
+
const numSeats = selectedSeats.filter(s => s.psId === curr.psId).length;
|
|
221
|
+
if (!acc[curr.psId]) {
|
|
222
|
+
let qtyFilled = 0;
|
|
223
|
+
acc[curr.psId] = {
|
|
224
|
+
seats: [],
|
|
225
|
+
priceages: [...availablePriceages.map(pa => {
|
|
226
|
+
let qty = 0;
|
|
227
|
+
if (qtyFilled < numSeats) {
|
|
228
|
+
var _pa$q;
|
|
229
|
+
qty = Math.min(numSeats - qtyFilled, (_pa$q = pa.q) !== null && _pa$q !== void 0 ? _pa$q : numSeats);
|
|
230
|
+
qtyFilled += qty;
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
priceage: pa,
|
|
234
|
+
qty
|
|
235
|
+
};
|
|
236
|
+
}), ...soldOutPriceages.map(pa => ({
|
|
237
|
+
priceage: pa,
|
|
238
|
+
qty: 0
|
|
239
|
+
}))]
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
const availablePriceage = availablePriceages.find(pa => {
|
|
243
|
+
var _pa$q2;
|
|
244
|
+
const qtyFilled = acc[curr.psId].seats.filter(s => {
|
|
245
|
+
var _s$priceage2;
|
|
246
|
+
return ((_s$priceage2 = s.priceage) === null || _s$priceage2 === void 0 ? void 0 : _s$priceage2.paId) === pa.paId;
|
|
247
|
+
}).length;
|
|
248
|
+
return qtyFilled < ((_pa$q2 = pa.q) !== null && _pa$q2 !== void 0 ? _pa$q2 : numSeats);
|
|
249
|
+
});
|
|
250
|
+
acc[curr.psId].seats.push({
|
|
251
|
+
seat: curr,
|
|
252
|
+
priceage: availablePriceage
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
return acc;
|
|
256
|
+
}, {}));
|
|
257
|
+
const updateSeatGroupPriceage = (priceage, qty) => {
|
|
258
|
+
const newSeatGroupsToBook = _objectSpread({}, seatGroupsToBook);
|
|
259
|
+
const group = newSeatGroupsToBook[priceage.psId];
|
|
260
|
+
if (group) {
|
|
261
|
+
const newPriceages = [...group.priceages];
|
|
262
|
+
const priceageIndex = newPriceages.findIndex(pa => pa.priceage.paId === priceage.paId);
|
|
263
|
+
if (priceageIndex !== -1) {
|
|
264
|
+
newPriceages[priceageIndex] = {
|
|
265
|
+
priceage,
|
|
266
|
+
qty
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
const newSeats = [];
|
|
270
|
+
let i = 0;
|
|
271
|
+
newPriceages.forEach(pa => {
|
|
272
|
+
for (let ii = 0; ii < pa.qty; ii++) {
|
|
273
|
+
newSeats.push({
|
|
274
|
+
seat: group.seats[i].seat,
|
|
275
|
+
priceage: pa.priceage
|
|
276
|
+
});
|
|
277
|
+
i++;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
if (i < group.seats.length) {
|
|
281
|
+
newSeats.push(...group.seats.slice(i).map(s => _objectSpread(_objectSpread({}, s), {}, {
|
|
282
|
+
priceage: undefined
|
|
283
|
+
})));
|
|
284
|
+
}
|
|
285
|
+
newSeatGroupsToBook[priceage.psId] = {
|
|
286
|
+
seats: newSeats,
|
|
287
|
+
priceages: newPriceages
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
setSeatGroupsToBook(newSeatGroupsToBook);
|
|
291
|
+
};
|
|
292
|
+
const updateSeatPriceage = (seat, priceage, applyPriceToAll) => {
|
|
293
|
+
const newSeatGroupsToBook = _objectSpread({}, seatGroupsToBook);
|
|
294
|
+
const group = newSeatGroupsToBook[priceage.psId];
|
|
295
|
+
if (group) {
|
|
296
|
+
const seatIndex = group.seats.findIndex(s => s.seat.ssId === seat.ssId);
|
|
297
|
+
if (seatIndex !== -1) {
|
|
298
|
+
group.seats[seatIndex].priceage = priceage;
|
|
299
|
+
}
|
|
300
|
+
if (applyPriceToAll) {
|
|
301
|
+
const priceageIndex = group.priceages.findIndex(pa => pa.priceage.paId === priceage.paId);
|
|
302
|
+
if (priceageIndex !== -1) {
|
|
303
|
+
group.priceages[priceageIndex].priceage = priceage;
|
|
304
|
+
}
|
|
305
|
+
group.seats.forEach(s => {
|
|
306
|
+
if (s.priceage.paId === priceage.paId) {
|
|
307
|
+
s.priceage = priceage;
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
setSeatGroupsToBook(newSeatGroupsToBook);
|
|
312
|
+
}
|
|
313
|
+
};
|
|
75
314
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
76
|
-
className: "
|
|
315
|
+
className: "seatingplan-dialog-backdrop",
|
|
77
316
|
onClick: onClose
|
|
78
317
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
79
|
-
className: "
|
|
318
|
+
className: "seatingplan-dialog",
|
|
80
319
|
role: "dialog",
|
|
81
320
|
"aria-modal": "true"
|
|
82
321
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -95,59 +334,103 @@ function PricingPopup(_ref2) {
|
|
|
95
334
|
height: "20px",
|
|
96
335
|
width: "20px"
|
|
97
336
|
})), /*#__PURE__*/_react.default.createElement("h3", null, "Choose prices")), /*#__PURE__*/_react.default.createElement("div", {
|
|
98
|
-
className: "
|
|
337
|
+
className: "seatingplan-dialog-content"
|
|
99
338
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
100
|
-
className: "
|
|
101
|
-
},
|
|
102
|
-
let [id, seatGroup] =
|
|
103
|
-
const
|
|
104
|
-
|
|
339
|
+
className: "price-section-list"
|
|
340
|
+
}, Object.entries(seatGroupsToBook).map((_ref5, i) => {
|
|
341
|
+
let [id, seatGroup] = _ref5;
|
|
342
|
+
const totalQty = seatGroup.seats.length;
|
|
343
|
+
const selectedQty = seatGroup.priceages.reduce((acc, curr) => acc + curr.qty, 0);
|
|
344
|
+
const groupedByRows = seatGroup.seats.reduce((acc, curr) => {
|
|
345
|
+
if (!acc[curr.seat.r]) {
|
|
346
|
+
acc[curr.seat.r] = [];
|
|
347
|
+
}
|
|
348
|
+
acc[curr.seat.r].push(curr);
|
|
349
|
+
return acc;
|
|
350
|
+
}, {});
|
|
351
|
+
return selectedSeats.length > 6 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
105
352
|
key: id,
|
|
106
353
|
className: "seat-group"
|
|
107
354
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
108
355
|
className: "seat-group-header"
|
|
109
|
-
}, /*#__PURE__*/_react.default.createElement("h4",
|
|
356
|
+
}, /*#__PURE__*/_react.default.createElement("h4", {
|
|
357
|
+
className: "ps-name"
|
|
358
|
+
}, seatGroup.seats[0].seat.psName), /*#__PURE__*/_react.default.createElement("p", {
|
|
359
|
+
className: "no-of-seats"
|
|
360
|
+
}, "".concat(seatGroup.seats.length, " seat").concat(seatGroup.seats.length !== 1 ? "s" : ""))), /*#__PURE__*/_react.default.createElement("div", {
|
|
110
361
|
className: "seat-names"
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
362
|
+
}, Object.entries(groupedByRows).map(_ref6 => {
|
|
363
|
+
let [row, seats] = _ref6;
|
|
364
|
+
const isAllNumbers = seats.every(s => numOnlyRgx.test(s.seat.c));
|
|
365
|
+
seats.sort((a, b) => isAllNumbers ? parseInt(a.seat.c) - parseInt(b.seat.c) : a.seat.c.localeCompare(b.seat.c));
|
|
366
|
+
|
|
367
|
+
// If all seats in the row are numbers, sort and format them as ranges
|
|
368
|
+
if (isAllNumbers) {
|
|
369
|
+
const ranges = [];
|
|
370
|
+
let start = parseInt(seats[0].seat.c);
|
|
371
|
+
let end = parseInt(seats[0].seat.c);
|
|
372
|
+
for (let i = 1; i < seats.length; i++) {
|
|
373
|
+
const currCol = parseInt(seats[i].seat.c);
|
|
374
|
+
if (currCol === end + 1) {
|
|
375
|
+
end = currCol;
|
|
376
|
+
} else {
|
|
377
|
+
ranges.push(start === end ? "".concat(start) : "".concat(start, "-").concat(end));
|
|
378
|
+
start = currCol;
|
|
379
|
+
end = currCol;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
ranges.push(start === end ? "".concat(start) : "".concat(start, "-").concat(end));
|
|
383
|
+
return ranges.map(r => /*#__PURE__*/_react.default.createElement("span", {
|
|
384
|
+
className: "seat-name",
|
|
385
|
+
key: r
|
|
386
|
+
}, "".concat(row, " ").concat(r)));
|
|
118
387
|
}
|
|
119
|
-
|
|
388
|
+
return seats.map(s => /*#__PURE__*/_react.default.createElement("span", {
|
|
389
|
+
className: "seat-name",
|
|
390
|
+
key: s.seat.ssId
|
|
391
|
+
}, row, " ", s.seat.c));
|
|
392
|
+
})), seatGroup.priceages.filter(pa => pa.priceage.q === null || pa.priceage.q > 0).length > 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
393
|
+
className: "price-select-wrapper"
|
|
394
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
395
|
+
className: "bulk-price-select"
|
|
396
|
+
}, seatGroup.priceages.map(_ref7 => {
|
|
397
|
+
var _priceage$q;
|
|
398
|
+
let {
|
|
399
|
+
priceage,
|
|
400
|
+
qty
|
|
401
|
+
} = _ref7;
|
|
402
|
+
return /*#__PURE__*/_react.default.createElement(Option, {
|
|
403
|
+
key: priceage.paId,
|
|
404
|
+
priceage: priceage,
|
|
405
|
+
qty: qty,
|
|
406
|
+
max: Math.min(totalQty - (selectedQty - qty), (_priceage$q = priceage.q) !== null && _priceage$q !== void 0 ? _priceage$q : totalQty),
|
|
407
|
+
updateSeatGroupPriceage: updateSeatGroupPriceage
|
|
408
|
+
});
|
|
409
|
+
})), /*#__PURE__*/_react.default.createElement("p", {
|
|
410
|
+
className: "selected-qty ".concat(selectedQty === totalQty ? "complete" : "")
|
|
411
|
+
}, "Selected: ", selectedQty, " of ", totalQty)) : /*#__PURE__*/_react.default.createElement("p", {
|
|
120
412
|
className: "no-prices-available"
|
|
121
|
-
}, "Oops, looks like there are no prices available for this section."))
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
seat,
|
|
125
|
-
priceage
|
|
126
|
-
} = _ref4;
|
|
127
|
-
const seatPriceages = pricing.filter(price => (!priceSectionIds || priceSectionIds.includes(price.psId)) && price.psId === seat.psId);
|
|
128
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
129
|
-
key: seat.ssId,
|
|
130
|
-
className: "seat-group"
|
|
413
|
+
}, "Oops, looks like there are no prices available for this section.")) : /*#__PURE__*/_react.default.createElement("div", {
|
|
414
|
+
key: id,
|
|
415
|
+
className: "single-seat-group"
|
|
131
416
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
132
417
|
className: "seat-group-header"
|
|
133
|
-
}, /*#__PURE__*/_react.default.createElement("h4",
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
}) : /*#__PURE__*/_react.default.createElement("p", {
|
|
418
|
+
}, /*#__PURE__*/_react.default.createElement("h4", {
|
|
419
|
+
className: "ps-name"
|
|
420
|
+
}, seatGroup.seats[0].seat.psName), /*#__PURE__*/_react.default.createElement("p", {
|
|
421
|
+
className: "no-of-seats"
|
|
422
|
+
}, "".concat(seatGroup.seats.length, " seat").concat(seatGroup.seats.length !== 1 ? "s" : ""))), seatGroup.priceages.filter(pa => pa.priceage.q === null || pa.priceage.q > 0).length > 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
423
|
+
className: "seat-list"
|
|
424
|
+
}, seatGroup.seats.sort((a, b) => seatGroup.seats.every(s => numOnlyRgx.test(s.seat.c)) ? parseInt(a.seat.c) - parseInt(b.seat.c) : a.seat.c.localeCompare(b.seat.c)).map(s => /*#__PURE__*/_react.default.createElement(SingleSelect, {
|
|
425
|
+
key: s.seat.ssId,
|
|
426
|
+
seat: s,
|
|
427
|
+
seats: seatGroup.seats,
|
|
428
|
+
seatPriceages: seatGroup.priceages.map(pa => pa.priceage),
|
|
429
|
+
updateSeatPriceage: updateSeatPriceage
|
|
430
|
+
}))) : /*#__PURE__*/_react.default.createElement("p", {
|
|
148
431
|
className: "no-prices-available"
|
|
149
432
|
}, "Oops, looks like there are no prices available for this section."));
|
|
150
|
-
})
|
|
433
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
151
434
|
className: "buttons"
|
|
152
435
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
153
436
|
className: "cancel",
|
|
@@ -155,12 +438,11 @@ function PricingPopup(_ref2) {
|
|
|
155
438
|
}, "Cancel"), /*#__PURE__*/_react.default.createElement("button", {
|
|
156
439
|
className: "add-cart",
|
|
157
440
|
onClick: () => {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
onClose();
|
|
441
|
+
if (!Object.values(seatGroupsToBook).some(s => s.seats.some(s => !s.priceage))) {
|
|
442
|
+
batchAddTicketsToCart(Object.values(seatGroupsToBook).flatMap(s => s.seats));
|
|
443
|
+
onClose();
|
|
444
|
+
}
|
|
163
445
|
},
|
|
164
|
-
disabled:
|
|
165
|
-
}, "Add to cart")))));
|
|
446
|
+
disabled: Object.values(seatGroupsToBook).some(s => s.seats.some(s => !s.priceage))
|
|
447
|
+
}, selectedSeats.length > 1 ? "Add all to cart" : "Add to cart")))));
|
|
166
448
|
}
|
|
@@ -14,10 +14,10 @@ function RemoveMultipleSeatsPopup(_ref) {
|
|
|
14
14
|
onClose
|
|
15
15
|
} = _ref;
|
|
16
16
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
17
|
-
className: "
|
|
17
|
+
className: "seatingplan-dialog-backdrop",
|
|
18
18
|
onClick: onClose
|
|
19
19
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
20
|
-
className: "
|
|
20
|
+
className: "seatingplan-dialog remove-multiple-seats-popup",
|
|
21
21
|
role: "dialog",
|
|
22
22
|
"aria-modal": "true"
|
|
23
23
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -36,7 +36,7 @@ function RemoveMultipleSeatsPopup(_ref) {
|
|
|
36
36
|
height: "20px",
|
|
37
37
|
width: "20px"
|
|
38
38
|
})), /*#__PURE__*/_react.default.createElement("h3", null, "Remove from cart")), /*#__PURE__*/_react.default.createElement("div", {
|
|
39
|
-
className: "
|
|
39
|
+
className: "seatingplan-dialog-content"
|
|
40
40
|
}, /*#__PURE__*/_react.default.createElement("h4", {
|
|
41
41
|
className: "quantity-heading"
|
|
42
42
|
}, "This will remove all adjacent seats from your cart. Are you sure you want to proceed?"), /*#__PURE__*/_react.default.createElement("div", {
|