@tenancy.nz/reports 1.0.1 → 1.0.3

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.
@@ -3,163 +3,193 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var jsxRuntime = require('react/jsx-runtime');
7
- require('react');
6
+ var React = require('react');
8
7
  var reactUid = require('react-uid');
9
8
  var ui = require('@tenancy.nz/ui');
10
9
  var featureUi = require('@tenancy.nz/feature-ui');
10
+ var ReportHeader = require('./ReportHeader.cjs');
11
+ var ReportFooter = require('./ReportFooter.cjs');
11
12
 
12
- function OwnerBookingReport({
13
- agent = {},
14
- bookings = [],
15
- chart = {},
16
- footer = void 0,
17
- header = void 0,
18
- loading = false,
19
- notes,
20
- property = {},
21
- stats
22
- }) {
23
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { width: "100%", children: [
24
- header,
25
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { container: true, spacing: 6, children: [
26
- /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 8, children: /* @__PURE__ */ jsxRuntime.jsx(
27
- featureUi.PropertyCard,
28
- {
29
- address: property.address,
30
- imgSrc: property.imgSrc,
31
- noOfBedrooms: property.noOfBedrooms,
32
- noOfBathrooms: property.noOfBathrooms,
33
- noOfCarparks: property.noOfCarparks,
34
- rent: property.rent,
35
- loading,
36
- compact: true,
37
- outlined: true
13
+ function OwnerBookingReport(_ref) {
14
+ var _ref$eventData = _ref.eventData,
15
+ _ref$eventData$agent = _ref$eventData.agent,
16
+ agent = _ref$eventData$agent === void 0 ? {} : _ref$eventData$agent,
17
+ _ref$eventData$bookin = _ref$eventData.bookings,
18
+ bookings = _ref$eventData$bookin === void 0 ? [] : _ref$eventData$bookin,
19
+ _ref$eventData$chart = _ref$eventData.chart,
20
+ chart = _ref$eventData$chart === void 0 ? {} : _ref$eventData$chart,
21
+ _ref$eventData$loadin = _ref$eventData.loading,
22
+ loading = _ref$eventData$loadin === void 0 ? false : _ref$eventData$loadin,
23
+ notes = _ref$eventData.notes,
24
+ _ref$eventData$proper = _ref$eventData.property,
25
+ property = _ref$eventData$proper === void 0 ? {} : _ref$eventData$proper,
26
+ stats = _ref$eventData.stats;
27
+ return /* @__PURE__ */React.createElement(ui.Box, {
28
+ width: "100%"
29
+ }, /* @__PURE__ */React.createElement(ui.Grid, {
30
+ container: true,
31
+ spacing: 6
32
+ }, /* @__PURE__ */React.createElement(ui.Grid, {
33
+ item: true,
34
+ xs: 8
35
+ }, /* @__PURE__ */React.createElement(featureUi.PropertyCard, {
36
+ address: property.address,
37
+ imgSrc: property.imgSrc,
38
+ noOfBedrooms: property.noOfBedrooms,
39
+ noOfBathrooms: property.noOfBathrooms,
40
+ noOfCarparks: property.noOfCarparks,
41
+ rent: property.rent,
42
+ loading: loading,
43
+ compact: true,
44
+ outlined: true
45
+ })), /* @__PURE__ */React.createElement(ui.Grid, {
46
+ item: true,
47
+ xs: 4
48
+ }, /* @__PURE__ */React.createElement(ui.Paper, {
49
+ inset: "medium",
50
+ outlined: true,
51
+ sx: {
52
+ height: "100%"
53
+ }
54
+ }, /* @__PURE__ */React.createElement(featureUi.AgentDetailsCard, {
55
+ email: agent.email,
56
+ logo: agent.logo,
57
+ loading: loading,
58
+ name: agent.name,
59
+ phone: agent.phone
60
+ }))), stats && /* @__PURE__ */React.createElement(ui.Grid, {
61
+ item: true,
62
+ xs: 12,
63
+ sx: {
64
+ display: "flex",
65
+ gap: "36px",
66
+ justifyContent: "space-between"
67
+ }
68
+ }, /* @__PURE__ */React.createElement(featureUi.AnalyticsBox, {
69
+ outlined: true,
70
+ width: "100%",
71
+ height: "125px",
72
+ label: "Viewings",
73
+ amount: stats.viewingsCount || 0
74
+ }), /* @__PURE__ */React.createElement(featureUi.AnalyticsBox, {
75
+ outlined: true,
76
+ width: "100%",
77
+ height: "125px",
78
+ label: "Bookings",
79
+ amount: stats.bookingsCount || 0
80
+ }), /* @__PURE__ */React.createElement(featureUi.AnalyticsBox, {
81
+ outlined: true,
82
+ width: "100%",
83
+ height: "125px",
84
+ label: "Attended",
85
+ amount: stats.attendedBookingsCount || 0
86
+ }), /* @__PURE__ */React.createElement(featureUi.AnalyticsBox, {
87
+ outlined: true,
88
+ width: "100%",
89
+ height: "125px",
90
+ label: "Cancelled",
91
+ amount: stats.cancelledBookingsCount || 0
92
+ }), /* @__PURE__ */React.createElement(featureUi.AnalyticsBox, {
93
+ outlined: true,
94
+ width: "100%",
95
+ height: "125px",
96
+ label: "No-shows",
97
+ amount: stats.noShowBookingsCount || 0
98
+ }), /* @__PURE__ */React.createElement(featureUi.AnalyticsBox, {
99
+ outlined: true,
100
+ width: "100%",
101
+ height: "125px",
102
+ label: "Enquiries",
103
+ amount: stats.enquiriesCount || 0
104
+ }), /* @__PURE__ */React.createElement(featureUi.AnalyticsBox, {
105
+ outlined: true,
106
+ width: "100%",
107
+ height: "125px",
108
+ label: "Application numbers",
109
+ amount: stats.applicationsCount || 0
110
+ })), /* @__PURE__ */React.createElement(ui.Grid, {
111
+ item: true,
112
+ xs: 12
113
+ }, /* @__PURE__ */React.createElement(ui.Paper, {
114
+ inset: "medium",
115
+ sx: {
116
+ height: "100%"
117
+ },
118
+ outlined: true
119
+ }, /* @__PURE__ */React.createElement(featureUi.BookingChart, {
120
+ data: chart.data || [],
121
+ labels: chart.labels || []
122
+ }))), /* @__PURE__ */React.createElement(ui.Grid, {
123
+ item: true,
124
+ xs: 12
125
+ }, /* @__PURE__ */React.createElement(ui.Heading, {
126
+ as: "h4",
127
+ weight: "700",
128
+ sx: {
129
+ mb: "20px"
130
+ }
131
+ }, "Bookings"), /* @__PURE__ */React.createElement(featureUi.BookingTable, {
132
+ data: bookings,
133
+ loading: loading
134
+ })), /* @__PURE__ */React.createElement(ui.Grid, {
135
+ item: true,
136
+ xs: 12
137
+ }, /* @__PURE__ */React.createElement(ui.Heading, {
138
+ as: "h4",
139
+ weight: "700"
140
+ }, "Viewing notes")), loading && /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(ui.Grid, {
141
+ item: true,
142
+ xs: 6
143
+ }, /* @__PURE__ */React.createElement(featureUi.NotesCard, {
144
+ loading: true,
145
+ text: ""
146
+ })), /* @__PURE__ */React.createElement(ui.Grid, {
147
+ item: true,
148
+ xs: 6
149
+ }, /* @__PURE__ */React.createElement(featureUi.NotesCard, {
150
+ loading: true,
151
+ text: ""
152
+ })))), !loading && notes && notes.length && notes.map(function (_ref2, i) {
153
+ var label = _ref2.label,
154
+ data = _ref2.data;
155
+ return /* @__PURE__ */React.createElement(ui.Box, {
156
+ key: reactUid.uid({
157
+ label: label,
158
+ data: data
159
+ }, i),
160
+ mt: "15px"
161
+ }, /* @__PURE__ */React.createElement(ui.Grid, {
162
+ container: true,
163
+ xs: 12,
164
+ spacing: 4
165
+ }, /* @__PURE__ */React.createElement(ui.Grid, {
166
+ item: true,
167
+ xs: 12
168
+ }, /* @__PURE__ */React.createElement(ui.Text, {
169
+ variant: "body2",
170
+ weight: "600"
171
+ }, "Date Recorded: ", label)), data.map(function (_ref3, j) {
172
+ var tag = _ref3.tag,
173
+ text = _ref3.text;
174
+ return /* @__PURE__ */React.createElement(ui.Grid, {
175
+ item: true,
176
+ xs: 6,
177
+ key: reactUid.uid({
178
+ tag: tag,
179
+ text: text
180
+ }, j),
181
+ sx: {
182
+ breakInside: "avoid"
38
183
  }
39
- ) }),
40
- /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Paper, { inset: "medium", outlined: true, sx: { height: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(
41
- featureUi.AgentDetailsCard,
42
- {
43
- email: agent.email,
44
- logo: agent.logo,
45
- loading,
46
- name: agent.name,
47
- phone: agent.phone
48
- }
49
- ) }) }),
50
- stats && /* @__PURE__ */ jsxRuntime.jsxs(
51
- ui.Grid,
52
- {
53
- item: true,
54
- xs: 12,
55
- sx: {
56
- display: "flex",
57
- gap: "36px",
58
- justifyContent: "space-between"
59
- },
60
- children: [
61
- /* @__PURE__ */ jsxRuntime.jsx(
62
- featureUi.AnalyticsBox,
63
- {
64
- outlined: true,
65
- width: "100%",
66
- height: "125px",
67
- label: "Viewings",
68
- amount: stats.viewingsCount || 0
69
- }
70
- ),
71
- /* @__PURE__ */ jsxRuntime.jsx(
72
- featureUi.AnalyticsBox,
73
- {
74
- outlined: true,
75
- width: "100%",
76
- height: "125px",
77
- label: "Bookings",
78
- amount: stats.bookingsCount || 0
79
- }
80
- ),
81
- /* @__PURE__ */ jsxRuntime.jsx(
82
- featureUi.AnalyticsBox,
83
- {
84
- outlined: true,
85
- width: "100%",
86
- height: "125px",
87
- label: "Attended",
88
- amount: stats.attendedBookingsCount || 0
89
- }
90
- ),
91
- /* @__PURE__ */ jsxRuntime.jsx(
92
- featureUi.AnalyticsBox,
93
- {
94
- outlined: true,
95
- width: "100%",
96
- height: "125px",
97
- label: "Cancelled",
98
- amount: stats.cancelledBookingsCount || 0
99
- }
100
- ),
101
- /* @__PURE__ */ jsxRuntime.jsx(
102
- featureUi.AnalyticsBox,
103
- {
104
- outlined: true,
105
- width: "100%",
106
- height: "125px",
107
- label: "No-shows",
108
- amount: stats.noShowBookingsCount || 0
109
- }
110
- ),
111
- /* @__PURE__ */ jsxRuntime.jsx(
112
- featureUi.AnalyticsBox,
113
- {
114
- outlined: true,
115
- width: "100%",
116
- height: "125px",
117
- label: "Enquiries",
118
- amount: stats.enquiriesCount || 0
119
- }
120
- ),
121
- /* @__PURE__ */ jsxRuntime.jsx(
122
- featureUi.AnalyticsBox,
123
- {
124
- outlined: true,
125
- width: "100%",
126
- height: "125px",
127
- label: "Application numbers",
128
- amount: stats.applicationsCount || 0
129
- }
130
- )
131
- ]
132
- }
133
- ),
134
- /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Paper, { inset: "medium", sx: { height: "100%" }, outlined: true, children: /* @__PURE__ */ jsxRuntime.jsx(featureUi.BookingChart, { data: chart.data || [], labels: chart.labels || [] }) }) }),
135
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { item: true, xs: 12, children: [
136
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { as: "h4", weight: "700", sx: { mb: "20px" }, children: "Bookings" }),
137
- /* @__PURE__ */ jsxRuntime.jsx(featureUi.BookingTable, { data: bookings, loading })
138
- ] }),
139
- /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { as: "h4", weight: "700", children: "Viewing notes" }) }),
140
- loading && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
141
- /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 6, children: /* @__PURE__ */ jsxRuntime.jsx(featureUi.NotesCard, { loading: true, text: "" }) }),
142
- /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 6, children: /* @__PURE__ */ jsxRuntime.jsx(featureUi.NotesCard, { loading: true, text: "" }) })
143
- ] })
144
- ] }),
145
- !loading && notes && notes.length && notes.map(({ label, data }, i) => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { mt: "15px", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { container: true, xs: 12, spacing: 4, children: [
146
- /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { variant: "body2", weight: "600", children: [
147
- "Date Recorded: ",
148
- label
149
- ] }) }),
150
- data.map(({ tag, text }, j) => /* @__PURE__ */ jsxRuntime.jsx(
151
- ui.Grid,
152
- {
153
- item: true,
154
- xs: 6,
155
- sx: { breakInside: "avoid" },
156
- children: /* @__PURE__ */ jsxRuntime.jsx(featureUi.NotesCard, { tag, text, outlined: true })
157
- },
158
- reactUid.uid({ tag, text }, j)
159
- ))
160
- ] }) }, reactUid.uid({ label, data }, i))),
161
- footer
162
- ] });
184
+ }, /* @__PURE__ */React.createElement(featureUi.NotesCard, {
185
+ tag: tag,
186
+ text: text,
187
+ outlined: true
188
+ }));
189
+ })));
190
+ }));
163
191
  }
