iticket-seatingplan-dev 1.4.0 → 1.4.1
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/Map.js +275 -0
- package/dist/components/SeatingPlan.js +51 -298
- package/dist/components/styles/index.css +4 -4
- package/dist/utils/enums.js +29 -0
- package/dist/utils/helpers.js +31 -0
- package/dist/utils/index.js +27 -0
- package/package.json +2 -1
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Map;
|
|
7
|
+
require("leaflet-gesture-handling/dist/leaflet-gesture-handling.css");
|
|
8
|
+
var _reactLeaflet = require("react-leaflet");
|
|
9
|
+
var _leafletGestureHandling2 = require("leaflet-gesture-handling");
|
|
10
|
+
var _reactLeafletCustomControl = _interopRequireDefault(require("react-leaflet-custom-control"));
|
|
11
|
+
var _encodedSvgs = require("./assets/encodedSvgs");
|
|
12
|
+
var _utils = require("../utils");
|
|
13
|
+
var _react = require("react");
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
function Map(_ref) {
|
|
16
|
+
let {
|
|
17
|
+
seats,
|
|
18
|
+
height,
|
|
19
|
+
width,
|
|
20
|
+
bounds,
|
|
21
|
+
handleClickSeat,
|
|
22
|
+
ticketPopupOpen,
|
|
23
|
+
setTicketPopupOpen,
|
|
24
|
+
chosenSeat,
|
|
25
|
+
addTicketToCart,
|
|
26
|
+
isReloading,
|
|
27
|
+
initialFetch,
|
|
28
|
+
isFullScreen,
|
|
29
|
+
setIsFullScreen,
|
|
30
|
+
priceSectionIds,
|
|
31
|
+
areaName,
|
|
32
|
+
price
|
|
33
|
+
} = _ref;
|
|
34
|
+
const [isLegendOpen, setIsLegendOpen] = (0, _react.useState)(false);
|
|
35
|
+
const map = (0, _reactLeaflet.useMap)();
|
|
36
|
+
(0, _react.useEffect)(() => {
|
|
37
|
+
const closeOnEscape = e => {
|
|
38
|
+
if (e.key === "Escape") {
|
|
39
|
+
if (isFullScreen && !ticketPopupOpen) {
|
|
40
|
+
setIsFullScreen(false);
|
|
41
|
+
} else if (ticketPopupOpen) {
|
|
42
|
+
map.closePopup();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
if (typeof window !== "undefined") {
|
|
47
|
+
window.addEventListener("keydown", closeOnEscape);
|
|
48
|
+
}
|
|
49
|
+
return () => {
|
|
50
|
+
if (typeof window !== "undefined") {
|
|
51
|
+
window.removeEventListener("keydown", closeOnEscape);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}, [isFullScreen, ticketPopupOpen]);
|
|
55
|
+
|
|
56
|
+
// gesture-handling plugin disallows scroll zooming and touch panning,
|
|
57
|
+
// to allow users to scroll past the map when it's not full screen.
|
|
58
|
+
(0, _react.useEffect)(() => {
|
|
59
|
+
if (!isFullScreen) {
|
|
60
|
+
map.addHandler("gestureHandling", _leafletGestureHandling2.GestureHandling);
|
|
61
|
+
map.gestureHandling.enable();
|
|
62
|
+
}
|
|
63
|
+
}, [map, isFullScreen]);
|
|
64
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_reactLeafletCustomControl.default, {
|
|
65
|
+
position: "bottomright"
|
|
66
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
className: "legendBox"
|
|
68
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: "legend-header"
|
|
70
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
71
|
+
className: "legend-button ".concat(isLegendOpen ? "expanded" : ""),
|
|
72
|
+
onClick: () => setIsLegendOpen(!isLegendOpen)
|
|
73
|
+
}, /*#__PURE__*/React.createElement("p", null, isLegendOpen ? "LEGEND:" : "VIEW LEGEND")), isLegendOpen && /*#__PURE__*/React.createElement("button", {
|
|
74
|
+
className: "close-button",
|
|
75
|
+
onClick: () => setIsLegendOpen(false)
|
|
76
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
77
|
+
src: _encodedSvgs.closeIcon,
|
|
78
|
+
alt: "close"
|
|
79
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
80
|
+
className: "legend-contents ".concat(isLegendOpen ? "expanded" : "")
|
|
81
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
className: "legend-item"
|
|
83
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: "legend-symbol legend-available"
|
|
85
|
+
}), /*#__PURE__*/React.createElement("p", null, "available"))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: "legend-item"
|
|
87
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: "legend-symbol legend-sold"
|
|
89
|
+
}), /*#__PURE__*/React.createElement("p", null, "sold"))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: "legend-item"
|
|
91
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: "legend-symbol legend-in-cart"
|
|
93
|
+
}), /*#__PURE__*/React.createElement("p", null, "in cart"))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
className: "legend-item"
|
|
95
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
96
|
+
src: _encodedSvgs.wheelchairIcon,
|
|
97
|
+
width: 15,
|
|
98
|
+
height: 15
|
|
99
|
+
}), /*#__PURE__*/React.createElement("p", null, "wheelchair"))), seats.seats.filter(seat => seat.m).length > 0 ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
100
|
+
className: "legend-item"
|
|
101
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
102
|
+
src: _encodedSvgs.userIcon,
|
|
103
|
+
width: 15,
|
|
104
|
+
height: 15
|
|
105
|
+
}), /*#__PURE__*/React.createElement("p", null, "membership seats"))) : /*#__PURE__*/React.createElement(React.Fragment, null)))), /*#__PURE__*/React.createElement(_reactLeafletCustomControl.default, {
|
|
106
|
+
position: "topleft"
|
|
107
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: "extra-controls"
|
|
109
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
110
|
+
title: "Re-centre Seating Plan",
|
|
111
|
+
onClick: () => map.fitBounds(bounds),
|
|
112
|
+
className: "leaflet-control-zoom-in"
|
|
113
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
114
|
+
src: "https://au-iticket-shop-legacy.azurewebsites.net/assets/images/fit-icon.jpg",
|
|
115
|
+
style: {
|
|
116
|
+
height: "17px"
|
|
117
|
+
}
|
|
118
|
+
})), /*#__PURE__*/React.createElement("button", {
|
|
119
|
+
title: "Reload Seating Plan",
|
|
120
|
+
disabled: isReloading,
|
|
121
|
+
onClick: () => {
|
|
122
|
+
initialFetch(true);
|
|
123
|
+
map.fitBounds(bounds);
|
|
124
|
+
},
|
|
125
|
+
className: "leaflet-control-zoom-in reload-seating-plan",
|
|
126
|
+
style: {
|
|
127
|
+
background: isReloading ? "rgb(0, 230, 64)" : "#fff"
|
|
128
|
+
}
|
|
129
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
130
|
+
className: isReloading ? "rotate" : "",
|
|
131
|
+
src: "https://au-iticket-shop-legacy.azurewebsites.net/assets/images/refresh.png",
|
|
132
|
+
style: {
|
|
133
|
+
height: "17px"
|
|
134
|
+
}
|
|
135
|
+
})))), /*#__PURE__*/React.createElement(_reactLeafletCustomControl.default, {
|
|
136
|
+
position: "topleft"
|
|
137
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
138
|
+
className: "extra-controls"
|
|
139
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
140
|
+
title: isFullScreen ? "Collapse Seating Plan" : "Expand Seating Plan",
|
|
141
|
+
onClick: () => {
|
|
142
|
+
setIsFullScreen(!isFullScreen);
|
|
143
|
+
},
|
|
144
|
+
className: "leaflet-control-zoom-in"
|
|
145
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
146
|
+
src: isFullScreen ? _encodedSvgs.collapseIcon : _encodedSvgs.expandIcon,
|
|
147
|
+
style: {
|
|
148
|
+
height: "24px"
|
|
149
|
+
}
|
|
150
|
+
})))), /*#__PURE__*/React.createElement(_reactLeafletCustomControl.default, {
|
|
151
|
+
position: "topright"
|
|
152
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
153
|
+
title: "Close full screen",
|
|
154
|
+
onClick: () => setIsFullScreen(false),
|
|
155
|
+
className: "full-screen-close-button ".concat(isFullScreen ? "show" : "")
|
|
156
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
157
|
+
src: _encodedSvgs.closeIcon,
|
|
158
|
+
style: {
|
|
159
|
+
height: "24px"
|
|
160
|
+
}
|
|
161
|
+
}))), /*#__PURE__*/React.createElement(_reactLeaflet.ImageOverlay, {
|
|
162
|
+
url: seats.background,
|
|
163
|
+
bounds: [[0, 0], [height * 0.03, width * 0.03]],
|
|
164
|
+
zIndex: 10
|
|
165
|
+
}), seats && seats.seats && seats.seats.map((s, i) => {
|
|
166
|
+
var _chosenSeat$seat;
|
|
167
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
168
|
+
key: i
|
|
169
|
+
}, /*#__PURE__*/React.createElement(_reactLeaflet.ImageOverlay, {
|
|
170
|
+
url: "https://iticketseatingplan.blob.core.windows.net/embed/static/media/rippleload.08e6a08dd832819226ef.gif",
|
|
171
|
+
bounds: [[(s.r.includes("NORTH") ? height / 33.33 - height / 33.33 * s.y * 0.0105 + 1.4 : height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.45 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207)) - 0.11, s.x * 0.3 + 0.15 - 0.11], [(s.r.includes("NORTH") ? height / 33.33 - height / 33.33 * s.y * 0.0105 + 1.4 : height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.45 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207)) + 0.11, s.x * 0.3 + 0.15 + 0.11]
|
|
172
|
+
// [height * 0.0302 - s.y * 0.602 - 0.3, s.x * 0.61 - 0.3],
|
|
173
|
+
// [height * 0.0302 - s.y * 0.602 + 0.3, s.x * 0.61 + 0.3],
|
|
174
|
+
// [height * 0.0302 - s.y * 0.602 - 0.17, s.x * 0.61 - 0.17],
|
|
175
|
+
// [height * 0.0302 - s.y * 0.602 + 0.17, s.x * 0.61 + 0.17],
|
|
176
|
+
],
|
|
177
|
+
|
|
178
|
+
opacity: s.loading || ticketPopupOpen && (chosenSeat === null || chosenSeat === void 0 ? void 0 : (_chosenSeat$seat = chosenSeat.seat) === null || _chosenSeat$seat === void 0 ? void 0 : _chosenSeat$seat.ssId) === s.ssId ? 100 : 0,
|
|
179
|
+
zIndex: 10
|
|
180
|
+
}), !priceSectionIds || priceSectionIds.includes(s.psId) ? s.s === _utils.statuses.WHEELCHAIR_ACCESS ? /*#__PURE__*/React.createElement(_reactLeaflet.ImageOverlay, {
|
|
181
|
+
url: _encodedSvgs.wheelchairIcon,
|
|
182
|
+
bounds: [
|
|
183
|
+
// [
|
|
184
|
+
// height * 0.0302 - s.y * 0.602 - 0.17,
|
|
185
|
+
// s.x * 0.61 - 0.17,
|
|
186
|
+
// ],
|
|
187
|
+
// [
|
|
188
|
+
// height * 0.0302 - s.y * 0.602 + 0.17,
|
|
189
|
+
// s.x * 0.61 + 0.17,
|
|
190
|
+
// ],
|
|
191
|
+
[height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.5 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207) - 0.11, s.x * 0.3 + 0.15 - 0.11], [height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.5 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207) + 0.11, s.x * 0.3 + 0.15 + 0.11]],
|
|
192
|
+
zIndex: 10
|
|
193
|
+
}) : s.s === _utils.statuses.USER_PENDING && s.m ? /*#__PURE__*/React.createElement(_reactLeaflet.ImageOverlay, {
|
|
194
|
+
url: _encodedSvgs.userIcon,
|
|
195
|
+
bounds: [
|
|
196
|
+
// [
|
|
197
|
+
// height * 0.0302 - s.y * 0.602 - 0.17,
|
|
198
|
+
// s.x * 0.61 - 0.17,
|
|
199
|
+
// ],
|
|
200
|
+
// [
|
|
201
|
+
// height * 0.0302 - s.y * 0.602 + 0.17,
|
|
202
|
+
// s.x * 0.61 + 0.17,
|
|
203
|
+
// ],
|
|
204
|
+
[height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.5 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207) - 0.11, s.x * 0.3 + 0.15 - 0.15], [height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.5 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207) + 0.11, s.x * 0.3 + 0.15 + 0.15]],
|
|
205
|
+
zIndex: 10
|
|
206
|
+
}) : /*#__PURE__*/React.createElement(_reactLeaflet.Circle, {
|
|
207
|
+
center: [
|
|
208
|
+
// height * 0.0305 -
|
|
209
|
+
// s.y * 0.57 -
|
|
210
|
+
// height * (height > 700 ? 0.0001 : 0.0006),
|
|
211
|
+
// s.x * 0.6 + 0.25,
|
|
212
|
+
//experimental
|
|
213
|
+
// 14.42,
|
|
214
|
+
// (height / 33.33 - 0.3 * s.y).toFixed(1)
|
|
215
|
+
// height / 33.33 - (height / 33.33) * s.y * 0.01, //29, //3 27, // height / 33.33 - s.y, // s.y * 0.3, //+ (height / 0.503) * 0.01, //11.66, // 5.2,
|
|
216
|
+
//working
|
|
217
|
+
s.r.includes("NORTH") ? height / 33.33 - height / 33.33 * s.y * 0.0105 + 1.4 : height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.45 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207),
|
|
218
|
+
// s.r.includes('NORTH')
|
|
219
|
+
// ? 0
|
|
220
|
+
// : 0,
|
|
221
|
+
s.x * 0.3 + 0.15
|
|
222
|
+
|
|
223
|
+
// height * 0.04 -
|
|
224
|
+
// s.y / (height > 800 ? 3.5 : 3.35) -
|
|
225
|
+
// (height > 800 ? height * 0.0101 : height * 0.0201),
|
|
226
|
+
// s.x * 0.3 + 0.15,
|
|
227
|
+
|
|
228
|
+
// -s.y * (height * 0.00037) + 24.2,
|
|
229
|
+
// s.x * 0.3 + 0.15,
|
|
230
|
+
],
|
|
231
|
+
|
|
232
|
+
pathOptions: (0, _utils.getInitialColor)(s, price),
|
|
233
|
+
radius: 12000,
|
|
234
|
+
eventHandlers: {
|
|
235
|
+
click: e => handleClickSeat(e, s),
|
|
236
|
+
popupopen: () => {
|
|
237
|
+
setTicketPopupOpen(true);
|
|
238
|
+
},
|
|
239
|
+
popupclose: () => {
|
|
240
|
+
setTicketPopupOpen(false);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
// value={s}
|
|
244
|
+
}, /*#__PURE__*/React.createElement(_reactLeaflet.Tooltip, {
|
|
245
|
+
className: "seatname-tooltip",
|
|
246
|
+
direction: "top",
|
|
247
|
+
offset: [0, height * 0.03 + -30]
|
|
248
|
+
}, s.r + "-" + s.c), s.s === _utils.statuses.UNSOLD && /*#__PURE__*/React.createElement(_reactLeaflet.Popup, {
|
|
249
|
+
className: "ticket-popup"
|
|
250
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
251
|
+
className: "popup-header"
|
|
252
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
253
|
+
className: "seatname"
|
|
254
|
+
}, "".concat(areaName ? areaName + " | " : "").concat(s.r, "-").concat(s.c)), /*#__PURE__*/React.createElement("button", {
|
|
255
|
+
className: "close-button",
|
|
256
|
+
"aria-label": "close popup",
|
|
257
|
+
onClick: () => map.closePopup()
|
|
258
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
259
|
+
src: _encodedSvgs.closeIcon,
|
|
260
|
+
alt: "close"
|
|
261
|
+
}))), /*#__PURE__*/React.createElement("p", {
|
|
262
|
+
className: "heading"
|
|
263
|
+
}, "Select option:"), seats.pricing.filter(price => (!priceSectionIds || priceSectionIds.includes(price.psId)) && price.psId === s.psId).map(price => /*#__PURE__*/React.createElement("div", {
|
|
264
|
+
key: price.paId,
|
|
265
|
+
className: "priceage",
|
|
266
|
+
onClick: () => {
|
|
267
|
+
s.loading = true;
|
|
268
|
+
map.closePopup();
|
|
269
|
+
addTicketToCart(s, price);
|
|
270
|
+
}
|
|
271
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
272
|
+
className: "price"
|
|
273
|
+
}, /*#__PURE__*/React.createElement("span", null, price.paName), /*#__PURE__*/React.createElement("span", null, _utils.NZDollar.format(price.p))))))) : /*#__PURE__*/React.createElement(React.Fragment, null));
|
|
274
|
+
}));
|
|
275
|
+
}
|
|
@@ -6,29 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
require("./styles/index.css");
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _Map = _interopRequireDefault(require("./Map"));
|
|
9
10
|
var _reactLeaflet = require("react-leaflet");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
11
|
+
var _utils = require("../utils");
|
|
12
|
+
var _reactDom = require("react-dom");
|
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
const statuses = {
|
|
16
|
-
UNSOLD: 1,
|
|
17
|
-
SOLD: 2,
|
|
18
|
-
RESERVED: 3,
|
|
19
|
-
USER_PENDING: 4,
|
|
20
|
-
CHEQUE_PENDING: 5,
|
|
21
|
-
WHEELCHAIR_ACCESS: 6,
|
|
22
|
-
DOOR_SALES: 7,
|
|
23
|
-
ON_HOLD: 8,
|
|
24
|
-
REAL_TIME_DOOR_SALES: 9,
|
|
25
|
-
CANCELLED: 10
|
|
26
|
-
};
|
|
27
|
-
let NZDollar = new Intl.NumberFormat("en-NZ", {
|
|
28
|
-
style: "currency",
|
|
29
|
-
currency: "NZD"
|
|
30
|
-
});
|
|
31
16
|
const SeatingPlan = _ref => {
|
|
17
|
+
var _document, _document2, _document3;
|
|
32
18
|
let {
|
|
33
19
|
eventId,
|
|
34
20
|
eventVenueId,
|
|
@@ -47,7 +33,6 @@ const SeatingPlan = _ref => {
|
|
|
47
33
|
} = _ref;
|
|
48
34
|
const [initialiseMessage, setInitialiseMessage] = (0, _react.useState)("Initialising seating plan...");
|
|
49
35
|
const [isReloading, setIsReloading] = (0, _react.useState)(false);
|
|
50
|
-
const [map, setMap] = (0, _react.useState)();
|
|
51
36
|
const [position, setPosition] = (0, _react.useState)(null);
|
|
52
37
|
const [height, setHeight] = (0, _react.useState)(0);
|
|
53
38
|
const [width, setWidth] = (0, _react.useState)(0);
|
|
@@ -57,28 +42,12 @@ const SeatingPlan = _ref => {
|
|
|
57
42
|
const [bookedSeats, setBookedSeats] = (0, _react.useState)([]);
|
|
58
43
|
const [chosenSeat, setChosenSeat] = (0, _react.useState)(null);
|
|
59
44
|
const [area, setArea] = (0, _react.useState)(null);
|
|
60
|
-
const [isLegendOpen, setIsLegendOpen] = (0, _react.useState)(false);
|
|
61
45
|
const [ticketPopupOpen, setTicketPopupOpen] = (0, _react.useState)(false);
|
|
62
46
|
const [bounds, setBounds] = (0, _react.useState)(null);
|
|
63
47
|
const [isFullScreen, setIsFullScreen] = (0, _react.useState)(false);
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
available: "#00E640",
|
|
67
|
-
sold: "#95a5a6",
|
|
68
|
-
reserved: "#95a5a6",
|
|
69
|
-
pending: "#e74c3c",
|
|
70
|
-
booked: "#e74c3c",
|
|
71
|
-
bookedWithDifferentPrice: "#fab1a0"
|
|
72
|
-
};
|
|
73
|
-
const setInitialColor = s => {
|
|
74
|
-
return {
|
|
75
|
-
fillColor: s.s === statuses.UNSOLD ? statusColors.available : s.s === statuses.USER_PENDING ? s.bookedPrice === price ? statusColors.booked : statusColors.bookedWithDifferentPrice : statusColors.sold,
|
|
76
|
-
color: "none",
|
|
77
|
-
fillOpacity: s.loading ? 0 : 1
|
|
78
|
-
};
|
|
79
|
-
};
|
|
48
|
+
const [mounted, setMounted] = _react.default.useState(false);
|
|
49
|
+
(0, _react.useLayoutEffect)(() => setMounted(true), []);
|
|
80
50
|
const addTicketToCart = (s, priceage, cs) => {
|
|
81
|
-
map.target.closePopup();
|
|
82
51
|
setProcessing(true);
|
|
83
52
|
fetch("".concat(baseUrl, "/legacy/").concat(countryCode, "/shop/events/").concat(eventId, "/").concat(eventVenueId, "/showings/").concat(showingId, "/tickets/allocated/").concat(areaId), {
|
|
84
53
|
method: "POST",
|
|
@@ -95,9 +64,9 @@ const SeatingPlan = _ref => {
|
|
|
95
64
|
if ((response === null || response === void 0 ? void 0 : response.status) === 403) {
|
|
96
65
|
s.loading = false;
|
|
97
66
|
(cs || chosenSeat).circle.target.setStyle({
|
|
98
|
-
fillColor: statusColors.sold
|
|
67
|
+
fillColor: _utils.statusColors.sold
|
|
99
68
|
});
|
|
100
|
-
cs ? cs.seat.s = statuses.SOLD : chosenSeat.seat.s = statuses.SOLD;
|
|
69
|
+
cs ? cs.seat.s = _utils.statuses.SOLD : chosenSeat.seat.s = _utils.statuses.SOLD;
|
|
101
70
|
const event = {
|
|
102
71
|
type: "error",
|
|
103
72
|
details: {
|
|
@@ -112,9 +81,9 @@ const SeatingPlan = _ref => {
|
|
|
112
81
|
} else if ((response === null || response === void 0 ? void 0 : response.status) === 400) {
|
|
113
82
|
s.loading = false;
|
|
114
83
|
(cs || chosenSeat).circle.target.setStyle({
|
|
115
|
-
fillColor: statusColors.sold
|
|
84
|
+
fillColor: _utils.statusColors.sold
|
|
116
85
|
});
|
|
117
|
-
cs ? cs.seat.s = statuses.SOLD : chosenSeat.seat.s = statuses.SOLD;
|
|
86
|
+
cs ? cs.seat.s = _utils.statuses.SOLD : chosenSeat.seat.s = _utils.statuses.SOLD;
|
|
118
87
|
const event = {
|
|
119
88
|
type: "error",
|
|
120
89
|
details: {
|
|
@@ -129,7 +98,7 @@ const SeatingPlan = _ref => {
|
|
|
129
98
|
} else if ((response === null || response === void 0 ? void 0 : response.status) === 429) {
|
|
130
99
|
s.loading = false;
|
|
131
100
|
(cs || chosenSeat).circle.target.setStyle({
|
|
132
|
-
fillColor: statusColors.available
|
|
101
|
+
fillColor: _utils.statusColors.available
|
|
133
102
|
});
|
|
134
103
|
const event = {
|
|
135
104
|
type: "error",
|
|
@@ -144,11 +113,11 @@ const SeatingPlan = _ref => {
|
|
|
144
113
|
setProcessing(false);
|
|
145
114
|
} else {
|
|
146
115
|
// console.log(chosenSeat.seat.ssId, cs?.seat.ssId)
|
|
147
|
-
s.s = statuses.USER_PENDING;
|
|
116
|
+
s.s = _utils.statuses.USER_PENDING;
|
|
148
117
|
s.bookedPrice = price;
|
|
149
118
|
s.loading = false;
|
|
150
119
|
(cs || chosenSeat).circle.target.setStyle({
|
|
151
|
-
fillColor: statusColors.booked
|
|
120
|
+
fillColor: _utils.statusColors.booked
|
|
152
121
|
});
|
|
153
122
|
setProcessing(false);
|
|
154
123
|
setBookedSeats([...bookedSeats, {
|
|
@@ -177,7 +146,7 @@ const SeatingPlan = _ref => {
|
|
|
177
146
|
}).catch(error => {
|
|
178
147
|
s.loading = false;
|
|
179
148
|
(cs || chosenSeat).circle.target.setStyle({
|
|
180
|
-
fillColor: statusColors.available
|
|
149
|
+
fillColor: _utils.statusColors.available
|
|
181
150
|
});
|
|
182
151
|
const event = {
|
|
183
152
|
type: "error",
|
|
@@ -206,10 +175,10 @@ const SeatingPlan = _ref => {
|
|
|
206
175
|
}
|
|
207
176
|
}).then(response => {
|
|
208
177
|
s.loading = false;
|
|
209
|
-
s.s = statuses.UNSOLD;
|
|
178
|
+
s.s = _utils.statuses.UNSOLD;
|
|
210
179
|
s.bookedPrice = null;
|
|
211
180
|
e.target.setStyle({
|
|
212
|
-
fillColor: statusColors.available
|
|
181
|
+
fillColor: _utils.statusColors.available
|
|
213
182
|
});
|
|
214
183
|
setBookedSeats(bookedSeats.filter(bs => bs.ssId !== s.ssId));
|
|
215
184
|
setProcessing(false);
|
|
@@ -220,7 +189,7 @@ const SeatingPlan = _ref => {
|
|
|
220
189
|
callbackFunction(event);
|
|
221
190
|
}).catch(error => {
|
|
222
191
|
e.target.setStyle({
|
|
223
|
-
fillColor: statusColors.booked
|
|
192
|
+
fillColor: _utils.statusColors.booked
|
|
224
193
|
});
|
|
225
194
|
const event = {
|
|
226
195
|
type: "error",
|
|
@@ -235,8 +204,8 @@ const SeatingPlan = _ref => {
|
|
|
235
204
|
setProcessing(false);
|
|
236
205
|
});
|
|
237
206
|
};
|
|
238
|
-
const
|
|
239
|
-
if (s.s !== statuses.UNSOLD && s.s !== statuses.USER_PENDING || bookedSeats.length >= quantity && s.s === statuses.UNSOLD) {
|
|
207
|
+
const handleClickSeat = (e, s) => {
|
|
208
|
+
if (s.s !== _utils.statuses.UNSOLD && s.s !== _utils.statuses.USER_PENDING || bookedSeats.length >= quantity && s.s === _utils.statuses.UNSOLD) {
|
|
240
209
|
if (bookedSeats.length >= quantity) {
|
|
241
210
|
const event = {
|
|
242
211
|
type: "error",
|
|
@@ -252,7 +221,7 @@ const SeatingPlan = _ref => {
|
|
|
252
221
|
circle: e,
|
|
253
222
|
seat: s
|
|
254
223
|
});
|
|
255
|
-
if (s.s === statuses.UNSOLD) {
|
|
224
|
+
if (s.s === _utils.statuses.UNSOLD) {
|
|
256
225
|
const availablePrices = seats.pricing.filter(price => (!priceSectionIds || priceSectionIds.includes(price.psId)) && s.psId === price.psId);
|
|
257
226
|
if (availablePrices.length === 1) {
|
|
258
227
|
s.loading = true;
|
|
@@ -285,7 +254,7 @@ const SeatingPlan = _ref => {
|
|
|
285
254
|
return data;
|
|
286
255
|
}).then(data => {
|
|
287
256
|
if (data.statusCode === 429) {
|
|
288
|
-
setInitialiseMessage("Looks like it's busy.
|
|
257
|
+
setInitialiseMessage("Looks like it's busy. Stand by. Trying again in ".concat(data.retryAfter, " second").concat(data.retryAfter > 1 ? "s" : "", "."));
|
|
289
258
|
return setTimeout(initialFetch, data.retryAfter * 1000);
|
|
290
259
|
}
|
|
291
260
|
if (data.statusCode === 403) {
|
|
@@ -297,7 +266,7 @@ const SeatingPlan = _ref => {
|
|
|
297
266
|
}
|
|
298
267
|
const img = new Image();
|
|
299
268
|
img.src = data.background;
|
|
300
|
-
setBookedSeats(data.seats.filter(s => s.s === statuses.USER_PENDING && s.bookedPrice === price).map(s => ({
|
|
269
|
+
setBookedSeats(data.seats.filter(s => s.s === _utils.statuses.USER_PENDING && s.bookedPrice === price).map(s => ({
|
|
301
270
|
ssId: s.ssId,
|
|
302
271
|
r: s.r,
|
|
303
272
|
c: s.c,
|
|
@@ -316,9 +285,6 @@ const SeatingPlan = _ref => {
|
|
|
316
285
|
setWidth(img.width * 0.5);
|
|
317
286
|
setSeats(data);
|
|
318
287
|
};
|
|
319
|
-
if (map && area === areaId) {
|
|
320
|
-
map.target.fitBounds(bounds);
|
|
321
|
-
}
|
|
322
288
|
setIsReloading(false);
|
|
323
289
|
}).catch(error => {
|
|
324
290
|
var _error$message;
|
|
@@ -363,262 +329,49 @@ const SeatingPlan = _ref => {
|
|
|
363
329
|
}));
|
|
364
330
|
}
|
|
365
331
|
}, [chosenSeat, processing]);
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
}, [isFullScreen]);
|
|
372
|
-
(0, _react.useEffect)(() => {
|
|
373
|
-
const closeOnEscape = e => {
|
|
374
|
-
if (e.key === "Escape") {
|
|
375
|
-
if (isFullScreen && !ticketPopupOpen) {
|
|
376
|
-
setIsFullScreen(false);
|
|
377
|
-
} else if (ticketPopupOpen) {
|
|
378
|
-
map.target.closePopup();
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
window.addEventListener("keydown", closeOnEscape);
|
|
383
|
-
return () => window.removeEventListener("keydown", closeOnEscape);
|
|
384
|
-
}, [isFullScreen, ticketPopupOpen]);
|
|
385
|
-
const calculateCenterOfMap = (height, seats) => {
|
|
386
|
-
const filteredSeats = seats.filter(price => !priceSectionIds || priceSectionIds.includes(price.psId));
|
|
387
|
-
const avgY = filteredSeats.reduce((acc, val) => {
|
|
388
|
-
return acc + val.y / filteredSeats.length;
|
|
389
|
-
}, 0);
|
|
390
|
-
const avgX = filteredSeats.reduce((acc, val) => {
|
|
391
|
-
return acc + val.x / filteredSeats.length;
|
|
392
|
-
}, 0);
|
|
393
|
-
return [height * 0.05 - avgY / (height > 800 ? height > 999 ? 3.5 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207), avgX * 0.3 + 0.15];
|
|
394
|
-
};
|
|
332
|
+
|
|
333
|
+
// render the map using ReactDOM.createPortal to avoid z-index issues
|
|
334
|
+
// in full screen mode, render the map in the body, otherwise render in the seating-plan-root div
|
|
335
|
+
const mapContainer = mounted && (isFullScreen ? (_document = document) === null || _document === void 0 ? void 0 : _document.body : (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.getElementById("seating-plan-root"));
|
|
336
|
+
const backdropContainer = mounted && ((_document3 = document) === null || _document3 === void 0 ? void 0 : _document3.body);
|
|
395
337
|
|
|
396
338
|
// return seating plan
|
|
397
339
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
398
|
-
className: "root"
|
|
340
|
+
className: "seating-plan-root",
|
|
341
|
+
id: "seating-plan-root"
|
|
399
342
|
}, error ? /*#__PURE__*/_react.default.createElement("div", {
|
|
400
343
|
className: "loading"
|
|
401
|
-
}, /*#__PURE__*/_react.default.createElement("h1", null, "OOPS!"), /*#__PURE__*/_react.default.createElement("div", null, error.response.data.message)) : position && area === areaId ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
344
|
+
}, /*#__PURE__*/_react.default.createElement("h1", null, "OOPS!"), /*#__PURE__*/_react.default.createElement("div", null, error.response.data.message)) : position && area === areaId ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, backdropContainer && /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement("div", {
|
|
402
345
|
className: "seating-plan-backdrop ".concat(isFullScreen ? "full-screen" : ""),
|
|
403
346
|
onClick: () => setIsFullScreen(false)
|
|
404
|
-
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
405
|
-
className: "seating-plan ".concat(isFullScreen ? "full-screen" : "")
|
|
347
|
+
}), backdropContainer), mapContainer && /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement("div", {
|
|
348
|
+
className: "seating-plan-container ".concat(isFullScreen ? "full-screen" : "")
|
|
406
349
|
}, /*#__PURE__*/_react.default.createElement(_reactLeaflet.MapContainer, {
|
|
407
350
|
zoomSnap: 0,
|
|
408
351
|
zoomDelta: 1,
|
|
409
|
-
|
|
410
|
-
center: calculateCenterOfMap(height, seats.seats),
|
|
352
|
+
center: (0, _utils.calculateCenterOfMap)(height, seats.seats),
|
|
411
353
|
zoom: undefined,
|
|
412
354
|
zoomControl: true,
|
|
413
355
|
scrollWheelZoom: true,
|
|
414
356
|
bounds: bounds
|
|
415
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
},
|
|
433
|
-
className: "legend-item"
|
|
434
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
435
|
-
className: "legend-symbol legend-available"
|
|
436
|
-
}), /*#__PURE__*/_react.default.createElement("p", null, "available"))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
437
|
-
className: "legend-item"
|
|
438
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
439
|
-
className: "legend-symbol legend-sold"
|
|
440
|
-
}), /*#__PURE__*/_react.default.createElement("p", null, "sold"))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
441
|
-
className: "legend-item"
|
|
442
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
443
|
-
className: "legend-symbol legend-in-cart"
|
|
444
|
-
}), /*#__PURE__*/_react.default.createElement("p", null, "in cart"))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
445
|
-
className: "legend-item"
|
|
446
|
-
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
447
|
-
src: _encodedSvgs.wheelchairIcon,
|
|
448
|
-
width: 15,
|
|
449
|
-
height: 15
|
|
450
|
-
}), /*#__PURE__*/_react.default.createElement("p", null, "wheelchair"))), seats.seats.filter(seat => seat.m).length > 0 ? /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
451
|
-
className: "legend-item"
|
|
452
|
-
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
453
|
-
src: _encodedSvgs.userIcon,
|
|
454
|
-
width: 15,
|
|
455
|
-
height: 15
|
|
456
|
-
}), /*#__PURE__*/_react.default.createElement("p", null, "membership seats"))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null)))), /*#__PURE__*/_react.default.createElement(_reactLeafletCustomControl.default, {
|
|
457
|
-
position: "topleft"
|
|
458
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
459
|
-
className: "extra-controls"
|
|
460
|
-
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
461
|
-
title: "Re-centre Seating Plan",
|
|
462
|
-
onClick: () => map.target.fitBounds(bounds),
|
|
463
|
-
className: "leaflet-control-zoom-in"
|
|
464
|
-
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
465
|
-
src: "https://au-iticket-shop-legacy.azurewebsites.net/assets/images/fit-icon.jpg",
|
|
466
|
-
style: {
|
|
467
|
-
height: "17px"
|
|
468
|
-
}
|
|
469
|
-
})), /*#__PURE__*/_react.default.createElement("button", {
|
|
470
|
-
title: "Reload Seating Plan",
|
|
471
|
-
disabled: isReloading,
|
|
472
|
-
onClick: () => initialFetch(true),
|
|
473
|
-
className: "leaflet-control-zoom-in reload-seating-plan",
|
|
474
|
-
style: {
|
|
475
|
-
background: isReloading ? "rgb(0, 230, 64)" : "#fff"
|
|
476
|
-
}
|
|
477
|
-
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
478
|
-
className: isReloading ? "rotate" : "",
|
|
479
|
-
src: "https://au-iticket-shop-legacy.azurewebsites.net/assets/images/refresh.png",
|
|
480
|
-
style: {
|
|
481
|
-
height: "17px"
|
|
482
|
-
}
|
|
483
|
-
})))), /*#__PURE__*/_react.default.createElement(_reactLeafletCustomControl.default, {
|
|
484
|
-
position: "topleft"
|
|
485
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
486
|
-
className: "extra-controls"
|
|
487
|
-
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
488
|
-
title: "Expand Seating Plan",
|
|
489
|
-
onClick: () => {
|
|
490
|
-
setIsFullScreen(!isFullScreen);
|
|
491
|
-
},
|
|
492
|
-
className: "leaflet-control-zoom-in"
|
|
493
|
-
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
494
|
-
src: isFullScreen ? _encodedSvgs.collapseIcon : _encodedSvgs.expandIcon,
|
|
495
|
-
style: {
|
|
496
|
-
height: "24px"
|
|
497
|
-
}
|
|
498
|
-
})))), /*#__PURE__*/_react.default.createElement(_reactLeafletCustomControl.default, {
|
|
499
|
-
position: "topright"
|
|
500
|
-
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
501
|
-
title: "Close full screen",
|
|
502
|
-
onClick: () => setIsFullScreen(false),
|
|
503
|
-
className: "full-screen-close-button ".concat(isFullScreen ? "show" : "")
|
|
504
|
-
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
505
|
-
src: _encodedSvgs.closeIcon,
|
|
506
|
-
style: {
|
|
507
|
-
height: "24px"
|
|
508
|
-
}
|
|
509
|
-
}))), /*#__PURE__*/_react.default.createElement(_reactLeaflet.ImageOverlay, {
|
|
510
|
-
url: seats.background,
|
|
511
|
-
bounds: [[0, 0], [height * 0.03, width * 0.03]],
|
|
512
|
-
zIndex: 10
|
|
513
|
-
}), seats && seats.seats && seats.seats.map((s, i) => {
|
|
514
|
-
var _chosenSeat$seat;
|
|
515
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
516
|
-
key: i
|
|
517
|
-
}, /*#__PURE__*/_react.default.createElement(_reactLeaflet.ImageOverlay, {
|
|
518
|
-
url: "https://iticketseatingplan.blob.core.windows.net/embed/static/media/rippleload.08e6a08dd832819226ef.gif",
|
|
519
|
-
bounds: [[(s.r.includes("NORTH") ? height / 33.33 - height / 33.33 * s.y * 0.0105 + 1.4 : height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.45 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207)) - 0.11, s.x * 0.3 + 0.15 - 0.11], [(s.r.includes("NORTH") ? height / 33.33 - height / 33.33 * s.y * 0.0105 + 1.4 : height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.45 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207)) + 0.11, s.x * 0.3 + 0.15 + 0.11]
|
|
520
|
-
// [height * 0.0302 - s.y * 0.602 - 0.3, s.x * 0.61 - 0.3],
|
|
521
|
-
// [height * 0.0302 - s.y * 0.602 + 0.3, s.x * 0.61 + 0.3],
|
|
522
|
-
// [height * 0.0302 - s.y * 0.602 - 0.17, s.x * 0.61 - 0.17],
|
|
523
|
-
// [height * 0.0302 - s.y * 0.602 + 0.17, s.x * 0.61 + 0.17],
|
|
524
|
-
],
|
|
525
|
-
|
|
526
|
-
opacity: s.loading || ticketPopupOpen && (chosenSeat === null || chosenSeat === void 0 ? void 0 : (_chosenSeat$seat = chosenSeat.seat) === null || _chosenSeat$seat === void 0 ? void 0 : _chosenSeat$seat.ssId) === s.ssId ? 100 : 0,
|
|
527
|
-
zIndex: 10
|
|
528
|
-
}), !priceSectionIds || priceSectionIds.includes(s.psId) ? s.s === statuses.WHEELCHAIR_ACCESS ? /*#__PURE__*/_react.default.createElement(_reactLeaflet.ImageOverlay, {
|
|
529
|
-
url: _encodedSvgs.wheelchairIcon,
|
|
530
|
-
bounds: [
|
|
531
|
-
// [
|
|
532
|
-
// height * 0.0302 - s.y * 0.602 - 0.17,
|
|
533
|
-
// s.x * 0.61 - 0.17,
|
|
534
|
-
// ],
|
|
535
|
-
// [
|
|
536
|
-
// height * 0.0302 - s.y * 0.602 + 0.17,
|
|
537
|
-
// s.x * 0.61 + 0.17,
|
|
538
|
-
// ],
|
|
539
|
-
[height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.5 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207) - 0.11, s.x * 0.3 + 0.15 - 0.11], [height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.5 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207) + 0.11, s.x * 0.3 + 0.15 + 0.11]],
|
|
540
|
-
zIndex: 10
|
|
541
|
-
}) : s.s === statuses.USER_PENDING && s.m ? /*#__PURE__*/_react.default.createElement(_reactLeaflet.ImageOverlay, {
|
|
542
|
-
url: _encodedSvgs.userIcon,
|
|
543
|
-
bounds: [
|
|
544
|
-
// [
|
|
545
|
-
// height * 0.0302 - s.y * 0.602 - 0.17,
|
|
546
|
-
// s.x * 0.61 - 0.17,
|
|
547
|
-
// ],
|
|
548
|
-
// [
|
|
549
|
-
// height * 0.0302 - s.y * 0.602 + 0.17,
|
|
550
|
-
// s.x * 0.61 + 0.17,
|
|
551
|
-
// ],
|
|
552
|
-
[height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.5 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207) - 0.11, s.x * 0.3 + 0.15 - 0.15], [height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.5 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207) + 0.11, s.x * 0.3 + 0.15 + 0.15]],
|
|
553
|
-
zIndex: 10
|
|
554
|
-
}) : /*#__PURE__*/_react.default.createElement(_reactLeaflet.Circle, {
|
|
555
|
-
center: [
|
|
556
|
-
// height * 0.0305 -
|
|
557
|
-
// s.y * 0.57 -
|
|
558
|
-
// height * (height > 700 ? 0.0001 : 0.0006),
|
|
559
|
-
// s.x * 0.6 + 0.25,
|
|
560
|
-
//experimental
|
|
561
|
-
// 14.42,
|
|
562
|
-
// (height / 33.33 - 0.3 * s.y).toFixed(1)
|
|
563
|
-
// height / 33.33 - (height / 33.33) * s.y * 0.01, //29, //3 27, // height / 33.33 - s.y, // s.y * 0.3, //+ (height / 0.503) * 0.01, //11.66, // 5.2,
|
|
564
|
-
//working
|
|
565
|
-
s.r.includes("NORTH") ? height / 33.33 - height / 33.33 * s.y * 0.0105 + 1.4 : height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.45 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207),
|
|
566
|
-
// s.r.includes('NORTH')
|
|
567
|
-
// ? 0
|
|
568
|
-
// : 0,
|
|
569
|
-
s.x * 0.3 + 0.15
|
|
570
|
-
|
|
571
|
-
// height * 0.04 -
|
|
572
|
-
// s.y / (height > 800 ? 3.5 : 3.35) -
|
|
573
|
-
// (height > 800 ? height * 0.0101 : height * 0.0201),
|
|
574
|
-
// s.x * 0.3 + 0.15,
|
|
575
|
-
|
|
576
|
-
// -s.y * (height * 0.00037) + 24.2,
|
|
577
|
-
// s.x * 0.3 + 0.15,
|
|
578
|
-
],
|
|
579
|
-
|
|
580
|
-
pathOptions: setInitialColor(s),
|
|
581
|
-
radius: 12000,
|
|
582
|
-
eventHandlers: {
|
|
583
|
-
click: e => handleClick(e, s),
|
|
584
|
-
popupopen: () => {
|
|
585
|
-
setTicketPopupOpen(true);
|
|
586
|
-
},
|
|
587
|
-
popupclose: () => {
|
|
588
|
-
setTicketPopupOpen(false);
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
// value={s}
|
|
592
|
-
}, /*#__PURE__*/_react.default.createElement(_reactLeaflet.Tooltip, {
|
|
593
|
-
className: "seatname-tooltip",
|
|
594
|
-
direction: "top",
|
|
595
|
-
offset: [0, height * 0.03 + -30]
|
|
596
|
-
}, s.r + "-" + s.c), s.s === statuses.UNSOLD && /*#__PURE__*/_react.default.createElement(_reactLeaflet.Popup, {
|
|
597
|
-
className: "ticket-popup"
|
|
598
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
599
|
-
className: "popup-header"
|
|
600
|
-
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
601
|
-
className: "seatname"
|
|
602
|
-
}, "".concat(areaName ? areaName + " | " : "").concat(s.r, "-").concat(s.c)), /*#__PURE__*/_react.default.createElement("button", {
|
|
603
|
-
className: "close-button",
|
|
604
|
-
"aria-label": "close popup",
|
|
605
|
-
onClick: () => map.target.closePopup()
|
|
606
|
-
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
607
|
-
src: _encodedSvgs.closeIcon,
|
|
608
|
-
alt: "close"
|
|
609
|
-
}))), /*#__PURE__*/_react.default.createElement("p", {
|
|
610
|
-
className: "heading"
|
|
611
|
-
}, "Select option:"), seats.pricing.filter(price => (!priceSectionIds || priceSectionIds.includes(price.psId)) && price.psId === s.psId).map(price => /*#__PURE__*/_react.default.createElement("div", {
|
|
612
|
-
key: price.paId,
|
|
613
|
-
className: "priceage",
|
|
614
|
-
onClick: () => {
|
|
615
|
-
s.loading = true;
|
|
616
|
-
addTicketToCart(s, price);
|
|
617
|
-
}
|
|
618
|
-
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
619
|
-
className: "price"
|
|
620
|
-
}, /*#__PURE__*/_react.default.createElement("span", null, price.paName), /*#__PURE__*/_react.default.createElement("span", null, NZDollar.format(price.p))))))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null));
|
|
621
|
-
})))) : /*#__PURE__*/_react.default.createElement("div", {
|
|
357
|
+
}, /*#__PURE__*/_react.default.createElement(_Map.default, {
|
|
358
|
+
seats: seats,
|
|
359
|
+
height: height,
|
|
360
|
+
width: width,
|
|
361
|
+
bounds: bounds,
|
|
362
|
+
handleClickSeat: handleClickSeat,
|
|
363
|
+
ticketPopupOpen: ticketPopupOpen,
|
|
364
|
+
setTicketPopupOpen: setTicketPopupOpen,
|
|
365
|
+
chosenSeat: chosenSeat,
|
|
366
|
+
addTicketToCart: addTicketToCart,
|
|
367
|
+
isReloading: isReloading,
|
|
368
|
+
initialFetch: initialFetch,
|
|
369
|
+
isFullScreen: isFullScreen,
|
|
370
|
+
setIsFullScreen: setIsFullScreen,
|
|
371
|
+
priceSectionIds: priceSectionIds,
|
|
372
|
+
areaName: areaName,
|
|
373
|
+
price: price
|
|
374
|
+
}))), mapContainer)) : /*#__PURE__*/_react.default.createElement("div", {
|
|
622
375
|
className: "loading"
|
|
623
376
|
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("svg", {
|
|
624
377
|
width: "105",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
-moz-osx-font-smoothing: grayscale;
|
|
8
8
|
} */
|
|
9
9
|
|
|
10
|
-
.root {
|
|
10
|
+
.seating-plan-root {
|
|
11
11
|
width: 100%;
|
|
12
12
|
height: 100%;
|
|
13
13
|
}
|
|
@@ -922,7 +922,7 @@ svg.leaflet-image-layer.leaflet-interactive path {
|
|
|
922
922
|
|
|
923
923
|
/* Full screen mode */
|
|
924
924
|
|
|
925
|
-
.seating-plan {
|
|
925
|
+
.seating-plan-container {
|
|
926
926
|
border-radius: 5px;
|
|
927
927
|
overflow: hidden;
|
|
928
928
|
}
|
|
@@ -946,7 +946,7 @@ svg.leaflet-image-layer.leaflet-interactive path {
|
|
|
946
946
|
z-index: 999;
|
|
947
947
|
}
|
|
948
948
|
|
|
949
|
-
.seating-plan.full-screen {
|
|
949
|
+
.seating-plan-container.full-screen {
|
|
950
950
|
position: fixed;
|
|
951
951
|
top: 0;
|
|
952
952
|
left: 0;
|
|
@@ -957,7 +957,7 @@ svg.leaflet-image-layer.leaflet-interactive path {
|
|
|
957
957
|
}
|
|
958
958
|
|
|
959
959
|
@media screen and (max-width: 1024px) {
|
|
960
|
-
.seating-plan.full-screen {
|
|
960
|
+
.seating-plan-container.full-screen {
|
|
961
961
|
height: 80%;
|
|
962
962
|
width: calc(100% - 40px);
|
|
963
963
|
margin: 10vh 20px;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.statuses = exports.statusColors = void 0;
|
|
7
|
+
const statusColors = {
|
|
8
|
+
unknown: "#95a5a6",
|
|
9
|
+
available: "#00E640",
|
|
10
|
+
sold: "#95a5a6",
|
|
11
|
+
reserved: "#95a5a6",
|
|
12
|
+
pending: "#e74c3c",
|
|
13
|
+
booked: "#e74c3c",
|
|
14
|
+
bookedWithDifferentPrice: "#fab1a0"
|
|
15
|
+
};
|
|
16
|
+
exports.statusColors = statusColors;
|
|
17
|
+
const statuses = {
|
|
18
|
+
UNSOLD: 1,
|
|
19
|
+
SOLD: 2,
|
|
20
|
+
RESERVED: 3,
|
|
21
|
+
USER_PENDING: 4,
|
|
22
|
+
CHEQUE_PENDING: 5,
|
|
23
|
+
WHEELCHAIR_ACCESS: 6,
|
|
24
|
+
DOOR_SALES: 7,
|
|
25
|
+
ON_HOLD: 8,
|
|
26
|
+
REAL_TIME_DOOR_SALES: 9,
|
|
27
|
+
CANCELLED: 10
|
|
28
|
+
};
|
|
29
|
+
exports.statuses = statuses;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getInitialColor = exports.calculateCenterOfMap = exports.NZDollar = void 0;
|
|
7
|
+
var _enums = require("./enums");
|
|
8
|
+
const getInitialColor = (s, price) => {
|
|
9
|
+
return {
|
|
10
|
+
fillColor: s.s === _enums.statuses.UNSOLD ? _enums.statusColors.available : s.s === _enums.statuses.USER_PENDING ? s.bookedPrice === price ? _enums.statusColors.booked : _enums.statusColors.bookedWithDifferentPrice : _enums.statusColors.sold,
|
|
11
|
+
color: "none",
|
|
12
|
+
fillOpacity: s.loading ? 0 : 1
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
exports.getInitialColor = getInitialColor;
|
|
16
|
+
const calculateCenterOfMap = (height, seats, priceSectionIds) => {
|
|
17
|
+
const filteredSeats = seats.filter(price => !priceSectionIds || priceSectionIds.includes(price.psId));
|
|
18
|
+
const avgY = filteredSeats.reduce((acc, val) => {
|
|
19
|
+
return acc + val.y / filteredSeats.length;
|
|
20
|
+
}, 0);
|
|
21
|
+
const avgX = filteredSeats.reduce((acc, val) => {
|
|
22
|
+
return acc + val.x / filteredSeats.length;
|
|
23
|
+
}, 0);
|
|
24
|
+
return [height * 0.05 - avgY / (height > 800 ? height > 999 ? 3.5 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207), avgX * 0.3 + 0.15];
|
|
25
|
+
};
|
|
26
|
+
exports.calculateCenterOfMap = calculateCenterOfMap;
|
|
27
|
+
const NZDollar = new Intl.NumberFormat("en-NZ", {
|
|
28
|
+
style: "currency",
|
|
29
|
+
currency: "NZD"
|
|
30
|
+
});
|
|
31
|
+
exports.NZDollar = NZDollar;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _enums = require("./enums");
|
|
7
|
+
Object.keys(_enums).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _enums[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _enums[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _helpers = require("./helpers");
|
|
18
|
+
Object.keys(_helpers).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _helpers[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _helpers[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "iticket-seatingplan-dev",
|
|
3
3
|
"description": "Seating plan with FLEXi pricing",
|
|
4
4
|
"author": "gedwyne",
|
|
5
|
-
"version": "1.4.
|
|
5
|
+
"version": "1.4.1",
|
|
6
6
|
"private": false,
|
|
7
7
|
"keywords": [
|
|
8
8
|
"iticket",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/polyfill": "^7.12.1",
|
|
19
19
|
"leaflet": "^1.9.3",
|
|
20
|
+
"leaflet-gesture-handling": "^1.2.2",
|
|
20
21
|
"react": "^18.3.1",
|
|
21
22
|
"react-dom": "^18.3.1",
|
|
22
23
|
"react-leaflet": "^4.2.1",
|