@licklist/design 0.44.546 → 0.44.547-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/availability-indicator/AvailabilityIndicator.js +1 -1
- package/dist/events/event-statistic-modal/utils/index.d.ts.map +1 -1
- package/dist/events/event-statistic-modal/utils/index.js +1 -1
- package/dist/sales/booking/results/BookingResults.d.ts +3 -1
- package/dist/sales/booking/results/BookingResults.d.ts.map +1 -1
- package/dist/sales/booking/results/BookingResults.js +1 -1
- package/dist/sales/booking/results/components/ResultCard.d.ts +3 -1
- package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
- package/dist/sales/booking/results/components/ResultCard.js +1 -1
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/package.json +3 -3
- package/src/availability-indicator/AvailabilityIndicator.tsx +11 -11
- package/src/events/event-statistic-modal/utils/index.ts +47 -37
- package/src/sales/booking/results/BookingResults.tsx +7 -0
- package/src/sales/booking/results/components/ResultCard.tsx +41 -6
- package/src/styles/sales/BookingResults.scss +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),a=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,l=require("react-i18next"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),a=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,l=require("react-i18next"),n=require("../assets/iframe/available.svg.js"),r=require("../assets/iframe/limited.svg.js"),o=require("../assets/iframe/soldOut.svg.js"),i=function(e){var t=e.Icon,l=e.label;return a.createElement("div",{className:"availability-indicator"},a.createElement(t,null),a.createElement("div",null,l))};exports.AvailabilityIndicator=function(e){var t=e.resources,s=e.isUnavailable,c=e.isSoldOut,u=l.useTranslation("Design").t;if(s)return a.createElement(i,{Icon:o.ReactComponent,label:u("notAvailable")});if(c)return a.createElement(i,{Icon:o.ReactComponent,label:u("soldOut")});var b=function(e){var t=e.bookedResources,a=e.totalResources;return t===a?{label:"soldOut",Icon:o.ReactComponent}:t/a<=.2?{label:"lotsOfSpace",Icon:n.ReactComponent}:t/a>=.8?{label:"limited",Icon:r.ReactComponent}:{label:"available",Icon:n.ReactComponent}}(t),m=b.Icon,v=b.label;return a.createElement(i,{Icon:m,label:u(v)})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/events/event-statistic-modal/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAC;AAIlG,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAC;AAEF,eAAO,MAAM,gCAAgC,SACrC,MAAM,kBACI,cAAc;UAUtB,MAAM;SACP,MAAM;eACA,OAAO;aACT,OAAO;cACN,MAAM,GAAG,MAAM;WAClB,MAAM,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/events/event-statistic-modal/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAC;AAIlG,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAC;AAEF,eAAO,MAAM,gCAAgC,SACrC,MAAM,kBACI,cAAc;UAUtB,MAAM;SACP,MAAM;eACA,OAAO;aACT,OAAO;cACN,MAAM,GAAG,MAAM;WAClB,MAAM,GAAG,MAAM;GAsEzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@licklist/core/dist/Config"),o=require("luxon"),a={shortQuantity:"shortQuantity",total:"total",totalPerCategory:"totalPerCategory"};exports.TRANSLATION_KEYS=a,exports.convertEventStatisticToTableData=function(e
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@licklist/core/dist/Config"),o=require("luxon"),a={shortQuantity:"shortQuantity",total:"total",totalPerCategory:"totalPerCategory"};exports.TRANSLATION_KEYS=a,exports.convertEventStatisticToTableData=function(r,e){var n,c,i=0,u=0;if(!e)return[];var l=[],y=o.DateTime.fromISO(r).toUTC().toFormat(t.DATE_FORMAT),s=null!==(c=null===(n=Object.keys(null==e?void 0:e.productCategorySummary))||void 0===n?void 0:n.filter((function(a){return o.DateTime.fromFormat(a,t.DATE_TIME_FULL_FORMAT).toFormat(t.DATE_FORMAT)===y})))&&void 0!==c?c:[];return s.map((function(t){return null==e?void 0:e.productCategorySummary[t]})).forEach((function(t){t.forEach((function(t){var o=t.totalPerCategory,r=t.productsSummary,e=void 0===r?[]:r,n=t.categoryName,c=t.eventId,y=0;i+=o||0,l.push({name:n,key:"".concat(c,".").concat(n),isBold:!0,isHeader:!0,quantity:a.shortQuantity,total:a.total}),null==e||e.forEach((function(t){var o=t.productsSold,a=t.name,r=t.totalQuantity,e=t.total;y+=o,l.push({name:a,key:"".concat(c,".").concat(n,".").concat(a),quantity:r?"".concat(o," / ").concat(r):String(o),total:String(e)})})),l.push({name:a.totalPerCategory,key:"".concat(c,".").concat(n,".").concat(a.totalPerCategory),quantity:y,total:o,isBold:!0}),u+=y}))})),l.push({name:a.total,key:"".concat(a.total,".").concat(i),quantity:u,total:i,isBold:!0}),l};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Order } from "@licklist/core/dist/DataMapper/Order/OrderDataMapper";
|
|
3
|
+
import { User } from "@licklist/core/dist/DataMapper/User/UserDataMapper";
|
|
3
4
|
export type BookingResultsProps = {
|
|
4
5
|
orders?: Order[] | null;
|
|
5
6
|
onCardClick?: (id: number) => void;
|
|
7
|
+
staffMembers?: User[] | null;
|
|
6
8
|
};
|
|
7
|
-
export declare const BookingResults: ({ orders, onCardClick, }: BookingResultsProps) => JSX.Element;
|
|
9
|
+
export declare const BookingResults: ({ orders, onCardClick, staffMembers, }: BookingResultsProps) => JSX.Element;
|
|
8
10
|
//# sourceMappingURL=BookingResults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookingResults.d.ts","sourceRoot":"","sources":["../../../../src/sales/booking/results/BookingResults.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,sDAAsD,CAAC;
|
|
1
|
+
{"version":3,"file":"BookingResults.d.ts","sourceRoot":"","sources":["../../../../src/sales/booking/results/BookingResults.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,sDAAsD,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,oDAAoD,CAAC;AAI1E,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,YAAY,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,cAAc,2CAIxB,mBAAmB,gBA+BrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("react"),t=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,n=require("react-i18next"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("react"),t=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,n=require("react-i18next"),a=require("./components/ResultCard.js"),o=require("./constants.js");exports.BookingResults=function(e){var r=e.orders,l=e.onCardClick,s=e.staffMembers,i=n.useTranslation("Design").t;return t.createElement("div",{className:"booking-results"},0===(null==r?void 0:r.length)?t.createElement("p",null,i("noBookingOrdersWereFound")):t.createElement("div",{className:"booking-results-wrapper"},null==r?void 0:r.map((function(e,r){var n=null==s?void 0:s.find((function(r){var t;return r.id===(null===(t=null==e?void 0:e.orderMetadata)||void 0===t?void 0:t.created_by)}));return t.createElement(a.ResultCard,{key:e.id,order:e,staffMember:n,className:o.BACKGROUND_COLOR_CLASSNAMES[r%o.BACKGROUND_COLOR_CLASSNAMES.length],onCardClick:l})}))))};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Order } from "@licklist/core/dist/DataMapper/Order/OrderDataMapper";
|
|
3
|
+
import { User } from "@licklist/core/dist/DataMapper/User/UserDataMapper";
|
|
3
4
|
export type ResultCardProps = {
|
|
4
5
|
className: string;
|
|
5
6
|
order: Order;
|
|
7
|
+
staffMember?: User;
|
|
6
8
|
onCardClick?: (id: number) => void;
|
|
7
9
|
};
|
|
8
|
-
export declare const ResultCard: ({ order, className, onCardClick, }: ResultCardProps) => JSX.Element;
|
|
10
|
+
export declare const ResultCard: ({ order, className, staffMember, onCardClick, }: ResultCardProps) => JSX.Element;
|
|
9
11
|
//# sourceMappingURL=ResultCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultCard.d.ts","sourceRoot":"","sources":["../../../../../src/sales/booking/results/components/ResultCard.tsx"],"names":[],"mappings":";AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"ResultCard.d.ts","sourceRoot":"","sources":["../../../../../src/sales/booking/results/components/ResultCard.tsx"],"names":[],"mappings":";AAKA,OAAO,EACL,KAAK,EAEN,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,oDAAoD,CAAC;AAQ1E,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AAIF,eAAO,MAAM,UAAU,oDAKpB,eAAe,gBA2FjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("react")),r=require("@licklist/core/dist/Config"),l=require("react-i18next"),a=require("../../../../static/Icon.js"),n=e(require("clsx")),i=require("luxon"),
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("react")),r=require("@licklist/core/dist/Config"),l=require("react-i18next"),a=require("../../../../static/Icon.js"),n=e(require("clsx")),i=require("luxon"),c=require("react-intl"),u=require("@licklist/core/dist/DataMapper/Order/OrderDataMapper"),s=require("@licklist/plugins/dist/utils/formatDate"),o=require("@licklist/plugins/dist/utils/sourceTitle");exports.ResultCard=function(e){var m,d,p,E=e.order,f=e.className,v=e.staffMember,y=e.onCardClick,N=l.useTranslation("Design").t,q=c.useIntl().formatNumber,D=E.id,g=E.people,C=E.user,O=E.status,M=E.startDate,T=E.products,b=E.source,k=E.totalAmount,x=E.event,A=E.menu,h=E.remainingToPay,I=(null===(m=T.map((function(e){return e.name})))||void 0===m?void 0:m.join(", "))||"",R=(null==x?void 0:x.name)||(null==A?void 0:A.name)||"",_=function(){y&&y(D)};return t.createElement("div",{className:n("result-card",f),onClick:_,onKeyUp:_,role:"button",tabIndex:0},t.createElement("div",{className:"card-content"},t.createElement("div",{className:"order-id"},D),t.createElement("div",{className:"order-people"},t.createElement(a.default,{type:"user",width:"10",height:"11"}),g),t.createElement("div",{className:"order-description"},t.createElement("p",{className:"name"},C.firstName," ",C.lastName),C.email&&t.createElement("p",null,C.email),(null===(d=C.userDetail)||void 0===d?void 0:d.phone)&&t.createElement("p",null,null===(p=C.userDetail)||void 0===p?void 0:p.phone),t.createElement("p",null,"------"),t.createElement("p",null,N("activity"),": ",R," "),b===u.ORDER_SOURCE_MANUAL&&v&&t.createElement("p",null,N("staff"),": ","".concat(v.firstName," ").concat(v.lastName)),t.createElement("p",null,N("status"),": ",N(O)),t.createElement("p",null,N("date"),": ",s.formatDateStringForEvent(M,!1)),t.createElement("p",null,N("time"),": ",i.DateTime.fromISO(M).toFormat(r.TIME_FORMAT)),t.createElement("p",{className:"products",title:I},N("products"),": ",I),!!h&&t.createElement("p",null,N("remainingAmount"),":"," ",q(h,{style:"currency",currency:r.Currency.GBP})),t.createElement("p",null,N("paidAmount"),":"," ",q(k,{style:"currency",currency:r.Currency.GBP})),t.createElement("p",null,N("source"),": ",N(o.getOrderSourceTitle(b))))))};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@licklist/design",
|
|
3
|
-
"version": "0.44.
|
|
3
|
+
"version": "0.44.547-dev.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@fortawesome/free-brands-svg-icons": "5.15.2",
|
|
54
54
|
"@fortawesome/free-solid-svg-icons": "5.15.2",
|
|
55
55
|
"@fortawesome/react-fontawesome": "0.1.9",
|
|
56
|
-
"@licklist/core": "0.15.
|
|
56
|
+
"@licklist/core": ">=0.15.41-dev.0 < 0.15.41",
|
|
57
57
|
"@licklist/eslint-config": "0.3.4",
|
|
58
|
-
"@licklist/plugins": "0.20.
|
|
58
|
+
"@licklist/plugins": ">=0.20.133-dev.5 < 0.20.133",
|
|
59
59
|
"@mdx-js/react": "1.6.22",
|
|
60
60
|
"@popperjs/core": "2.11.8",
|
|
61
61
|
"@react-aria/utils": "3.9.0",
|
|
@@ -10,7 +10,7 @@ const LIMITED_LIMIT = 0.8;
|
|
|
10
10
|
|
|
11
11
|
type Config = {
|
|
12
12
|
label: string;
|
|
13
|
-
|
|
13
|
+
Icon: FunctionComponent<SVGProps<SVGSVGElement>>;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const getIconsAndLabels = ({
|
|
@@ -18,19 +18,19 @@ const getIconsAndLabels = ({
|
|
|
18
18
|
totalResources,
|
|
19
19
|
}: ZoneResourcesAvailability): Config => {
|
|
20
20
|
if (bookedResources === totalResources) {
|
|
21
|
-
return { label: "soldOut",
|
|
21
|
+
return { label: "soldOut", Icon: SoldOutIcon };
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// lots of space if less than 80% booked
|
|
25
25
|
if (bookedResources / totalResources <= LOTS_OF_SPACE_LIMIT) {
|
|
26
|
-
return { label: "lotsOfSpace",
|
|
26
|
+
return { label: "lotsOfSpace", Icon: AvailableIcon };
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
if (bookedResources / totalResources >= LIMITED_LIMIT) {
|
|
30
|
-
return { label: "limited",
|
|
30
|
+
return { label: "limited", Icon: LimitedIcon };
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
return { label: "available",
|
|
33
|
+
return { label: "available", Icon: AvailableIcon };
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
type AvailabilityIndicatorProps = {
|
|
@@ -47,21 +47,21 @@ export const AvailabilityIndicator = ({
|
|
|
47
47
|
const { t } = useTranslation("Design");
|
|
48
48
|
|
|
49
49
|
if (isUnavailable) {
|
|
50
|
-
return <Indicator
|
|
50
|
+
return <Indicator Icon={SoldOutIcon} label={t("notAvailable")} />;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
if (isSoldOut) {
|
|
54
|
-
return <Indicator
|
|
54
|
+
return <Indicator Icon={SoldOutIcon} label={t("soldOut")} />;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
const {
|
|
57
|
+
const { Icon, label } = getIconsAndLabels(resources);
|
|
58
58
|
|
|
59
|
-
return <Indicator
|
|
59
|
+
return <Indicator Icon={Icon} label={t(label)} />;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
const Indicator = ({
|
|
62
|
+
const Indicator = ({ Icon, label }: Config) => (
|
|
63
63
|
<div className="availability-indicator">
|
|
64
|
-
|
|
64
|
+
<Icon />
|
|
65
65
|
<div>{label}</div>
|
|
66
66
|
</div>
|
|
67
67
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventStatistic } from "@licklist/core/dist/DataMapper/Provider/EventStatisticDataMapper";
|
|
2
2
|
import { DateTime } from "luxon";
|
|
3
|
-
import { DATE_TIME_FULL_FORMAT } from "@licklist/core/dist/Config";
|
|
3
|
+
import { DATE_FORMAT, DATE_TIME_FULL_FORMAT } from "@licklist/core/dist/Config";
|
|
4
4
|
|
|
5
5
|
export const TRANSLATION_KEYS = {
|
|
6
6
|
shortQuantity: "shortQuantity",
|
|
@@ -30,51 +30,61 @@ export const convertEventStatisticToTableData = (
|
|
|
30
30
|
|
|
31
31
|
const summaryFormattedDate = DateTime.fromISO(date)
|
|
32
32
|
.toUTC()
|
|
33
|
-
.toFormat(
|
|
33
|
+
.toFormat(DATE_FORMAT);
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
eventStatistic?.productCategorySummary
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
const summaryDays =
|
|
36
|
+
Object.keys(eventStatistic?.productCategorySummary)?.filter(
|
|
37
|
+
(date) =>
|
|
38
|
+
DateTime.fromFormat(date, DATE_TIME_FULL_FORMAT).toFormat(
|
|
39
|
+
DATE_FORMAT
|
|
40
|
+
) === summaryFormattedDate
|
|
41
|
+
) ?? [];
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
summaryDays
|
|
44
|
+
.map((day) => eventStatistic?.productCategorySummary[day])
|
|
45
|
+
.forEach((summaries) => {
|
|
46
|
+
summaries.forEach(
|
|
47
|
+
({ totalPerCategory, productsSummary = [], categoryName, eventId }) => {
|
|
48
|
+
let quantity = 0;
|
|
42
49
|
|
|
43
|
-
|
|
44
|
-
name: categoryName,
|
|
45
|
-
key: `${eventId}.${categoryName}`,
|
|
46
|
-
isBold: true,
|
|
47
|
-
isHeader: true,
|
|
48
|
-
quantity: TRANSLATION_KEYS.shortQuantity,
|
|
49
|
-
total: TRANSLATION_KEYS.total,
|
|
50
|
-
});
|
|
50
|
+
totalAmount += totalPerCategory || 0;
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
tableDataArray.push({
|
|
53
|
+
name: categoryName,
|
|
54
|
+
key: `${eventId}.${categoryName}`,
|
|
55
|
+
isBold: true,
|
|
56
|
+
isHeader: true,
|
|
57
|
+
quantity: TRANSLATION_KEYS.shortQuantity,
|
|
58
|
+
total: TRANSLATION_KEYS.total,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
productsSummary?.forEach(
|
|
62
|
+
({ productsSold, name, totalQuantity, total }) => {
|
|
63
|
+
quantity += productsSold;
|
|
64
|
+
|
|
65
|
+
tableDataArray.push({
|
|
66
|
+
name,
|
|
67
|
+
key: `${eventId}.${categoryName}.${name}`,
|
|
68
|
+
quantity: totalQuantity
|
|
69
|
+
? `${productsSold} / ${totalQuantity}`
|
|
70
|
+
: String(productsSold),
|
|
71
|
+
total: String(total),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
);
|
|
55
75
|
|
|
56
76
|
tableDataArray.push({
|
|
57
|
-
name,
|
|
58
|
-
key: `${eventId}.${categoryName}.${
|
|
59
|
-
quantity
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
total: String(total),
|
|
77
|
+
name: TRANSLATION_KEYS.totalPerCategory,
|
|
78
|
+
key: `${eventId}.${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`,
|
|
79
|
+
quantity,
|
|
80
|
+
total: totalPerCategory,
|
|
81
|
+
isBold: true,
|
|
63
82
|
});
|
|
83
|
+
|
|
84
|
+
totalQuantity += quantity;
|
|
64
85
|
}
|
|
65
86
|
);
|
|
66
|
-
|
|
67
|
-
tableDataArray.push({
|
|
68
|
-
name: TRANSLATION_KEYS.totalPerCategory,
|
|
69
|
-
key: `${eventId}.${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`,
|
|
70
|
-
quantity,
|
|
71
|
-
total: totalPerCategory,
|
|
72
|
-
isBold: true,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
totalQuantity += quantity;
|
|
76
|
-
}
|
|
77
|
-
);
|
|
87
|
+
});
|
|
78
88
|
|
|
79
89
|
tableDataArray.push({
|
|
80
90
|
name: TRANSLATION_KEYS.total,
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
3
|
import { Order } from "@licklist/core/dist/DataMapper/Order/OrderDataMapper";
|
|
4
|
+
import { User } from "@licklist/core/dist/DataMapper/User/UserDataMapper";
|
|
4
5
|
import { ResultCard } from "./components/ResultCard";
|
|
5
6
|
import { BACKGROUND_COLOR_CLASSNAMES } from "./constants";
|
|
6
7
|
|
|
7
8
|
export type BookingResultsProps = {
|
|
8
9
|
orders?: Order[] | null;
|
|
9
10
|
onCardClick?: (id: number) => void;
|
|
11
|
+
staffMembers?: User[] | null;
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
export const BookingResults = ({
|
|
13
15
|
orders,
|
|
14
16
|
onCardClick,
|
|
17
|
+
staffMembers,
|
|
15
18
|
}: BookingResultsProps) => {
|
|
16
19
|
const { t } = useTranslation("Design");
|
|
17
20
|
|
|
@@ -22,10 +25,14 @@ export const BookingResults = ({
|
|
|
22
25
|
) : (
|
|
23
26
|
<div className="booking-results-wrapper">
|
|
24
27
|
{orders?.map((order, index) => {
|
|
28
|
+
const staffMember = staffMembers?.find(
|
|
29
|
+
(staff) => staff.id === order?.orderMetadata?.created_by
|
|
30
|
+
);
|
|
25
31
|
return (
|
|
26
32
|
<ResultCard
|
|
27
33
|
key={order.id}
|
|
28
34
|
order={order}
|
|
35
|
+
staffMember={staffMember}
|
|
29
36
|
className={
|
|
30
37
|
BACKGROUND_COLOR_CLASSNAMES[
|
|
31
38
|
index % BACKGROUND_COLOR_CLASSNAMES.length
|
|
@@ -3,16 +3,22 @@ import clsx from "clsx";
|
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
4
|
import { DateTime } from "luxon";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
Order,
|
|
8
|
+
ORDER_SOURCE_MANUAL,
|
|
9
|
+
} from "@licklist/core/dist/DataMapper/Order/OrderDataMapper";
|
|
10
|
+
import { User } from "@licklist/core/dist/DataMapper/User/UserDataMapper";
|
|
7
11
|
import { TIME_FORMAT } from "@licklist/core/dist/Config";
|
|
8
12
|
import * as Config from "@licklist/core/dist/Config";
|
|
9
13
|
import { formatDateStringForEvent } from "@licklist/plugins/dist/utils/formatDate";
|
|
10
14
|
import { getOrderSourceTitle } from "@licklist/plugins/dist/utils/sourceTitle";
|
|
15
|
+
|
|
11
16
|
import Icon from "../../../../static/Icon";
|
|
12
17
|
|
|
13
18
|
export type ResultCardProps = {
|
|
14
19
|
className: string;
|
|
15
20
|
order: Order;
|
|
21
|
+
staffMember?: User;
|
|
16
22
|
onCardClick?: (id: number) => void;
|
|
17
23
|
};
|
|
18
24
|
|
|
@@ -21,14 +27,28 @@ export type ResultCardProps = {
|
|
|
21
27
|
export const ResultCard = ({
|
|
22
28
|
order,
|
|
23
29
|
className,
|
|
30
|
+
staffMember,
|
|
24
31
|
onCardClick,
|
|
25
32
|
}: ResultCardProps) => {
|
|
26
33
|
const { t } = useTranslation("Design");
|
|
27
34
|
const { formatNumber } = useIntl();
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
|
|
36
|
+
const {
|
|
37
|
+
id,
|
|
38
|
+
people,
|
|
39
|
+
user,
|
|
40
|
+
status,
|
|
41
|
+
startDate,
|
|
42
|
+
products,
|
|
43
|
+
source,
|
|
44
|
+
totalAmount,
|
|
45
|
+
event,
|
|
46
|
+
menu,
|
|
47
|
+
remainingToPay,
|
|
48
|
+
} = order;
|
|
30
49
|
|
|
31
50
|
const productList = products.map((product) => product.name)?.join(", ") || "";
|
|
51
|
+
const activityName = event?.name || menu?.name || "";
|
|
32
52
|
|
|
33
53
|
const onClick = () => {
|
|
34
54
|
if (!onCardClick) return;
|
|
@@ -57,8 +77,14 @@ export const ResultCard = ({
|
|
|
57
77
|
{user.email && <p>{user.email}</p>}
|
|
58
78
|
{user.userDetail?.phone && <p>{user.userDetail?.phone}</p>}
|
|
59
79
|
<p>------</p>
|
|
60
|
-
<p>
|
|
61
|
-
|
|
80
|
+
<p>
|
|
81
|
+
{t("activity")}: {activityName}{" "}
|
|
82
|
+
</p>
|
|
83
|
+
{source === ORDER_SOURCE_MANUAL && staffMember && (
|
|
84
|
+
<p>
|
|
85
|
+
{t("staff")}: {`${staffMember.firstName} ${staffMember.lastName}`}
|
|
86
|
+
</p>
|
|
87
|
+
)}
|
|
62
88
|
<p>
|
|
63
89
|
{t("status")}: {t(status)}
|
|
64
90
|
</p>
|
|
@@ -71,8 +97,17 @@ export const ResultCard = ({
|
|
|
71
97
|
<p className="products" title={productList}>
|
|
72
98
|
{t("products")}: {productList}
|
|
73
99
|
</p>
|
|
100
|
+
{!!remainingToPay && (
|
|
101
|
+
<p>
|
|
102
|
+
{t("remainingAmount")}:{" "}
|
|
103
|
+
{formatNumber(remainingToPay, {
|
|
104
|
+
style: "currency",
|
|
105
|
+
currency: Config.Currency.GBP,
|
|
106
|
+
})}
|
|
107
|
+
</p>
|
|
108
|
+
)}
|
|
74
109
|
<p>
|
|
75
|
-
{t("
|
|
110
|
+
{t("paidAmount")}:{" "}
|
|
76
111
|
{formatNumber(totalAmount, {
|
|
77
112
|
style: "currency",
|
|
78
113
|
currency: Config.Currency.GBP,
|