192
+ OwnerBookingReport.Header = ReportHeader.default;
193
+ OwnerBookingReport.Footer = ReportFooter.default;
164
194
 
165
195
  exports.default = OwnerBookingReport;
@@ -3,12 +3,20 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var jsxRuntime = require('react/jsx-runtime');
7
- require('react');
6
+ var React = require('react');
8
7
  var ui = require('@tenancy.nz/ui');
9
8
 
10
- function ReportFooter({ text }) {
11
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { mt: "24px", color: "#595959", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "div", variant: "body2", weight: "300", italic: true, children: text || "This PDF is for - purposes." }) });
9
+ function ReportFooter(_ref) {
10
+ var text = _ref.text;
11
+ return /* @__PURE__ */React.createElement(ui.Box, {
12
+ mt: "24px",
13
+ color: "#595959"
14
+ }, /* @__PURE__ */React.createElement(ui.Text, {
15
+ as: "div",
16
+ variant: "body2",
17
+ weight: "300",
18
+ italic: true
19
+ }, text || "This PDF is for - purposes."));
12
20
  }
13
21
 
14
22
  exports.default = ReportFooter;
@@ -3,35 +3,53 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var jsxRuntime = require('react/jsx-runtime');
7
- require('react');
6
+ var React = require('react');
8
7
  var ui = require('@tenancy.nz/ui');
