@kineticdata/bundle-tech-bar 5.1.2 → 6.0.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/lib/App.js +41 -36
- package/lib/components/AppointmentForm.js +48 -36
- package/lib/components/CheckIn.js +86 -78
- package/lib/components/Display.js +64 -53
- package/lib/components/Feedback.js +106 -103
- package/lib/components/Form.js +56 -48
- package/lib/components/Home.js +148 -144
- package/lib/components/Overhead.js +52 -44
- package/lib/components/Past.js +56 -44
- package/lib/components/Sidebar.js +58 -51
- package/lib/components/TechBars.js +72 -68
- package/lib/components/settings/SchedulerSettings.js +32 -21
- package/lib/components/settings/Settings.js +54 -50
- package/lib/components/settings/Sidebar.js +41 -31
- package/lib/components/settings/TechBarMetrics.js +124 -120
- package/lib/components/settings/TechBarSettings.js +46 -36
- package/lib/components/settings/metrics/MetricsExport.js +120 -107
- package/lib/components/settings/metrics/MetricsSummary.js +140 -141
- package/lib/components/settings/metrics/MetricsTrend.js +331 -341
- package/lib/components/settings/tech-bar/AppointmentForm.js +30 -20
- package/lib/components/settings/tech-bar/TechBar.js +90 -79
- package/lib/components/settings/tech-bar/TechBarDisplayMembers.js +108 -108
- package/lib/components/settings/tech-bar/TechBarSettingsForm.js +44 -34
- package/lib/components/shared/PageTitle.js +24 -15
- package/lib/constants.js +38 -16
- package/lib/index.js +49 -53
- package/lib/redux/modules/app.js +22 -17
- package/lib/redux/modules/appointments.js +31 -35
- package/lib/redux/modules/export.js +26 -21
- package/lib/redux/modules/metrics.js +24 -19
- package/lib/redux/modules/techBarApp.js +33 -34
- package/lib/redux/modules/walkIns.js +23 -21
- package/lib/redux/reducers.js +21 -14
- package/lib/redux/sagas/app.js +15 -13
- package/lib/redux/sagas/appointments.js +220 -256
- package/lib/redux/sagas/export.js +153 -166
- package/lib/redux/sagas/metrics.js +76 -76
- package/lib/redux/sagas/techBarApp.js +240 -258
- package/lib/redux/sagas/walkIns.js +124 -132
- package/lib/redux/sagas.js +18 -14
- package/lib/redux/store.js +36 -27
- package/lib/utils.js +9 -2
- package/package.json +54 -64
package/lib/components/Home.js
CHANGED
|
@@ -1,118 +1,126 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.mapStateToProps = exports.mapDispatchToProps = exports.HomeComponent = exports.Home = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _store = require("../redux/store");
|
|
11
|
+
var _recompose = require("recompose");
|
|
12
|
+
var _reactstrap = require("reactstrap");
|
|
13
|
+
var _bundleCommon = require("@kineticdata/bundle-common");
|
|
14
|
+
var _PageTitle = require("./shared/PageTitle");
|
|
15
|
+
var _router = require("@reach/router");
|
|
16
|
+
var _appointments = require("../redux/modules/appointments");
|
|
17
|
+
var _walkIns = require("../redux/modules/walkIns");
|
|
18
|
+
var _techBarApp = require("../redux/modules/techBarApp");
|
|
19
|
+
var _constants = require("../constants");
|
|
20
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
21
|
+
var _react2 = require("@kineticdata/react");
|
|
22
|
+
var _techBarHero = _interopRequireDefault(require("../../assets/images/tech-bar-hero.jpg"));
|
|
23
|
+
var HomeComponent = function HomeComponent(_ref) {
|
|
16
24
|
var kapp = _ref.kapp,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
techBars = _ref.techBars,
|
|
26
|
+
upcomingAppointments = _ref.upcomingAppointments,
|
|
27
|
+
error = _ref.error,
|
|
28
|
+
modalOpen = _ref.modalOpen,
|
|
29
|
+
setModalOpen = _ref.setModalOpen,
|
|
30
|
+
currentTechBar = _ref.currentTechBar,
|
|
31
|
+
selectCurrentTechBar = _ref.selectCurrentTechBar,
|
|
32
|
+
useLocationServices = _ref.useLocationServices,
|
|
33
|
+
userLocation = _ref.userLocation,
|
|
34
|
+
getUserLocation = _ref.getUserLocation,
|
|
35
|
+
openDropdown = _ref.openDropdown,
|
|
36
|
+
toggleDropdown = _ref.toggleDropdown,
|
|
37
|
+
hasTechBarDisplayRole = _ref.hasTechBarDisplayRole,
|
|
38
|
+
waitingUsers = _ref.waitingUsers;
|
|
31
39
|
var selectedTechBar = currentTechBar || techBars.get(0);
|
|
32
|
-
return /*#__PURE__*/
|
|
40
|
+
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
33
41
|
className: "page-container page-container--lg"
|
|
34
|
-
}, /*#__PURE__*/
|
|
42
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
35
43
|
className: "page-panel"
|
|
36
|
-
}, /*#__PURE__*/
|
|
44
|
+
}, /*#__PURE__*/_react["default"].createElement(_PageTitle.PageTitle, {
|
|
37
45
|
hero: true,
|
|
38
46
|
image: true,
|
|
39
|
-
heroImage:
|
|
47
|
+
heroImage: _techBarHero["default"],
|
|
40
48
|
overlayColor: "rgba(0,0,0,0.6)",
|
|
41
49
|
center: true,
|
|
42
50
|
title: "Welcome to ".concat(selectedTechBar ? selectedTechBar.values['Name'] : kapp ? kapp.name : 'Tech Bar'),
|
|
43
51
|
subtitle: selectedTechBar ? selectedTechBar.values['Description'] : 'We deliver in-person service that gets people back on track.',
|
|
44
52
|
withCard: true
|
|
45
|
-
}, /*#__PURE__*/
|
|
53
|
+
}, /*#__PURE__*/_react["default"].createElement(_bundleCommon.Card, {
|
|
46
54
|
bar: true,
|
|
47
55
|
barColor: "warning",
|
|
48
56
|
barSize: "xs"
|
|
49
|
-
}, /*#__PURE__*/
|
|
57
|
+
}, /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardCol, {
|
|
50
58
|
className: "overflow-auto"
|
|
51
|
-
}, /*#__PURE__*/
|
|
59
|
+
}, /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, null, /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
|
|
52
60
|
type: "prepend"
|
|
53
|
-
}, /*#__PURE__*/
|
|
61
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
54
62
|
className: "fa fa-map-marker fa-3x"
|
|
55
|
-
})), /*#__PURE__*/
|
|
63
|
+
})), /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardCol, null, /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, null, /*#__PURE__*/_react["default"].createElement("strong", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, selectedTechBar.values['Name'])), techBars.size > 1 && /*#__PURE__*/_react["default"].createElement("button", {
|
|
56
64
|
className: "btn btn-inverse btn-sm ml-auto",
|
|
57
65
|
onClick: function onClick() {
|
|
58
66
|
return setModalOpen(true);
|
|
59
67
|
}
|
|
60
|
-
}, /*#__PURE__*/
|
|
68
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Change"))), selectedTechBar.values['Location'] && /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
|
|
61
69
|
type: "meta",
|
|
62
70
|
className: "text-muted p-0"
|
|
63
|
-
}, /*#__PURE__*/
|
|
71
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, selectedTechBar.values['Location'])))), /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
|
|
64
72
|
type: "meta",
|
|
65
73
|
className: "flex-grow-1 flex-shrink-1 overflow-auto my-2"
|
|
66
|
-
}, selectedTechBar.values['Details'] && /*#__PURE__*/
|
|
74
|
+
}, selectedTechBar.values['Details'] && /*#__PURE__*/_react["default"].createElement("p", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, selectedTechBar.values['Details']))), /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardCol, {
|
|
67
75
|
className: "flex-grow-0 flex-shrink-0"
|
|
68
|
-
}, /*#__PURE__*/
|
|
76
|
+
}, /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, null, /*#__PURE__*/_react["default"].createElement(_router.Link, {
|
|
69
77
|
to: "appointment/".concat(selectedTechBar.values['Id']),
|
|
70
78
|
className: "btn btn-primary flex-grow-1"
|
|
71
|
-
}, /*#__PURE__*/
|
|
79
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Schedule Now"), " \u2192")), /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
|
|
72
80
|
type: "meta",
|
|
73
81
|
className: "pt-0"
|
|
74
|
-
}, /*#__PURE__*/
|
|
82
|
+
}, /*#__PURE__*/_react["default"].createElement("em", {
|
|
75
83
|
className: "text-muted ".concat(waitingUsers === 0 ? '' : '')
|
|
76
|
-
}, /*#__PURE__*/
|
|
84
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Currently awaiting assistance"), ": ", waitingUsers, ' ', /*#__PURE__*/_react["default"].createElement(_react2.I18n, {
|
|
77
85
|
render: function render(translate) {
|
|
78
86
|
return waitingUsers === 1 ? translate('person') : translate('people');
|
|
79
87
|
}
|
|
80
|
-
}))))))), /*#__PURE__*/
|
|
88
|
+
}))))))), /*#__PURE__*/_react["default"].createElement("section", {
|
|
81
89
|
className: "mt-4"
|
|
82
|
-
}, selectedTechBar ? /*#__PURE__*/
|
|
90
|
+
}, selectedTechBar ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
83
91
|
className: "info-tile__wrapper"
|
|
84
|
-
}, /*#__PURE__*/
|
|
92
|
+
}, /*#__PURE__*/_react["default"].createElement(_router.Link, {
|
|
85
93
|
to: "appointment/".concat(selectedTechBar.values['Id']),
|
|
86
94
|
className: "info-tile"
|
|
87
|
-
}, /*#__PURE__*/
|
|
95
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
88
96
|
className: "icon"
|
|
89
|
-
}, /*#__PURE__*/
|
|
97
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
90
98
|
className: "fa fa-calendar-o fa-fw"
|
|
91
|
-
})), /*#__PURE__*/
|
|
99
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
92
100
|
className: "title"
|
|
93
|
-
}, /*#__PURE__*/
|
|
101
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
94
102
|
className: "fa fa-calendar-o fa-fw"
|
|
95
|
-
}), /*#__PURE__*/
|
|
103
|
+
}), /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Schedule")), /*#__PURE__*/_react["default"].createElement("p", {
|
|
96
104
|
className: "description"
|
|
97
|
-
}, /*#__PURE__*/
|
|
105
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Schedule an appointment."))), /*#__PURE__*/_react["default"].createElement(_router.Link, {
|
|
98
106
|
to: "past",
|
|
99
107
|
className: "info-tile"
|
|
100
|
-
}, /*#__PURE__*/
|
|
108
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
101
109
|
className: "icon"
|
|
102
|
-
}, /*#__PURE__*/
|
|
110
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
103
111
|
className: "fa fa-clock-o fa-fw"
|
|
104
|
-
})), /*#__PURE__*/
|
|
112
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
105
113
|
className: "title"
|
|
106
|
-
}, /*#__PURE__*/
|
|
114
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
107
115
|
className: "fa fa-clock-o fa-fw"
|
|
108
|
-
}), /*#__PURE__*/
|
|
116
|
+
}), /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "History")), /*#__PURE__*/_react["default"].createElement("p", {
|
|
109
117
|
className: "description"
|
|
110
|
-
}, /*#__PURE__*/
|
|
118
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "View all of your past appointments."))), /*#__PURE__*/_react["default"].createElement(_react2.I18n, {
|
|
111
119
|
render: function render(translate) {
|
|
112
|
-
return /*#__PURE__*/
|
|
120
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
113
121
|
className: "info-tile actionable",
|
|
114
122
|
onClick: function onClick() {
|
|
115
|
-
return openModalForm({
|
|
123
|
+
return (0, _bundleCommon.openModalForm)({
|
|
116
124
|
formSlug: 'general-feedback',
|
|
117
125
|
kappSlug: kapp.slug,
|
|
118
126
|
values: {
|
|
@@ -122,166 +130,167 @@ export var HomeComponent = function HomeComponent(_ref) {
|
|
|
122
130
|
confirmationMessage: translate('Thank you for your feedback.')
|
|
123
131
|
});
|
|
124
132
|
}
|
|
125
|
-
}, /*#__PURE__*/
|
|
133
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
126
134
|
className: "icon"
|
|
127
|
-
}, /*#__PURE__*/
|
|
135
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
128
136
|
className: "fa fa-comment-o fa-fw"
|
|
129
|
-
})), /*#__PURE__*/
|
|
137
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
130
138
|
className: "title"
|
|
131
|
-
}, /*#__PURE__*/
|
|
139
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
132
140
|
className: "fa fa-comment-o fa-fw"
|
|
133
|
-
}), /*#__PURE__*/
|
|
141
|
+
}), /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Feedback")), /*#__PURE__*/_react["default"].createElement("p", {
|
|
134
142
|
className: "description"
|
|
135
|
-
}, /*#__PURE__*/
|
|
143
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Questions, comments, or concerns.")));
|
|
136
144
|
}
|
|
137
|
-
})) : /*#__PURE__*/
|
|
145
|
+
})) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
138
146
|
className: "alert alert-warning alert-bar"
|
|
139
|
-
}, /*#__PURE__*/
|
|
147
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
140
148
|
className: "h5"
|
|
141
|
-
}, "There are no Tech Bars configured."), /*#__PURE__*/
|
|
149
|
+
}, "There are no Tech Bars configured."), /*#__PURE__*/_react["default"].createElement("div", null, "Please contact an administrator."))), /*#__PURE__*/_react["default"].createElement("section", {
|
|
142
150
|
className: "mt-4"
|
|
143
|
-
}, /*#__PURE__*/
|
|
151
|
+
}, /*#__PURE__*/_react["default"].createElement("h2", {
|
|
144
152
|
className: "section__title"
|
|
145
|
-
}, /*#__PURE__*/
|
|
153
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
146
154
|
className: "title"
|
|
147
|
-
}, /*#__PURE__*/
|
|
155
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Upcoming Appointments"))), /*#__PURE__*/_react["default"].createElement(_bundleCommon.StateListWrapper, {
|
|
148
156
|
data: upcomingAppointments,
|
|
149
157
|
error: error,
|
|
150
158
|
emptyTitle: "You have no upcoming appointments.",
|
|
151
159
|
emptyMessage: "As you schedule appointments, they'll appear here."
|
|
152
160
|
}, function (data) {
|
|
153
|
-
return /*#__PURE__*/
|
|
161
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
154
162
|
className: "cards mb-3"
|
|
155
163
|
}, data.map(function (appt) {
|
|
156
164
|
var techBar = techBars.find(function (t) {
|
|
157
165
|
return t.values['Id'] === appt.values['Scheduler Id'];
|
|
158
166
|
});
|
|
159
|
-
var date =
|
|
160
|
-
var start =
|
|
167
|
+
var date = _moment["default"].utc(appt.values['Event Date'], _constants.DATE_FORMAT);
|
|
168
|
+
var start = _moment["default"].utc(appt.values['Event Time'], _constants.TIME_FORMAT);
|
|
161
169
|
var end = start.clone().add(appt.values['Event Duration'], 'minute');
|
|
162
|
-
return /*#__PURE__*/
|
|
170
|
+
return /*#__PURE__*/_react["default"].createElement(_bundleCommon.Card, {
|
|
163
171
|
key: appt.id,
|
|
164
172
|
to: "appointment/".concat(appt.values['Scheduler Id'], "/").concat(appt.id),
|
|
165
173
|
components: {
|
|
166
|
-
Link: Link
|
|
174
|
+
Link: _router.Link
|
|
167
175
|
}
|
|
168
|
-
}, /*#__PURE__*/
|
|
176
|
+
}, /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, null, /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
|
|
169
177
|
type: "prepend"
|
|
170
|
-
}, /*#__PURE__*/
|
|
178
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
171
179
|
className: "fa fa-calendar fa-rounded",
|
|
172
180
|
style: {
|
|
173
181
|
background: 'rgb(255, 74, 94)'
|
|
174
182
|
}
|
|
175
|
-
})), /*#__PURE__*/
|
|
183
|
+
})), /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardCol, null, /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
|
|
176
184
|
type: "multi"
|
|
177
|
-
}, /*#__PURE__*/
|
|
185
|
+
}, /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
|
|
178
186
|
type: "subtitle"
|
|
179
|
-
}, /*#__PURE__*/
|
|
187
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.Moment, {
|
|
180
188
|
timestamp: date,
|
|
181
|
-
format: Moment.formats.dateWithDay
|
|
182
|
-
})), /*#__PURE__*/
|
|
189
|
+
format: _react2.Moment.formats.dateWithDay
|
|
190
|
+
})), /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
|
|
183
191
|
className: "text-muted"
|
|
184
|
-
}, /*#__PURE__*/
|
|
192
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.Moment, {
|
|
185
193
|
timestamp: start,
|
|
186
|
-
format: Moment.formats.time
|
|
187
|
-
}), " - ", /*#__PURE__*/
|
|
194
|
+
format: _react2.Moment.formats.time
|
|
195
|
+
}), " - ", /*#__PURE__*/_react["default"].createElement(_react2.Moment, {
|
|
188
196
|
timestamp: end,
|
|
189
|
-
format: Moment.formats.time
|
|
190
|
-
})), /*#__PURE__*/
|
|
197
|
+
format: _react2.Moment.formats.time
|
|
198
|
+
})), /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
|
|
191
199
|
type: "meta"
|
|
192
|
-
}, /*#__PURE__*/
|
|
200
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, techBar.values['Name']))), /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
|
|
193
201
|
type: "meta"
|
|
194
|
-
}, appt.values['Summary']))), /*#__PURE__*/
|
|
202
|
+
}, appt.values['Summary']))), /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
|
|
195
203
|
type: "append"
|
|
196
|
-
}, /*#__PURE__*/
|
|
204
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
197
205
|
className: "badge badge-stylized badge-".concat(appt.coreState === 'Closed' ? 'dark' : 'success')
|
|
198
|
-
}, /*#__PURE__*/
|
|
206
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, appt.values['Status'])))));
|
|
199
207
|
}));
|
|
200
|
-
})))), modalOpen && /*#__PURE__*/
|
|
208
|
+
})))), modalOpen && /*#__PURE__*/_react["default"].createElement(_reactstrap.Modal, {
|
|
201
209
|
isOpen: !!modalOpen,
|
|
202
210
|
toggle: function toggle() {
|
|
203
211
|
return setModalOpen(false);
|
|
204
212
|
},
|
|
205
213
|
size: "sm",
|
|
206
214
|
className: "tech-bar-modal"
|
|
207
|
-
}, /*#__PURE__*/
|
|
215
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
208
216
|
className: "modal-header"
|
|
209
|
-
}, /*#__PURE__*/
|
|
217
|
+
}, /*#__PURE__*/_react["default"].createElement("h4", {
|
|
210
218
|
className: "modal-title"
|
|
211
|
-
}, /*#__PURE__*/
|
|
219
|
+
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
212
220
|
type: "button",
|
|
213
221
|
className: "btn btn-link",
|
|
214
222
|
onClick: function onClick() {
|
|
215
223
|
return setModalOpen(false);
|
|
216
224
|
}
|
|
217
|
-
}, /*#__PURE__*/
|
|
225
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Cancel")), /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Location")), /*#__PURE__*/_react["default"].createElement(_router.Link, {
|
|
218
226
|
to: "tech-bars",
|
|
219
227
|
className: "btn btn-link"
|
|
220
|
-
}, /*#__PURE__*/
|
|
228
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "View All")))), useLocationServices && !userLocation && /*#__PURE__*/_react["default"].createElement("div", {
|
|
221
229
|
className: "modal-header"
|
|
222
|
-
}, /*#__PURE__*/
|
|
230
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
223
231
|
className: "px-3 py-1 text-center"
|
|
224
|
-
}, /*#__PURE__*/
|
|
232
|
+
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
225
233
|
className: "btn btn-link",
|
|
226
234
|
onClick: getUserLocation
|
|
227
|
-
}, /*#__PURE__*/
|
|
235
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
228
236
|
className: "fa fa-fw fa-map-marker"
|
|
229
|
-
}), ' ', /*#__PURE__*/
|
|
230
|
-
return /*#__PURE__*/
|
|
237
|
+
}), ' ', /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "use my current location")))), /*#__PURE__*/_react["default"].createElement(_reactstrap.ModalBody, null, /*#__PURE__*/_react["default"].createElement("ul", null, techBars.map(function (techBar) {
|
|
238
|
+
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
231
239
|
key: techBar.id,
|
|
232
240
|
onClick: function onClick() {
|
|
233
241
|
return selectCurrentTechBar(techBar.id);
|
|
234
242
|
}
|
|
235
|
-
}, /*#__PURE__*/
|
|
243
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
236
244
|
className: "title"
|
|
237
|
-
}, /*#__PURE__*/
|
|
245
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, techBar.values['Name'])), techBar.values['Location'] && /*#__PURE__*/_react["default"].createElement("div", {
|
|
238
246
|
className: "subtitle"
|
|
239
|
-
}, /*#__PURE__*/
|
|
247
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, techBar.values['Location'])), userLocation && /*#__PURE__*/_react["default"].createElement("div", {
|
|
240
248
|
className: "subtitle"
|
|
241
|
-
}, /*#__PURE__*/
|
|
249
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.I18n, {
|
|
242
250
|
render: function render(translate) {
|
|
243
251
|
return techBar.distance ? "(".concat(techBar.distance.toFixed(1), " ").concat(translate('miles'), ")") : "(".concat(translate('Distance Unknown'), ")");
|
|
244
252
|
}
|
|
245
|
-
})), /*#__PURE__*/
|
|
253
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
246
254
|
className: "details"
|
|
247
|
-
}, techBar.values['Description'] && /*#__PURE__*/
|
|
255
|
+
}, techBar.values['Description'] && /*#__PURE__*/_react["default"].createElement("p", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, techBar.values['Description'])), techBar.values['Details'] && /*#__PURE__*/_react["default"].createElement("p", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, techBar.values['Details']))));
|
|
248
256
|
})))));
|
|
249
257
|
};
|
|
250
|
-
|
|
258
|
+
exports.HomeComponent = HomeComponent;
|
|
259
|
+
var mapStateToProps = function mapStateToProps(state, props) {
|
|
251
260
|
var techBars = state.techBarApp.schedulers.filter(function (s) {
|
|
252
261
|
return s.values['Status'] === 'Active';
|
|
253
262
|
});
|
|
254
|
-
var useLocationServices = enableLocationServices(techBars);
|
|
263
|
+
var useLocationServices = (0, _techBarApp.enableLocationServices)(techBars);
|
|
255
264
|
return {
|
|
256
265
|
kappSlug: state.app.kappSlug,
|
|
257
266
|
kapp: state.app.kapp,
|
|
258
267
|
profile: state.app.profile,
|
|
259
|
-
techBars: useLocationServices && props.userLocation ? techBars.map(mapTechBarsForDistance(props.userLocation)).sort(sortTechBarsByDistance) : techBars,
|
|
268
|
+
techBars: useLocationServices && props.userLocation ? techBars.map((0, _techBarApp.mapTechBarsForDistance)(props.userLocation)).sort(_techBarApp.sortTechBarsByDistance) : techBars,
|
|
260
269
|
error: state.appointments.error,
|
|
261
270
|
upcomingAppointments: state.appointments.upcoming,
|
|
262
271
|
waitingUsers: (state.appointments.overview ? state.appointments.overview.size : 0) + (state.walkIns.overview ? state.walkIns.overview.size : 0),
|
|
263
272
|
useLocationServices: useLocationServices
|
|
264
273
|
};
|
|
265
274
|
};
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
275
|
+
exports.mapStateToProps = mapStateToProps;
|
|
276
|
+
var mapDispatchToProps = {
|
|
277
|
+
fetchUpcomingAppointmentsRequest: _appointments.actions.fetchUpcomingAppointmentsRequest,
|
|
278
|
+
fetchAppointmentsOverviewRequest: _appointments.actions.fetchAppointmentsOverviewRequest,
|
|
279
|
+
fetchWalkInsOverviewRequest: _walkIns.actions.fetchWalkInsOverviewRequest
|
|
270
280
|
};
|
|
271
|
-
|
|
281
|
+
exports.mapDispatchToProps = mapDispatchToProps;
|
|
272
282
|
var selectCurrentTechBar = function selectCurrentTechBar(_ref2) {
|
|
273
283
|
var techBars = _ref2.techBars,
|
|
274
|
-
|
|
275
|
-
|
|
284
|
+
setCurrentTechBar = _ref2.setCurrentTechBar,
|
|
285
|
+
setModalOpen = _ref2.setModalOpen;
|
|
276
286
|
return function (id) {
|
|
277
287
|
setModalOpen(false);
|
|
278
|
-
sessionStorage.setItem(SESSION_ITEM_CURRENT_TECH_BAR, id);
|
|
288
|
+
sessionStorage.setItem(_constants.SESSION_ITEM_CURRENT_TECH_BAR, id);
|
|
279
289
|
setCurrentTechBar(techBars.find(function (t) {
|
|
280
290
|
return t.id === id;
|
|
281
291
|
}));
|
|
282
292
|
};
|
|
283
293
|
};
|
|
284
|
-
|
|
285
294
|
var getUserLocation = function getUserLocation(_ref3) {
|
|
286
295
|
var setUserLocation = _ref3.setUserLocation;
|
|
287
296
|
return function () {
|
|
@@ -292,60 +301,54 @@ var getUserLocation = function getUserLocation(_ref3) {
|
|
|
292
301
|
longitude: position.coords.longitude
|
|
293
302
|
};
|
|
294
303
|
setUserLocation(userLocObj);
|
|
295
|
-
sessionStorage.setItem(SESSION_ITEM_USER_LOCATION, JSON.stringify(userLocObj));
|
|
304
|
+
sessionStorage.setItem(_constants.SESSION_ITEM_USER_LOCATION, JSON.stringify(userLocObj));
|
|
296
305
|
}
|
|
297
306
|
});
|
|
298
307
|
};
|
|
299
308
|
};
|
|
300
|
-
|
|
301
309
|
var toggleDropdown = function toggleDropdown(_ref4) {
|
|
302
310
|
var setOpenDropdown = _ref4.setOpenDropdown,
|
|
303
|
-
|
|
311
|
+
openDropdown = _ref4.openDropdown;
|
|
304
312
|
return function (dropdownSlug) {
|
|
305
313
|
return function () {
|
|
306
314
|
return setOpenDropdown(dropdownSlug === openDropdown ? false : dropdownSlug);
|
|
307
315
|
};
|
|
308
316
|
};
|
|
309
317
|
};
|
|
310
|
-
|
|
311
318
|
var hasTechBarDisplayRole = function hasTechBarDisplayRole(_ref5) {
|
|
312
319
|
var profile = _ref5.profile;
|
|
313
320
|
return function (techBarName) {
|
|
314
|
-
return Utils.isMemberOf(profile, "Role::Tech Bar Display::".concat(techBarName));
|
|
321
|
+
return _bundleCommon.Utils.isMemberOf(profile, "Role::Tech Bar Display::".concat(techBarName));
|
|
315
322
|
};
|
|
316
323
|
};
|
|
317
|
-
|
|
318
|
-
export var Home = compose(withState('userLocation', 'setUserLocation', function () {
|
|
324
|
+
var Home = (0, _recompose.compose)((0, _recompose.withState)('userLocation', 'setUserLocation', function () {
|
|
319
325
|
try {
|
|
320
|
-
var locObj = JSON.parse(sessionStorage.getItem(SESSION_ITEM_USER_LOCATION));
|
|
321
|
-
|
|
326
|
+
var locObj = JSON.parse(sessionStorage.getItem(_constants.SESSION_ITEM_USER_LOCATION));
|
|
322
327
|
if (locObj && locObj.latitude != null && locObj.longitude != null) {
|
|
323
328
|
return locObj;
|
|
324
329
|
}
|
|
325
330
|
} catch (e) {}
|
|
326
|
-
|
|
327
331
|
return null;
|
|
328
|
-
}), connect(mapStateToProps, mapDispatchToProps), withState('currentTechBar', 'setCurrentTechBar', function (_ref6) {
|
|
332
|
+
}), (0, _store.connect)(mapStateToProps, mapDispatchToProps), (0, _recompose.withState)('currentTechBar', 'setCurrentTechBar', function (_ref6) {
|
|
329
333
|
var techBars = _ref6.techBars;
|
|
330
|
-
var techBarId = sessionStorage.getItem(SESSION_ITEM_CURRENT_TECH_BAR);
|
|
334
|
+
var techBarId = sessionStorage.getItem(_constants.SESSION_ITEM_CURRENT_TECH_BAR);
|
|
331
335
|
return techBarId ? techBars.find(function (t) {
|
|
332
336
|
return t.id === techBarId;
|
|
333
337
|
}) : null;
|
|
334
|
-
}), withState('modalOpen', 'setModalOpen', false), withState('openDropdown', 'setOpenDropdown', false), withHandlers({
|
|
338
|
+
}), (0, _recompose.withState)('modalOpen', 'setModalOpen', false), (0, _recompose.withState)('openDropdown', 'setOpenDropdown', false), (0, _recompose.withHandlers)({
|
|
335
339
|
selectCurrentTechBar: selectCurrentTechBar,
|
|
336
340
|
getUserLocation: getUserLocation,
|
|
337
341
|
toggleDropdown: toggleDropdown,
|
|
338
342
|
hasTechBarDisplayRole: hasTechBarDisplayRole
|
|
339
|
-
}), lifecycle({
|
|
343
|
+
}), (0, _recompose.lifecycle)({
|
|
340
344
|
componentDidMount: function componentDidMount() {
|
|
341
345
|
// If not loading, fetch upcoming appointments
|
|
342
|
-
this.props.fetchUpcomingAppointmentsRequest();
|
|
343
|
-
|
|
346
|
+
this.props.fetchUpcomingAppointmentsRequest();
|
|
347
|
+
// Ask for user location if enabled and not already saved
|
|
344
348
|
if (this.props.useLocationServices && this.props.userLocation === null) {
|
|
345
349
|
this.props.getUserLocation();
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
|
|
350
|
+
}
|
|
351
|
+
// Fetch count of checked in customers at the current techbar
|
|
349
352
|
if (this.props.techBars.size > 0) {
|
|
350
353
|
var selectedTechBar = this.props.currentTechBar || this.props.techBars.get(0);
|
|
351
354
|
this.props.fetchAppointmentsOverviewRequest({
|
|
@@ -367,4 +370,5 @@ export var Home = compose(withState('userLocation', 'setUserLocation', function
|
|
|
367
370
|
});
|
|
368
371
|
}
|
|
369
372
|
}
|
|
370
|
-
}))(HomeComponent);
|
|
373
|
+
}))(HomeComponent);
|
|
374
|
+
exports.Home = Home;
|