@tenancy.nz/feature-ui 1.0.0 → 1.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.
Files changed (39) hide show
  1. package/dist/cjs/components/AgentDetailsCard.cjs +55 -0
  2. package/dist/cjs/components/AnalyticsBox.cjs +58 -0
  3. package/dist/cjs/components/AnalyticsSection.cjs +209 -0
  4. package/dist/cjs/components/BookingChart.cjs +124 -0
  5. package/dist/cjs/components/BookingChart.styled.cjs +100 -0
  6. package/dist/cjs/components/BookingTable.cjs +44 -0
  7. package/dist/cjs/components/BookingTableRow.cjs +63 -0
  8. package/dist/cjs/components/BookingTableRow.styled.cjs +42 -0
  9. package/dist/cjs/components/BookingTableRowHeader.cjs +27 -0
  10. package/dist/cjs/components/BookingTableRowSkeleton.cjs +30 -0
  11. package/dist/cjs/components/CheckedIcon.cjs +17 -0
  12. package/dist/cjs/components/EnquiriesDoughnutChart.cjs +167 -0
  13. package/dist/cjs/components/GridList.cjs +87 -0
  14. package/dist/cjs/components/Hidden.cjs +15 -0
  15. package/dist/cjs/components/IconLabel.cjs +36 -0
  16. package/dist/cjs/components/NotesCard.cjs +39 -0
  17. package/dist/cjs/components/PropertyCard.cjs +137 -0
  18. package/dist/cjs/components/PropertyCard.styled.cjs +76 -0
  19. package/dist/cjs/index.cjs +36 -0
  20. package/dist/esm/components/AgentDetailsCard.js +51 -0
  21. package/dist/esm/components/AnalyticsBox.js +54 -0
  22. package/dist/esm/components/AnalyticsSection.js +205 -0
  23. package/dist/esm/components/BookingChart.js +120 -0
  24. package/dist/esm/components/BookingChart.styled.js +94 -0
  25. package/dist/esm/components/BookingTable.js +40 -0
  26. package/dist/esm/components/BookingTableRow.js +59 -0
  27. package/dist/esm/components/BookingTableRow.styled.js +40 -0
  28. package/dist/esm/components/BookingTableRowHeader.js +23 -0
  29. package/dist/esm/components/BookingTableRowSkeleton.js +26 -0
  30. package/dist/esm/components/CheckedIcon.js +13 -0
  31. package/dist/esm/components/EnquiriesDoughnutChart.js +163 -0
  32. package/dist/esm/components/GridList.js +83 -0
  33. package/dist/esm/components/Hidden.js +11 -0
  34. package/dist/esm/components/IconLabel.js +32 -0
  35. package/dist/esm/components/NotesCard.js +35 -0
  36. package/dist/esm/components/PropertyCard.js +133 -0
  37. package/dist/esm/components/PropertyCard.styled.js +72 -0
  38. package/dist/esm/index.js +16 -0
  39. package/package.json +5 -5
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ require('react');
8
+ var ui = require('@tenancy.nz/ui');
9
+ var icons = require('@tenancy.nz/icons');
10
+ var IconLabel = require('./IconLabel.cjs');
11
+
12
+ function AgentDetailsCard({
13
+ email = void 0,
14
+ loading = false,
15
+ logo = void 0,
16
+ name = void 0,
17
+ phone = void 0
18
+ }) {
19
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { display: "flex", gap: "8px", align: "flex-start", children: [
20
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { display: "flex", gap: "8px", direction: "column", width: "100%", children: [
21
+ loading ? /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { width: "75%", height: "22px", variant: "text" }) : /* @__PURE__ */ jsxRuntime.jsx(IconLabel.default, { color: "tertiary.main", startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.UserIcon, { size: "24px" }), children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { as: "h5", weight: "700", children: name }) }),
22
+ loading ? /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { width: "55%", height: "18px", variant: "text" }) : /* @__PURE__ */ jsxRuntime.jsx(
23
+ IconLabel.default,
24
+ {
25
+ color: "tertiary.main",
26
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.PhoneIcon, { size: "24px" }),
27
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "span", color: "text.primary", variant: "body1", weight: "400", children: phone })
28
+ }
29
+ ),
30
+ loading ? /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { width: "55%", height: "18px", variant: "text" }) : /* @__PURE__ */ jsxRuntime.jsx(
31
+ IconLabel.default,
32
+ {
33
+ color: "tertiary.main",
34
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.EnvelopeIcon, { size: "24px" }),
35
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "span", color: "text.primary", variant: "body1", weight: "400", children: email })
36
+ }
37
+ )
38
+ ] }),
39
+ loading && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: "0 0 40px", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { width: "40px", height: "40px", variant: "rectangular" }) }),
40
+ logo && !loading && /* @__PURE__ */ jsxRuntime.jsx(
41
+ ui.Box,
42
+ {
43
+ width: "40px",
44
+ height: "40px",
45
+ sx: {
46
+ flex: "0 0 40px",
47
+ "> img": { maxWidth: "100%", maxHeight: "100%" }
48
+ },
49
+ children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: logo, alt: "Agency Logo" })
50
+ }
51
+ )
52
+ ] });
53
+ }
54
+
55
+ exports.default = AgentDetailsCard;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ require('react');
8
+ var ui = require('@tenancy.nz/ui');
9
+
10
+ function AnalyticsBox({
11
+ width,
12
+ minWidth,
13
+ maxWidth,
14
+ height,
15
+ border,
16
+ label,
17
+ amount,
18
+ text,
19
+ ...rest
20
+ }) {
21
+ return /* @__PURE__ */ jsxRuntime.jsx(
22
+ ui.Paper,
23
+ {
24
+ ...rest,
25
+ sx: {
26
+ maxWidth,
27
+ width,
28
+ minWidth,
29
+ border,
30
+ height: height || "100%",
31
+ display: "flex",
32
+ alignItems: "center",
33
+ justifyContent: "center",
34
+ padding: "16px"
35
+ },
36
+ children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { children: [
37
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { align: "center", weight: "700", as: "h3", gutterBottom: true, children: amount }),
38
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { align: "center", weight: "400", variant: "body2", children: label }),
39
+ text && /* @__PURE__ */ jsxRuntime.jsx(
40
+ ui.Text,
41
+ {
42
+ align: "center",
43
+ weight: "400",
44
+ sx: {
45
+ fontSize: { xs: 8, sm: 10, xl: 14 },
46
+ lineHeight: "15.6px",
47
+ maxWidth: "366px",
48
+ mt: "8px"
49
+ },
50
+ children: text
51
+ }
52
+ )
53
+ ] })
54
+ }
55
+ );
56
+ }
57
+
58
+ exports.default = AnalyticsBox;
@@ -0,0 +1,209 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ require('react');
8
+ var ui = require('@tenancy.nz/ui');
9
+ var AnalyticsBox = require('./AnalyticsBox.cjs');
10
+ var EnquiriesDoughnutChart = require('./EnquiriesDoughnutChart.cjs');
11
+
12
+ function AnalyticsSection({
13
+ viewingsCount,
14
+ bookingsCount,
15
+ attendeesCount,
16
+ cancellationsCount,
17
+ applicationsCount,
18
+ averageRent,
19
+ textUsage,
20
+ tradeMeEnquiriesCount,
21
+ bookMeEnquiriesCount,
22
+ manualEnquiryCount,
23
+ agreementsCount,
24
+ agreementsFinalisedCount,
25
+ filterDaysCount
26
+ }) {
27
+ const isXlUp = ui.useMediaQuery((theme) => theme.breakpoints.up("xl"));
28
+ return /* @__PURE__ */ jsxRuntime.jsxs(
29
+ ui.Box,
30
+ {
31
+ display: "flex",
32
+ align: "stretch",
33
+ direction: { xs: "column-reverse", mlg: "row" },
34
+ gap: "27px",
35
+ children: [
36
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { width: "100%", maxWidth: { xs: "100%", mob: "340px", xl: "463px" }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Paper, { style: { width: "100%", position: "relative", height: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { mt: "20px", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
37
+ EnquiriesDoughnutChart.default,
38
+ {
39
+ tradeMeEnquiriesCount,
40
+ bookMeEnquiriesCount,
41
+ manualEnquiryCount
42
+ }
43
+ ) }) }) }),
44
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { display: "flex", direction: "row", width: "100%", gap: 6, children: [
45
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { flex: 3, children: [
46
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { display: "flex", gap: 6, children: [
47
+ /* @__PURE__ */ jsxRuntime.jsx(
48
+ AnalyticsBox.default,
49
+ {
50
+ label: "Viewings",
51
+ amount: viewingsCount,
52
+ width: "100%",
53
+ height: isXlUp ? "157px" : "125px"
54
+ }
55
+ ),
56
+ /* @__PURE__ */ jsxRuntime.jsx(
57
+ AnalyticsBox.default,
58
+ {
59
+ label: "Bookings",
60
+ amount: bookingsCount,
61
+ width: "100%",
62
+ height: isXlUp ? "157px" : "125px"
63
+ }
64
+ ),
65
+ /* @__PURE__ */ jsxRuntime.jsx(
66
+ AnalyticsBox.default,
67
+ {
68
+ label: "Attendees",
69
+ amount: attendeesCount,
70
+ width: "100%",
71
+ border: "3px solid #6FD3C0",
72
+ height: isXlUp ? "157px" : "125px"
73
+ }
74
+ )
75
+ ] }),
76
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { display: "flex", width: "100%", gap: 6, mt: 6, children: [
77
+ /* @__PURE__ */ jsxRuntime.jsx(
78
+ AnalyticsBox.default,
79
+ {
80
+ label: "Converted Properties",
81
+ amount: agreementsCount,
82
+ width: "100%",
83
+ height: isXlUp ? "157px" : "125px",
84
+ text: /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { as: "span", maxWidth: "276px", children: [
85
+ "Properties that have had a viewing in the last",
86
+ " ",
87
+ /* @__PURE__ */ jsxRuntime.jsx(
88
+ ui.Text,
89
+ {
90
+ as: "span",
91
+ display: "inline",
92
+ weight: "700",
93
+ fontSize: "inherit",
94
+ children: filterDaysCount
95
+ }
96
+ ),
97
+ " ",
98
+ "days where an agreement has been",
99
+ " ",
100
+ /* @__PURE__ */ jsxRuntime.jsx(
101
+ ui.Text,
102
+ {
103
+ as: "span",
104
+ display: "inline",
105
+ weight: "700",
106
+ fontSize: "inherit",
107
+ children: "created"
108
+ }
109
+ )
110
+ ] })
111
+ }
112
+ ),
113
+ /* @__PURE__ */ jsxRuntime.jsx(
114
+ AnalyticsBox.default,
115
+ {
116
+ label: "Converted Properties",
117
+ amount: agreementsFinalisedCount,
118
+ width: "100%",
119
+ height: isXlUp ? "157px" : "125px",
120
+ text: /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { as: "span", maxWidth: "276px", children: [
121
+ "Properties that have had a viewing in the last",
122
+ " ",
123
+ /* @__PURE__ */ jsxRuntime.jsx(
124
+ ui.Text,
125
+ {
126
+ as: "span",
127
+ display: "inline",
128
+ weight: "700",
129
+ fontSize: "inherit",
130
+ children: filterDaysCount
131
+ }
132
+ ),
133
+ " ",
134
+ "days where an agreement has been",
135
+ " ",
136
+ /* @__PURE__ */ jsxRuntime.jsx(
137
+ ui.Text,
138
+ {
139
+ as: "span",
140
+ display: "inline",
141
+ weight: "700",
142
+ fontSize: "inherit",
143
+ children: "finalised"
144
+ }
145
+ )
146
+ ] })
147
+ }
148
+ )
149
+ ] })
150
+ ] }),
151
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { flex: 2, children: [
152
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { display: "flex", gap: 6, children: [
153
+ /* @__PURE__ */ jsxRuntime.jsx(
154
+ AnalyticsBox.default,
155
+ {
156
+ label: "Cancellations",
157
+ amount: cancellationsCount,
158
+ width: "100%",
159
+ border: "3px solid #ED0D8D",
160
+ height: isXlUp ? "157px" : "125px"
161
+ }
162
+ ),
163
+ /* @__PURE__ */ jsxRuntime.jsx(
164
+ AnalyticsBox.default,
165
+ {
166
+ label: "Applications",
167
+ amount: applicationsCount,
168
+ width: "100%",
169
+ border: "3px solid #F5C440",
170
+ height: isXlUp ? "157px" : "125px"
171
+ }
172
+ )
173
+ ] }),
174
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { display: "flex", gap: 6, mt: 6, children: [
175
+ /* @__PURE__ */ jsxRuntime.jsx(
176
+ AnalyticsBox.default,
177
+ {
178
+ label: /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
179
+ "Average",
180
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
181
+ " Rent"
182
+ ] }),
183
+ amount: averageRent,
184
+ width: "100%",
185
+ height: isXlUp ? "157px" : "125px"
186
+ }
187
+ ),
188
+ /* @__PURE__ */ jsxRuntime.jsx(
189
+ AnalyticsBox.default,
190
+ {
191
+ label: /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
192
+ "Text Usage",
193
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
194
+ " Total"
195
+ ] }),
196
+ amount: textUsage,
197
+ width: "100%",
198
+ height: isXlUp ? "157px" : "125px"
199
+ }
200
+ )
201
+ ] })
202
+ ] })
203
+ ] }) })
204
+ ]
205
+ }
206
+ );
207
+ }
208
+
209
+ exports.default = AnalyticsSection;
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var React = require('react');
8
+ var ui = require('@tenancy.nz/ui');
9
+ var chart = require('primereact/chart');
10
+ var BookingChart_styled = require('./BookingChart.styled.cjs');
11
+
12
+ const defaultOptions = {
13
+ scaleFontColor: "black",
14
+ legend: {
15
+ display: false
16
+ },
17
+ plugins: {
18
+ datalabels: {
19
+ align: "centre",
20
+ font: {
21
+ weight: "700",
22
+ size: 12,
23
+ family: "Montserrat, sans-serif"
24
+ },
25
+ display: (ctx) => ctx.dataset.data[ctx.dataIndex] > 0
26
+ }
27
+ },
28
+ scales: {
29
+ xAxes: [
30
+ {
31
+ gridLines: {
32
+ labelString: "Date",
33
+ display: false
34
+ },
35
+ ticks: {
36
+ fontSize: 13,
37
+ family: "Montserrat, sans-serif",
38
+ fontWeight: "bold"
39
+ },
40
+ stacked: true
41
+ }
42
+ ],
43
+ yAxes: [
44
+ {
45
+ scaleLabel: {
46
+ display: true,
47
+ labelString: "Total bookings",
48
+ fontFamily: "Montserrat, sans-serif",
49
+ fontSize: 13,
50
+ fontStyle: "600"
51
+ },
52
+ ticks: {
53
+ min: 0,
54
+ stepSize: 5,
55
+ fontSize: 13,
56
+ fontWeight: 500
57
+ },
58
+ gridLines: {
59
+ display: false
60
+ },
61
+ stacked: true
62
+ }
63
+ ]
64
+ }
65
+ };
66
+ function BookingChart({
67
+ data,
68
+ labels,
69
+ mode = "day",
70
+ options = {},
71
+ onModeChange = void 0
72
+ }) {
73
+ const legends = React.useMemo(
74
+ () => data.map(({ label, backgroundColor }) => [label, backgroundColor]).filter(
75
+ ([label], i, items) => items.findIndex(([l]) => l === label) === i
76
+ ),
77
+ [data]
78
+ );
79
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { display: "flex", direction: "column", gap: "16px", width: "100%", children: [
80
+ legends.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(BookingChart_styled.StyledBookingChartStack, { children: legends.map(([label, backgroundColor]) => /* @__PURE__ */ jsxRuntime.jsx(BookingChart_styled.StyledBookingChartLegend, { color: backgroundColor, children: label }, label)) }),
81
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { width: "100%", overflow: "hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
82
+ chart.Chart,
83
+ {
84
+ type: "bar",
85
+ data: {
86
+ labels,
87
+ datasets: data
88
+ },
89
+ options: { ...defaultOptions, ...options }
90
+ }
91
+ ) }),
92
+ onModeChange && /* @__PURE__ */ jsxRuntime.jsxs(BookingChart_styled.StyledBookingChartStack, { children: [
93
+ /* @__PURE__ */ jsxRuntime.jsx(
94
+ BookingChart_styled.StyledBookingChartButton,
95
+ {
96
+ onClick: onModeChange,
97
+ active: mode === "day",
98
+ value: "day",
99
+ children: "Day"
100
+ }
101
+ ),
102
+ /* @__PURE__ */ jsxRuntime.jsx(
103
+ BookingChart_styled.StyledBookingChartButton,
104
+ {
105
+ onClick: onModeChange,
106
+ active: mode === "week",
107
+ value: "week",
108
+ children: "Week"
109
+ }
110
+ ),
111
+ /* @__PURE__ */ jsxRuntime.jsx(
112
+ BookingChart_styled.StyledBookingChartButton,
113
+ {
114
+ onClick: onModeChange,
115
+ active: mode === "month",
116
+ value: "month",
117
+ children: "Month"
118
+ }
119
+ )
120
+ ] })
121
+ ] });
122
+ }
123
+
124
+ exports.default = BookingChart;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var react = require('@emotion/react');
5
+ var styled = require('@emotion/styled');
6
+
7
+ const StyledBookingChartStack = styled.div`
8
+ display: flex;
9
+ flex-wrap: wrap;
10
+ gap: 8px;
11
+ padding: 0;
12
+ margin: 0;
13
+ list-style: none;
14
+ font-size: 12px;
15
+ justify-content: center;
16
+ color: #000;
17
+ width: 100%;
18
+ `;
19
+ const StyledBookingChartLegend = styled("span", {
20
+ shouldForwardProp: (prop) => !["color"].includes(prop)
21
+ })`
22
+ font-weight: 500;
23
+ display: flex;
24
+ align-items: center;
25
+ gap: 6px;
26
+
27
+ &::before {
28
+ content: '';
29
+ display: inline-flex;
30
+ width: 32px;
31
+ height: 18px;
32
+ background-color: ${(props) => props.color};
33
+ border-radius: 4px;
34
+ }
35
+ `;
36
+ const StyledBookingChartButton = styled("button", {
37
+ shouldForwardProp: (prop) => !["color"].includes(prop)
38
+ })`
39
+ font-weight: 500;
40
+ display: flex;
41
+ align-items: center;
42
+ padding: 6px 10px;
43
+ font-size: 14px;
44
+ border-radius: 4px;
45
+ font-family: inherit;
46
+ border: 1px solid ${({ theme }) => theme.palette.primary.main};
47
+ box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.1);
48
+ background-color: ${({ active, theme }) => active ? "#CEF3ED" : theme.palette.background.paper};
49
+ cursor: pointer;
50
+
51
+ &:hover {
52
+ background-color: ${({ active, theme }) => !active ? theme.palette.grey[100] : null};
53
+ }
54
+ `;
55
+ const StyledPropertyDetailsBox = styled.div`
56
+ display: flex;
57
+ width: 100%;
58
+ align-items: flex-start;
59
+ padding: 16px 24px 16px 20px;
60
+ flex-direction: column;
61
+
62
+ ${({ theme }) => react.css`
63
+ ${theme.breakpoints.up("sm")} {
64
+ flex-direction: row;
65
+ align-items: center;
66
+ }
67
+ `}
68
+
69
+ @media print {
70
+ flex-direction: row;
71
+ align-items: center;
72
+ }
73
+ `;
74
+ const StyledPropertyAmenitiesBox = styled.div`
75
+ padding-right: 25px;
76
+ display: flex;
77
+ flex-direction: column;
78
+ margin-top: 5px;
79
+
80
+ gap: 18px;
81
+ min-width: 170px;
82
+ height: 100%;
83
+ justify-content: space-between;
84
+
85
+ ${({ theme }) => `
86
+ @media (min-width: ${theme.breakpoints.values.md}px) {
87
+ align-items: flex-end;
88
+ }
89
+ `}
90
+
91
+ @media print {
92
+ align-items: flex-end;
93
+ }
94
+ `;
95
+
96
+ exports.StyledBookingChartButton = StyledBookingChartButton;
97
+ exports.StyledBookingChartLegend = StyledBookingChartLegend;
98
+ exports.StyledBookingChartStack = StyledBookingChartStack;
99
+ exports.StyledPropertyAmenitiesBox = StyledPropertyAmenitiesBox;
100
+ exports.StyledPropertyDetailsBox = StyledPropertyDetailsBox;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ require('react');
8
+ var reactUid = require('react-uid');
9
+ var ui = require('@tenancy.nz/ui');
10
+ var BookingTableRowHeader = require('./BookingTableRowHeader.cjs');
11
+ var BookingTableRow = require('./BookingTableRow.cjs');
12
+ var BookingTableRowSkeleton = require('./BookingTableRowSkeleton.cjs');
13
+
14
+ function BookingTable({ data, loading = false }) {
15
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { sx: { overflowX: "auto", scrollBehavior: "smooth" }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { sx: { minWidth: "1024px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Paper, { outlined: true, overflow: false, children: [
16
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { bgcolor: "grey.50", children: /* @__PURE__ */ jsxRuntime.jsx(BookingTableRowHeader.default, {}) }),
17
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { children: [
18
+ !loading && data.map((booking, index) => /* @__PURE__ */ jsxRuntime.jsx(
19
+ BookingTableRow.default,
20
+ {
21
+ firstName: booking.firstName,
22
+ lastName: booking.lastName,
23
+ notes: booking.notes,
24
+ tenantNotes: booking.tenantNotes,
25
+ status: booking.status,
26
+ attended: booking.attended,
27
+ suitable: booking.suitable,
28
+ applicationSent: booking.applicationSent,
29
+ applicationReceived: booking.applicationReceived
30
+ },
31
+ reactUid.uid(booking, index)
32
+ )),
33
+ loading && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
34
+ /* @__PURE__ */ jsxRuntime.jsx(BookingTableRowSkeleton.default, {}),
35
+ /* @__PURE__ */ jsxRuntime.jsx(BookingTableRowSkeleton.default, {}),
36
+ /* @__PURE__ */ jsxRuntime.jsx(BookingTableRowSkeleton.default, {}),
37
+ /* @__PURE__ */ jsxRuntime.jsx(BookingTableRowSkeleton.default, {})
38
+ ] }),
39
+ !loading && data.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { as: "h4", align: "center", sx: { margin: "16px 0" }, children: "No bookings" })
40
+ ] })
41
+ ] }) }) });
42
+ }
43
+
44
+ exports.default = BookingTable;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ require('react');
8
+ var ui = require('@tenancy.nz/ui');
9
+ var CheckedIcon = require('./CheckedIcon.cjs');
10
+ var BookingTableRow_styled = require('./BookingTableRow.styled.cjs');
11
+
12
+ const tagMap = (status) => {
13
+ if (status === "confirmed") {
14
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Tag, { color: "success", label: "Confirmed" });
15
+ }
16
+ if (status === "cancelled") {
17
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Tag, { color: "error", label: "Cancelled" });
18
+ }
19
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Tag, { color: "info", label: "Registered" });
20
+ };
21
+ function BookingTableRow({
22
+ applicationReceived = false,
23
+ applicationSent = false,
24
+ attended = false,
25
+ firstName,
26
+ lastName,
27
+ notes = void 0,
28
+ status,
29
+ suitable = false,
30
+ tenantNotes = void 0
31
+ }) {
32
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { container: true, spacing: 0, children: [
33
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { item: true, container: true, xs: 6, children: [
34
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 3, md: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(BookingTableRow_styled.StyledBookingTableRowCell, { children: [
35
+ firstName,
36
+ " ",
37
+ lastName
38
+ ] }) }),
39
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 6, md: 7, children: /* @__PURE__ */ jsxRuntime.jsx(BookingTableRow_styled.StyledBookingTableRowCell, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { as: "div", variant: "body2", children: [
40
+ notes && /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { variant: "inherit", paragraph: !!tenantNotes, children: [
41
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Property Manager Note" }),
42
+ " ",
43
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
44
+ notes
45
+ ] }),
46
+ tenantNotes && /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { variant: "inherit", children: [
47
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Tenant Feedback" }),
48
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
49
+ tenantNotes
50
+ ] })
51
+ ] }) }) }),
52
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 3, md: 2, children: /* @__PURE__ */ jsxRuntime.jsx(BookingTableRow_styled.StyledBookingTableRowCell, { children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: tagMap(status) }) }) })
53
+ ] }),
54
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { item: true, container: true, xs: 6, children: [
55
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 3, children: /* @__PURE__ */ jsxRuntime.jsx(BookingTableRow_styled.StyledBookingTableRowCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(CheckedIcon.default, { value: attended }) }) }),
56
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 3, children: /* @__PURE__ */ jsxRuntime.jsx(BookingTableRow_styled.StyledBookingTableRowCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(CheckedIcon.default, { value: suitable }) }) }),
57
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 3, children: /* @__PURE__ */ jsxRuntime.jsx(BookingTableRow_styled.StyledBookingTableRowCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(CheckedIcon.default, { value: applicationSent }) }) }),
58
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { item: true, xs: 3, children: /* @__PURE__ */ jsxRuntime.jsx(BookingTableRow_styled.StyledBookingTableRowCell, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(CheckedIcon.default, { value: applicationReceived }) }) })
59
+ ] })
60
+ ] });
61
+ }
62
+
63
+ exports.default = BookingTableRow;