9
8
 
10
- function ReportHeader({
11
- heading,
12
- subheading = void 0,
13
- logo
14
- }) {
15
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { mb: "24px", borderBottom: "1px solid #E0E0E0", paddingBottom: "8px", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { container: true, spacing: 6, children: [
16
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { item: true, xs: 8, children: [
17
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { as: "h1", weight: "700", sx: { mb: "8px" }, children: heading }),
18
- subheading && /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { as: "h5", weight: "500", children: subheading })
19
- ] }),
20
- /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 4, sx: { display: "flex", justifyContent: "flex-end" }, children: logo && /* @__PURE__ */ jsxRuntime.jsx(
21
- ui.Box,
22
- {
23
- sx: {
24
- width: "150px",
25
- height: "35px",
26
- "> img": {
27
- maxWidth: "100%",
28
- maxHeight: "100%"
29
- }
30
- },
31
- children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: logo, alt: "Tenancy" })
9
+ function ReportHeader(_ref) {
10
+ var heading = _ref.heading,
11
+ _ref$subheading = _ref.subheading,
12
+ subheading = _ref$subheading === void 0 ? void 0 : _ref$subheading,
13
+ logo = _ref.logo;
14
+ return /* @__PURE__ */React.createElement(ui.Box, {
15
+ mb: "24px",
16
+ borderBottom: "1px solid #E0E0E0",
17
+ paddingBottom: "8px"
18
+ }, /* @__PURE__ */React.createElement(ui.Grid, {
19
+ container: true,
20
+ spacing: 6
21
+ }, /* @__PURE__ */React.createElement(ui.Grid, {
22
+ item: true,
23
+ xs: 8
24
+ }, /* @__PURE__ */React.createElement(ui.Heading, {
25
+ as: "h1",
26
+ weight: "700",
27
+ sx: {
28
+ mb: "8px"
29
+ }
30
+ }, heading), subheading && /* @__PURE__ */React.createElement(ui.Heading, {
31
+ as: "h5",
32
+ weight: "500"
33
+ }, subheading)), /* @__PURE__ */React.createElement(ui.Grid, {
34
+ item: true,
35
+ xs: 4,
36
+ sx: {
37
+ display: "flex",
38
+ justifyContent: "flex-end"
39
+ }
40
+ }, logo && /* @__PURE__ */React.createElement(ui.Box, {
41
+ sx: {
42
+ width: "150px",
43
+ height: "35px",
44
+ "> img": {
45
+ maxWidth: "100%",
46
+ maxHeight: "100%"
32
47
  }
33
- ) })
34
- ] }) });
48
+ }
49
+ }, /* @__PURE__ */React.createElement("img", {
50
+ src: logo,
51
+ alt: "Tenancy"
52
+ })))));
35
53
  }
36
54
 
37
55
  exports.default = ReportHeader;
@@ -3,88 +3,96 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var jsxRuntime = require('react/jsx-runtime');
7
6
  var ui = require('@tenancy.nz/ui');
8
7
  var featureUi = require('@tenancy.nz/feature-ui');
9
8
 
10
- function ViewingAnalyticsReport({ eventData }) {
11
- const stats = eventData.stats || {};
12
- const properties = eventData.properties || [];
13
- return /* @__PURE__ */ jsxRuntime.jsx(ui.ThemeProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { padding: "20px", children: [
14
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { mb: 6, display: "flex", justify: "space-between", align: "start", children: [
15
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { variant: "h1", as: "h1", gutterBottom: false, children: "Analytics Report" }) }),
16
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { display: "flex", align: "flex-end", direction: "column", children: [
17
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { mt: 2, children: [
18
- eventData.fromDate && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
19
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "700", as: "span", display: "inline", children: "Report Range From" }),
20
- " ",
21
- eventData.fromDate,
22
- " "
23
- ] }),
24
- eventData.toDate && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
25
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "700", as: "span", display: "inline", children: "To" }),
26
- " ",
27
- eventData.toDate
28
- ] })
29
- ] }),
30
- eventData.viewingAgent && /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { color: "textPrimary", weight: "700", fontSize: 12, children: [
31
- "Viewing agent:",
32
- " ",
33
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "400", as: "span", display: "inline", children: eventData.viewingAgent })
34
- ] }),
35
- eventData.propertyAgent && /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { color: "textPrimary", weight: "700", fontSize: 12, children: [
36
- "Property agent:",
37
- " ",
38
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "400", as: "span", display: "inline", children: eventData.propertyAgent })
39
- ] })
40
- ] })
41
- ] }),
42
- /* @__PURE__ */ jsxRuntime.jsx(
43
- featureUi.AnalyticsSection,
44
- {
45
- viewingsCount: stats.viewings_count,
46
- bookingsCount: stats.bookings_count,
47
- attendeesCount: stats.viewing_attendees_count,
48
- cancellationsCount: stats.bookings_cancelled_count,
49
- applicationsCount: stats.applications_count,
50
- averageRent: stats.avg_rent,
51
- textUsage: stats.sent_sms_count,
52
- tradeMeEnquiriesCount: stats.trademe_enquiries_count,
53
- bookMeEnquiriesCount: stats.bookme_enquiries_count,
54
- manualEnquiryCount: stats.enquiries_count,
55
- agreementsCount: stats.agreements_count,
56
- agreementsFinalisedCount: stats.agreements_finalised_count,
57
- filterDaysCount: eventData.filterDaysCount
58
- }
59
- ),
60
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { children: [
61
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { variant: "h4", as: "h4", mt: "20px", gutterBottom: false, children: "Top 5 properties" }),
62
- /* @__PURE__ */ jsxRuntime.jsx(
63
- featureUi.GridList,
64
- {
65
- mt: "20px",
66
- items: properties,
67
- spacing: 5,
68
- emptyComponent: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "No results to show" }),
69
- renderItem: (property) => /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
70
- featureUi.PropertyCard,
71
- {
72
- propertyAddress: property.short_address,
73
- listingDate: "",
74
- daysOnMarket: "",
75
- weeklyRent: property.rent_amount,
76
- viewingsCount: property.viewings_count,
77
- enquiriesCount: property.enquiries_count,
78
- propertyImage: property.thumb_url,
79
- beds: property.num_bedrooms,
80
- baths: property.num_bathrooms,
81
- carports: property.num_cars
82
- }
83
- ) })
84
- }
85
- )
86
- ] })
87
- ] }) });
9
+ function ViewingAnalyticsReport(_ref) {
10
+ var eventData = _ref.eventData;
11
+ var stats = eventData.stats || {};
12
+ var properties = eventData.properties || [];
13
+ return /* @__PURE__ */React.createElement(ui.ThemeProvider, null, /* @__PURE__ */React.createElement(ui.Box, {
14
+ padding: "20px"
15
+ }, /* @__PURE__ */React.createElement(ui.Box, {
16
+ mb: 6,
17
+ display: "flex",
18
+ justify: "space-between",
19
+ align: "start"
20
+ }, /* @__PURE__ */React.createElement(ui.Box, null, /* @__PURE__ */React.createElement(ui.Heading, {
21
+ variant: "h1",
22
+ as: "h1",
23
+ gutterBottom: false
24
+ }, "Analytics Report")), /* @__PURE__ */React.createElement(ui.Box, {
25
+ display: "flex",
26
+ align: "flex-end",
27
+ direction: "column"
28
+ }, /* @__PURE__ */React.createElement(ui.Text, {
29
+ mt: 2
30
+ }, eventData.fromDate && /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(ui.Text, {
31
+ weight: "700",
32
+ as: "span",
33
+ display: "inline"
34
+ }, "Report Range From"), " ", eventData.fromDate, " "), eventData.toDate && /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(ui.Text, {
35
+ weight: "700",
36
+ as: "span",
37
+ display: "inline"
38
+ }, "To"), " ", eventData.toDate)), eventData.viewingAgent && /* @__PURE__ */React.createElement(ui.Text, {
39
+ color: "textPrimary",
40
+ weight: "700",
41
+ fontSize: 12
42
+ }, "Viewing agent:", " ", /* @__PURE__ */React.createElement(ui.Text, {
43
+ weight: "400",
44
+ as: "span",
45
+ display: "inline"
46
+ }, eventData.viewingAgent)), eventData.propertyAgent && /* @__PURE__ */React.createElement(ui.Text, {
47
+ color: "textPrimary",
48
+ weight: "700",
49
+ fontSize: 12
50
+ }, "Property agent:", " ", /* @__PURE__ */React.createElement(ui.Text, {
51
+ weight: "400",
52
+ as: "span",
53
+ display: "inline"
54
+ }, eventData.propertyAgent)))), /* @__PURE__ */React.createElement(featureUi.AnalyticsSection, {
55
+ viewingsCount: stats.viewings_count,
56
+ bookingsCount: stats.bookings_count,
57
+ attendeesCount: stats.viewing_attendees_count,
58
+ cancellationsCount: stats.bookings_cancelled_count,
59
+ applicationsCount: stats.applications_count,
60
+ averageRent: stats.avg_rent,
61
+ textUsage: stats.sent_sms_count,
62
+ tradeMeEnquiriesCount: stats.trademe_enquiries_count,
63
+ bookMeEnquiriesCount: stats.bookme_enquiries_count,
64
+ manualEnquiryCount: stats.enquiries_count,
65
+ agreementsCount: stats.agreements_count,
66
+ agreementsFinalisedCount: stats.agreements_finalised_count,
67
+ filterDaysCount: eventData.filterDaysCount
68
+ }), /* @__PURE__ */React.createElement(ui.Box, null, /* @__PURE__ */React.createElement(ui.Heading, {
69
+ variant: "h4",
70
+ as: "h4",
71
+ mt: "20px",
72
+ gutterBottom: false
73
+ }, "Top 5 properties"), /* @__PURE__ */React.createElement(featureUi.GridList, {
74
+ mt: "20px",
75
+ items: properties,
76
+ spacing: 5,
77
+ emptyComponent: /* @__PURE__ */React.createElement(ui.Text, null, "No results to show"),
78
+ renderItem: function renderItem(property) {
79
+ return /* @__PURE__ */React.createElement(ui.Grid, {
80
+ item: true,
81
+ xs: 12
82
+ }, /* @__PURE__ */React.createElement(featureUi.PropertyCard, {
83
+ propertyAddress: property.short_address,
84
+ listingDate: "",
85
+ daysOnMarket: "",
86
+ weeklyRent: property.rent_amount,
87
+ viewingsCount: property.viewings_count,
88
+ enquiriesCount: property.enquiries_count,
89
+ propertyImage: property.thumb_url,
90
+ beds: property.num_bedrooms,
91
+ baths: property.num_bathrooms,
92
+ carports: property.num_cars
93
+ }));
94
+ }
95
+ }))));
88
96
  }
89
97
 
90
98
  exports.default = ViewingAnalyticsReport;
@@ -1,161 +1,191 @@
1
1
  "use strict";
2
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
- import 'react';
2
+ import React from 'react';
4
3
  import { uid } from 'react-uid';
5
4
  import { Box, Grid, Paper, Heading, Text } from '@tenancy.nz/ui';
6
5
  import { PropertyCard, AgentDetailsCard, AnalyticsBox, BookingChart, BookingTable, NotesCard } from '@tenancy.nz/feature-ui';
6
+ import ReportHeader from './ReportHeader.js';
7
+ import ReportFooter from './ReportFooter.js';
7
8
 
8
- function OwnerBookingReport({
9
- agent = {},
10
- bookings = [],
11
- chart = {},
12
- footer = void 0,
13
- header = void 0,
14
- loading = false,
15
- notes,
16
- property = {},
17
- stats
18
- }) {
19
- return /* @__PURE__ */ jsxs(Box, { width: "100%", children: [
20
- header,
21
- /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 6, children: [
22
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 8, children: /* @__PURE__ */ jsx(
23
- PropertyCard,
24
- {
25
- address: property.address,
26
- imgSrc: property.imgSrc,
27
- noOfBedrooms: property.noOfBedrooms,
28
- noOfBathrooms: property.noOfBathrooms,
29
- noOfCarparks: property.noOfCarparks,
30
- rent: property.rent,
31
- loading,
32
- compact: true,
33
- outlined: true
9
+ function OwnerBookingReport(_ref) {
10
+ var _ref$eventData = _ref.eventData,
11
+ _ref$eventData$agent = _ref$eventData.agent,
12
+ agent = _ref$eventData$agent === void 0 ? {} : _ref$eventData$agent,
13
+ _ref$eventData$bookin = _ref$eventData.bookings,
14
+ bookings = _ref$eventData$bookin === void 0 ? [] : _ref$eventData$bookin,
15
+ _ref$eventData$chart = _ref$eventData.chart,
16
+ chart = _ref$eventData$chart === void 0 ? {} : _ref$eventData$chart,
17
+ _ref$eventData$loadin = _ref$eventData.loading,
18
+ loading = _ref$eventData$loadin === void 0 ? false : _ref$eventData$loadin,
19
+ notes = _ref$eventData.notes,
20
+ _ref$eventData$proper = _ref$eventData.property,
21
+ property = _ref$eventData$proper === void 0 ? {} : _ref$eventData$proper,
22
+ stats = _ref$eventData.stats;
23
+ return /* @__PURE__ */React.createElement(Box, {
24
+ width: "100%"
25
+ }, /* @__PURE__ */React.createElement(Grid, {
26
+ container: true,
27
+ spacing: 6
28
+ }, /* @__PURE__ */React.createElement(Grid, {
29
+ item: true,
30
+ xs: 8
31
+ }, /* @__PURE__ */React.createElement(PropertyCard, {
32
+ address: property.address,
33
+ imgSrc: property.imgSrc,
34
+ noOfBedrooms: property.noOfBedrooms,
35
+ noOfBathrooms: property.noOfBathrooms,
36
+ noOfCarparks: property.noOfCarparks,
37
+ rent: property.rent,
38
+ loading: loading,
39
+ compact: true,
40
+ outlined: true
41
+ })), /* @__PURE__ */React.createElement(Grid, {
42
+ item: true,
43
+ xs: 4
44
+ }, /* @__PURE__ */React.createElement(Paper, {
45
+ inset: "medium",
46
+ outlined: true,
47
+ sx: {
48
+ height: "100%"
49
+ }
50
+ }, /* @__PURE__ */React.createElement(AgentDetailsCard, {
51
+ email: agent.email,
52
+ logo: agent.logo,
53
+ loading: loading,
54
+ name: agent.name,
55
+ phone: agent.phone
56
+ }))), stats && /* @__PURE__ */React.createElement(Grid, {
57
+ item: true,
58
+ xs: 12,
59
+ sx: {
60
+ display: "flex",
61
+ gap: "36px",
62
+ justifyContent: "space-between"
63
+ }
64
+ }, /* @__PURE__ */React.createElement(AnalyticsBox, {
65
+ outlined: true,
66
+ width: "100%",
67
+ height: "125px",
68
+ label: "Viewings",
69
+ amount: stats.viewingsCount || 0
70
+ }), /* @__PURE__ */React.createElement(AnalyticsBox, {
71
+ outlined: true,
72
+ width: "100%",
73
+ height: "125px",
74
+ label: "Bookings",
75
+ amount: stats.bookingsCount || 0
76
+ }), /* @__PURE__ */React.createElement(AnalyticsBox, {
77
+ outlined: true,
78
+ width: "100%",
79
+ height: "125px",
80
+ label: "Attended",
81
+ amount: stats.attendedBookingsCount || 0
82
+ }), /* @__PURE__ */React.createElement(AnalyticsBox, {
83
+ outlined: true,
84
+ width: "100%",
85
+ height: "125px",
86
+ label: "Cancelled",
87
+ amount: stats.cancelledBookingsCount || 0
88
+ }), /* @__PURE__ */React.createElement(AnalyticsBox, {
89
+ outlined: true,
90
+ width: "100%",
91
+ height: "125px",
92
+ label: "No-shows",
93
+ amount: stats.noShowBookingsCount || 0
94
+ }), /* @__PURE__ */React.createElement(AnalyticsBox, {
95
+ outlined: true,
96
+ width: "100%",
97
+ height: "125px",
98
+ label: "Enquiries",
99
+ amount: stats.enquiriesCount || 0
100
+ }), /* @__PURE__ */React.createElement(AnalyticsBox, {
101
+ outlined: true,
102
+ width: "100%",
103
+ height: "125px",
104
+ label: "Application numbers",
105
+ amount: stats.applicationsCount || 0
106
+ })), /* @__PURE__ */React.createElement(Grid, {
107
+ item: true,
108
+ xs: 12
109
+ }, /* @__PURE__ */React.createElement(Paper, {
110
+ inset: "medium",
111
+ sx: {
112
+ height: "100%"
113
+ },
114
+ outlined: true
115
+ }, /* @__PURE__ */React.createElement(BookingChart, {
116
+ data: chart.data || [],
117
+ labels: chart.labels || []
118
+ }))), /* @__PURE__ */React.createElement(Grid, {
119
+ item: true,
120
+ xs: 12
121
+ }, /* @__PURE__ */React.createElement(Heading, {
122
+ as: "h4",
123
+ weight: "700",
124
+ sx: {
125
+ mb: "20px"
126
+ }
127
+ }, "Bookings"), /* @__PURE__ */React.createElement(BookingTable, {
128
+ data: bookings,
129
+ loading: loading
130
+ })), /* @__PURE__ */React.createElement(Grid, {
131
+ item: true,
132
+ xs: 12
133
+ }, /* @__PURE__ */React.createElement(Heading, {
134
+ as: "h4",
135
+ weight: "700"
136
+ }, "Viewing notes")), loading && /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(Grid, {
137
+ item: true,
138
+ xs: 6
139
+ }, /* @__PURE__ */React.createElement(NotesCard, {
140
+ loading: true,
141
+ text: ""
142
+ })), /* @__PURE__ */React.createElement(Grid, {
143
+ item: true,
144
+ xs: 6
145
+ }, /* @__PURE__ */React.createElement(NotesCard, {
146
+ loading: true,
147
+ text: ""
148
+ })))), !loading && notes && notes.length && notes.map(function (_ref2, i) {
149
+ var label = _ref2.label,
150
+ data = _ref2.data;
151
+ return /* @__PURE__ */React.createElement(Box, {
152
+ key: uid({
153
+ label: label,
154
+ data: data
155
+ }, i),
156
+ mt: "15px"
157
+ }, /* @__PURE__ */React.createElement(Grid, {
158
+ container: true,
159
+ xs: 12,
160
+ spacing: 4
161
+ }, /* @__PURE__ */React.createElement(Grid, {
162
+ item: true,
163
+ xs: 12
164
+ }, /* @__PURE__ */React.createElement(Text, {
165
+ variant: "body2",
166
+ weight: "600"
167
+ }, "Date Recorded: ", label)), data.map(function (_ref3, j) {
168
+ var tag = _ref3.tag,
169
+ text = _ref3.text;
170
+ return /* @__PURE__ */React.createElement(Grid, {
171
+ item: true,
172
+ xs: 6,
173
+ key: uid({
174
+ tag: tag,
175
+ text: text
176
+ }, j),
177
+ sx: {
178
+ breakInside: "avoid"
34
179
  }
35
- ) }),
36
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(Paper, { inset: "medium", outlined: true, sx: { height: "100%" }, children: /* @__PURE__ */ jsx(
37
- AgentDetailsCard,
38
- {
39
- email: agent.email,
40
- logo: agent.logo,
41
- loading,
42
- name: agent.name,
43
- phone: agent.phone
44
- }
45
- ) }) }),
46
- stats && /* @__PURE__ */ jsxs(
47
- Grid,
48
- {
49
- item: true,
50
- xs: 12,
51
- sx: {
52
- display: "flex",
53
- gap: "36px",
54
- justifyContent: "space-between"
55
- },
56
- children: [
57
- /* @__PURE__ */ jsx(
58
- AnalyticsBox,
59
- {
60
- outlined: true,
61
- width: "100%",
62
- height: "125px",
63
- label: "Viewings",
64
- amount: stats.viewingsCount || 0
65
- }
66
- ),
67
- /* @__PURE__ */ jsx(
68
- AnalyticsBox,
69
- {
70
- outlined: true,
71
- width: "100%",
72
- height: "125px",
73
- label: "Bookings",
74
- amount: stats.bookingsCount || 0
75
- }
76
- ),
77
- /* @__PURE__ */ jsx(
78
- AnalyticsBox,
79
- {
80
- outlined: true,
81
- width: "100%",
82
- height: "125px",
83
- label: "Attended",
84
- amount: stats.attendedBookingsCount || 0
85
- }
86
- ),
87
- /* @__PURE__ */ jsx(
88
- AnalyticsBox,
89
- {
90
- outlined: true,
91
- width: "100%",
92
- height: "125px",
93
- label: "Cancelled",
94
- amount: stats.cancelledBookingsCount || 0
95
- }
96
- ),
97
- /* @__PURE__ */ jsx(
98
- AnalyticsBox,
99
- {
100
- outlined: true,
101
- width: "100%",
102
- height: "125px",
103
- label: "No-shows",
104
- amount: stats.noShowBookingsCount || 0
105
- }
106
- ),
107
- /* @__PURE__ */ jsx(
108
- AnalyticsBox,
109
- {
110
- outlined: true,
111
- width: "100%",
112
- height: "125px",
113
- label: "Enquiries",
114
- amount: stats.enquiriesCount || 0
115
- }
116
- ),
117
- /* @__PURE__ */ jsx(
118
- AnalyticsBox,
119
- {
120
- outlined: true,
121
- width: "100%",
122
- height: "125px",
123
- label: "Application numbers",
124
- amount: stats.applicationsCount || 0
125
- }
126
- )
127
- ]
128
- }
129
- ),
130
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Paper, { inset: "medium", sx: { height: "100%" }, outlined: true, children: /* @__PURE__ */ jsx(BookingChart, { data: chart.data || [], labels: chart.labels || [] }) }) }),
131
- /* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
132
- /* @__PURE__ */ jsx(Heading, { as: "h4", weight: "700", sx: { mb: "20px" }, children: "Bookings" }),
133
- /* @__PURE__ */ jsx(BookingTable, { data: bookings, loading })
134
- ] }),
135
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Heading, { as: "h4", weight: "700", children: "Viewing notes" }) }),
136
- loading && /* @__PURE__ */ jsxs(Fragment, { children: [
137
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 6, children: /* @__PURE__ */ jsx(NotesCard, { loading: true, text: "" }) }),
138
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 6, children: /* @__PURE__ */ jsx(NotesCard, { loading: true, text: "" }) })
139
- ] })
140
- ] }),
141
- !loading && notes && notes.length && notes.map(({ label, data }, i) => /* @__PURE__ */ jsx(Box, { mt: "15px", children: /* @__PURE__ */ jsxs(Grid, { container: true, xs: 12, spacing: 4, children: [
142
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxs(Text, { variant: "body2", weight: "600", children: [
143
- "Date Recorded: ",
144
- label
145
- ] }) }),
146
- data.map(({ tag, text }, j) => /* @__PURE__ */ jsx(
147
- Grid,
148
- {
149
- item: true,
150
- xs: 6,
151
- sx: { breakInside: "avoid" },
152
- children: /* @__PURE__ */ jsx(NotesCard, { tag, text, outlined: true })
153
- },
154
- uid({ tag, text }, j)
155
- ))
156
- ] }) }, uid({ label, data }, i))),
157
- footer
158
- ] });
180
+ }, /* @__PURE__ */React.createElement(NotesCard, {
181
+ tag: tag,
182
+ text: text,
183
+ outlined: true
184
+ }));
185
+ })));
186
+ }));
159
187
  }
188
+ OwnerBookingReport.Header = ReportHeader;
189
+ OwnerBookingReport.Footer = ReportFooter;
160
190
 
161
191
  export { OwnerBookingReport as default };
@@ -1,10 +1,18 @@
1
1
  "use strict";
2
- import { jsx } from 'react/jsx-runtime';
3
- import 'react';
2
+ import React from 'react';
4
3
  import { Box, Text } from '@tenancy.nz/ui';
5
4
 
6
- function ReportFooter({ text }) {
7
- return /* @__PURE__ */ jsx(Box, { mt: "24px", color: "#595959", children: /* @__PURE__ */ jsx(Text, { as: "div", variant: "body2", weight: "300", italic: true, children: text || "This PDF is for - purposes." }) });
5
+ function ReportFooter(_ref) {
6
+ var text = _ref.text;
7
+ return /* @__PURE__ */React.createElement(Box, {
8
+ mt: "24px",
9
+ color: "#595959"
10
+ }, /* @__PURE__ */React.createElement(Text, {
11
+ as: "div",
12
+ variant: "body2",
13
+ weight: "300",
14
+ italic: true
15
+ }, text || "This PDF is for - purposes."));
8
16
  }
9
17
 
10
18
  export { ReportFooter as default };
@@ -1,33 +1,51 @@
1
1
  "use strict";
2
- import { jsx, jsxs } from 'react/jsx-runtime';
3
- import 'react';
2
+ import React from 'react';
4
3
  import { Box, Grid, Heading } from '@tenancy.nz/ui';
5
4
 
6
- function ReportHeader({
7
- heading,
8
- subheading = void 0,
9
- logo
10
- }) {
11
- return /* @__PURE__ */ jsx(Box, { mb: "24px", borderBottom: "1px solid #E0E0E0", paddingBottom: "8px", children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 6, children: [
12
- /* @__PURE__ */ jsxs(Grid, { item: true, xs: 8, children: [
13
- /* @__PURE__ */ jsx(Heading, { as: "h1", weight: "700", sx: { mb: "8px" }, children: heading }),
14
- subheading && /* @__PURE__ */ jsx(Heading, { as: "h5", weight: "500", children: subheading })
15
- ] }),
16
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, sx: { display: "flex", justifyContent: "flex-end" }, children: logo && /* @__PURE__ */ jsx(
17
- Box,
18
- {
19
- sx: {
20
- width: "150px",
21
- height: "35px",
22
- "> img": {
23
- maxWidth: "100%",
24
- maxHeight: "100%"
25
- }
26
- },
27
- children: /* @__PURE__ */ jsx("img", { src: logo, alt: "Tenancy" })
5
+ function ReportHeader(_ref) {
6
+ var heading = _ref.heading,
7
+ _ref$subheading = _ref.subheading,
8
+ subheading = _ref$subheading === void 0 ? void 0 : _ref$subheading,
9
+ logo = _ref.logo;
10
+ return /* @__PURE__ */React.createElement(Box, {
11
+ mb: "24px",
12
+ borderBottom: "1px solid #E0E0E0",
13
+ paddingBottom: "8px"
14
+ }, /* @__PURE__ */React.createElement(Grid, {
15
+ container: true,
16
+ spacing: 6
17
+ }, /* @__PURE__ */React.createElement(Grid, {
18
+ item: true,
19
+ xs: 8
20
+ }, /* @__PURE__ */React.createElement(Heading, {
21
+ as: "h1",
22
+ weight: "700",
23
+ sx: {
24
+ mb: "8px"
25
+ }
26
+ }, heading), subheading && /* @__PURE__ */React.createElement(Heading, {
27
+ as: "h5",
28
+ weight: "500"
29
+ }, subheading)), /* @__PURE__ */React.createElement(Grid, {
30
+ item: true,
31
+ xs: 4,
32
+ sx: {
33
+ display: "flex",
34
+ justifyContent: "flex-end"
35
+ }
36
+ }, logo && /* @__PURE__ */React.createElement(Box, {
37
+ sx: {
38
+ width: "150px",
39
+ height: "35px",
40
+ "> img": {
41
+ maxWidth: "100%",
42
+ maxHeight: "100%"
28
43
  }
29
- ) })
30
- ] }) });
44
+ }
45
+ }, /* @__PURE__ */React.createElement("img", {
46
+ src: logo,
47
+ alt: "Tenancy"
48
+ })))));
31
49
  }
32
50
 
33
51
  export { ReportHeader as default };
@@ -1,86 +1,94 @@
1
1
  "use strict";
2
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
2
  import { ThemeProvider, Box, Heading, Text, Grid } from '@tenancy.nz/ui';
4
3
  import { AnalyticsSection, GridList, PropertyCard } from '@tenancy.nz/feature-ui';
5
4
 
6
- function ViewingAnalyticsReport({ eventData }) {
7
- const stats = eventData.stats || {};
8
- const properties = eventData.properties || [];
9
- return /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsxs(Box, { padding: "20px", children: [
10
- /* @__PURE__ */ jsxs(Box, { mb: 6, display: "flex", justify: "space-between", align: "start", children: [
11
- /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Heading, { variant: "h1", as: "h1", gutterBottom: false, children: "Analytics Report" }) }),
12
- /* @__PURE__ */ jsxs(Box, { display: "flex", align: "flex-end", direction: "column", children: [
13
- /* @__PURE__ */ jsxs(Text, { mt: 2, children: [
14
- eventData.fromDate && /* @__PURE__ */ jsxs(Fragment, { children: [
15
- /* @__PURE__ */ jsx(Text, { weight: "700", as: "span", display: "inline", children: "Report Range From" }),
16
- " ",
17
- eventData.fromDate,
18
- " "
19
- ] }),
20
- eventData.toDate && /* @__PURE__ */ jsxs(Fragment, { children: [
21
- /* @__PURE__ */ jsx(Text, { weight: "700", as: "span", display: "inline", children: "To" }),
22
- " ",
23
- eventData.toDate
24
- ] })
25
- ] }),
26
- eventData.viewingAgent && /* @__PURE__ */ jsxs(Text, { color: "textPrimary", weight: "700", fontSize: 12, children: [
27
- "Viewing agent:",
28
- " ",
29
- /* @__PURE__ */ jsx(Text, { weight: "400", as: "span", display: "inline", children: eventData.viewingAgent })
30
- ] }),
31
- eventData.propertyAgent && /* @__PURE__ */ jsxs(Text, { color: "textPrimary", weight: "700", fontSize: 12, children: [
32
- "Property agent:",
33
- " ",
34
- /* @__PURE__ */ jsx(Text, { weight: "400", as: "span", display: "inline", children: eventData.propertyAgent })
35
- ] })
36
- ] })
37
- ] }),
38
- /* @__PURE__ */ jsx(
39
- AnalyticsSection,
40
- {
41
- viewingsCount: stats.viewings_count,
42
- bookingsCount: stats.bookings_count,
43
- attendeesCount: stats.viewing_attendees_count,
44
- cancellationsCount: stats.bookings_cancelled_count,
45
- applicationsCount: stats.applications_count,
46
- averageRent: stats.avg_rent,
47
- textUsage: stats.sent_sms_count,
48
- tradeMeEnquiriesCount: stats.trademe_enquiries_count,
49
- bookMeEnquiriesCount: stats.bookme_enquiries_count,
50
- manualEnquiryCount: stats.enquiries_count,
51
- agreementsCount: stats.agreements_count,
52
- agreementsFinalisedCount: stats.agreements_finalised_count,
53
- filterDaysCount: eventData.filterDaysCount
54
- }
55
- ),
56
- /* @__PURE__ */ jsxs(Box, { children: [
57
- /* @__PURE__ */ jsx(Heading, { variant: "h4", as: "h4", mt: "20px", gutterBottom: false, children: "Top 5 properties" }),
58
- /* @__PURE__ */ jsx(
59
- GridList,
60
- {
61
- mt: "20px",
62
- items: properties,
63
- spacing: 5,
64
- emptyComponent: /* @__PURE__ */ jsx(Text, { children: "No results to show" }),
65
- renderItem: (property) => /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
66
- PropertyCard,
67
- {
68
- propertyAddress: property.short_address,
69
- listingDate: "",
70
- daysOnMarket: "",
71
- weeklyRent: property.rent_amount,
72
- viewingsCount: property.viewings_count,
73
- enquiriesCount: property.enquiries_count,
74
- propertyImage: property.thumb_url,
75
- beds: property.num_bedrooms,
76
- baths: property.num_bathrooms,
77
- carports: property.num_cars
78
- }
79
- ) })
80
- }
81
- )
82
- ] })
83
- ] }) });
5
+ function ViewingAnalyticsReport(_ref) {
6
+ var eventData = _ref.eventData;
7
+ var stats = eventData.stats || {};
8
+ var properties = eventData.properties || [];
9
+ return /* @__PURE__ */React.createElement(ThemeProvider, null, /* @__PURE__ */React.createElement(Box, {
10
+ padding: "20px"
11
+ }, /* @__PURE__ */React.createElement(Box, {
12
+ mb: 6,
13
+ display: "flex",
14
+ justify: "space-between",
15
+ align: "start"
16
+ }, /* @__PURE__ */React.createElement(Box, null, /* @__PURE__ */React.createElement(Heading, {
17
+ variant: "h1",
18
+ as: "h1",
19
+ gutterBottom: false
20
+ }, "Analytics Report")), /* @__PURE__ */React.createElement(Box, {
21
+ display: "flex",
22
+ align: "flex-end",
23
+ direction: "column"
24
+ }, /* @__PURE__ */React.createElement(Text, {
25
+ mt: 2
26
+ }, eventData.fromDate && /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(Text, {
27
+ weight: "700",
28
+ as: "span",
29
+ display: "inline"
30
+ }, "Report Range From"), " ", eventData.fromDate, " "), eventData.toDate && /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(Text, {
31
+ weight: "700",
32
+ as: "span",
33
+ display: "inline"
34
+ }, "To"), " ", eventData.toDate)), eventData.viewingAgent && /* @__PURE__ */React.createElement(Text, {
35
+ color: "textPrimary",
36
+ weight: "700",
37
+ fontSize: 12
38
+ }, "Viewing agent:", " ", /* @__PURE__ */React.createElement(Text, {
39
+ weight: "400",
40
+ as: "span",
41
+ display: "inline"
42
+ }, eventData.viewingAgent)), eventData.propertyAgent && /* @__PURE__ */React.createElement(Text, {
43
+ color: "textPrimary",
44
+ weight: "700",
45
+ fontSize: 12
46
+ }, "Property agent:", " ", /* @__PURE__ */React.createElement(Text, {
47
+ weight: "400",
48
+ as: "span",
49
+ display: "inline"
50
+ }, eventData.propertyAgent)))), /* @__PURE__ */React.createElement(AnalyticsSection, {
51
+ viewingsCount: stats.viewings_count,
52
+ bookingsCount: stats.bookings_count,
53
+ attendeesCount: stats.viewing_attendees_count,
54
+ cancellationsCount: stats.bookings_cancelled_count,
55
+ applicationsCount: stats.applications_count,
56
+ averageRent: stats.avg_rent,
57
+ textUsage: stats.sent_sms_count,
58
+ tradeMeEnquiriesCount: stats.trademe_enquiries_count,
59
+ bookMeEnquiriesCount: stats.bookme_enquiries_count,
60
+ manualEnquiryCount: stats.enquiries_count,
61
+ agreementsCount: stats.agreements_count,
62
+ agreementsFinalisedCount: stats.agreements_finalised_count,
63
+ filterDaysCount: eventData.filterDaysCount
64
+ }), /* @__PURE__ */React.createElement(Box, null, /* @__PURE__ */React.createElement(Heading, {
65
+ variant: "h4",
66
+ as: "h4",
67
+ mt: "20px",
68
+ gutterBottom: false
69
+ }, "Top 5 properties"), /* @__PURE__ */React.createElement(GridList, {
70
+ mt: "20px",
71
+ items: properties,
72
+ spacing: 5,
73
+ emptyComponent: /* @__PURE__ */React.createElement(Text, null, "No results to show"),
74
+ renderItem: function renderItem(property) {
75
+ return /* @__PURE__ */React.createElement(Grid, {
76
+ item: true,
77
+ xs: 12
78
+ }, /* @__PURE__ */React.createElement(PropertyCard, {
79
+ propertyAddress: property.short_address,
80
+ listingDate: "",
81
+ daysOnMarket: "",
82
+ weeklyRent: property.rent_amount,
83
+ viewingsCount: property.viewings_count,
84
+ enquiriesCount: property.enquiries_count,
85
+ propertyImage: property.thumb_url,
86
+ beds: property.num_bedrooms,
87
+ baths: property.num_bathrooms,
88
+ carports: property.num_cars
89
+ }));
90
+ }
91
+ }))));
84
92
  }
85
93
 
86
94
  export { ViewingAnalyticsReport as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tenancy.nz/reports",
3
3
  "description": "React UI reporting components.",
4
- "version": "1.0.1",
4
+ "version": "1.0.3",
5
5
  "author": "TPS <https://www.tenancy.co.nz>",
6
6
  "license": "ISC",
7
7
  "type": "module",
@@ -14,14 +14,14 @@
14
14
  "peerDependencies": {
15
15
  "react": ">= 16.0.0 <= 18.3.1",
16
16
  "react-dom": ">= 16.0.0 <= 18.3.1",
17
- "@tenancy.nz/ui": "1.0.1",
18
- "@tenancy.nz/feature-ui": "1.0.1"
17
+ "@tenancy.nz/feature-ui": "1.0.2",
18
+ "@tenancy.nz/ui": "1.0.6"
19
19
  },
20
20
  "devDependencies": {
21
21
  "react": "^19.1.0",
22
22
  "react-dom": "^19.1.0",
23
- "@tenancy.nz/feature-ui": "1.0.1",
24
- "@tenancy.nz/ui": "1.0.1"
23
+ "@tenancy.nz/feature-ui": "1.0.2",
24
+ "@tenancy.nz/ui": "1.0.6"
25
25
  },
26
26
  "dependencies": {
27
27
  "react-uid": "^2.4.0"