@licklist/design 0.44.548 → 0.44.550-dev.2
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/custom-fields/constants.d.ts +2 -2
- package/dist/events/event-statistic-modal/utils/index.d.ts +10 -4
- 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/events/event-venue-map/utils/index.d.ts +7 -7
- package/dist/events/event-venue-map/utils/index.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts +7 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +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/events/event-statistic-modal/EventStatisticModal.stories.tsx +51 -0
- package/src/events/event-statistic-modal/utils/index.ts +81 -45
- 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
|
@@ -18,7 +18,7 @@ export declare const DEFAULT_FIELDS_VALUES: () => {
|
|
|
18
18
|
type: string;
|
|
19
19
|
label: string;
|
|
20
20
|
isExpanded: boolean;
|
|
21
|
-
_sortableId:
|
|
21
|
+
_sortableId: any;
|
|
22
22
|
};
|
|
23
23
|
dropdown: {
|
|
24
24
|
id: any;
|
|
@@ -27,7 +27,7 @@ export declare const DEFAULT_FIELDS_VALUES: () => {
|
|
|
27
27
|
type: string;
|
|
28
28
|
isExpanded: boolean;
|
|
29
29
|
label: string;
|
|
30
|
-
_sortableId:
|
|
30
|
+
_sortableId: any;
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -4,12 +4,18 @@ export declare const TRANSLATION_KEYS: {
|
|
|
4
4
|
total: string;
|
|
5
5
|
totalPerCategory: string;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type TableDataRecord = {
|
|
8
8
|
name: string;
|
|
9
9
|
key: string;
|
|
10
10
|
isHeader?: boolean;
|
|
11
11
|
isBold?: boolean;
|
|
12
|
-
quantity: string
|
|
13
|
-
total: string
|
|
14
|
-
|
|
12
|
+
quantity: string;
|
|
13
|
+
total: string;
|
|
14
|
+
metadata?: {
|
|
15
|
+
_productsSold: number;
|
|
16
|
+
_total: number;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare const convertEventStatisticToTableData: (date: string, eventStatistic: EventStatistic) => TableDataRecord[];
|
|
20
|
+
export {};
|
|
15
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,
|
|
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,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE;QACT,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,gCAAgC,SACrC,MAAM,kBACI,cAAc,sBA4G/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@licklist/core/dist/Config"),o=require("luxon"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),a=require("@licklist/core/dist/Config"),o=require("luxon"),e={shortQuantity:"shortQuantity",total:"total",totalPerCategory:"totalPerCategory"};exports.TRANSLATION_KEYS=e,exports.convertEventStatisticToTableData=function(r,c){var n,l,i=0,u=0;if(!c)return[];var d=o.DateTime.fromISO(r).toUTC().toFormat(a.DATE_FORMAT),y=null!==(l=null===(n=Object.keys(null==c?void 0:c.productCategorySummary))||void 0===n?void 0:n.filter((function(t){return o.DateTime.fromFormat(t,a.DATE_TIME_FULL_FORMAT).toFormat(a.DATE_FORMAT)===d})))&&void 0!==l?l:[],m=new Map;return y.map((function(t){return null==c?void 0:c.productCategorySummary[t]})).flat().sort((function(t,a){return t.categoryName===a.categoryName?0:t.categoryName>a.categoryName?1:-1})).forEach((function(t){var a,o=t.totalPerCategory,r=t.productsSummary,c=void 0===r?[]:r,n=t.categoryName,l=t.eventId,d=0;i+=o||0,m.has("".concat(n))||m.set("".concat(n),{name:n,key:"".concat(l,".").concat(n),isBold:!0,isHeader:!0,quantity:e.shortQuantity,total:e.total}),null==c||c.forEach((function(t){var a,o=t.productsSold,e=t.name,r=t.totalQuantity,c=t.total;d+=o;var i=null!==(a=m.get("".concat(n,".").concat(e)))&&void 0!==a?a:{metadata:{_productsSold:0,_total:0}};m.set("".concat(n,".").concat(e),{name:e,key:"".concat(l,".").concat(n,".").concat(e),quantity:r?"".concat(i.metadata._productsSold+o," / ").concat(r):String(i.metadata._productsSold+o),total:String(i.metadata._total+c),metadata:{_productsSold:i.metadata._productsSold+o,_total:i.metadata._total+c}})}));var y=null!==(a=m.get("".concat(n,".").concat(e.totalPerCategory)))&&void 0!==a?a:{quantity:0,total:0};m.set("".concat(n,".").concat(e.totalPerCategory),{name:e.totalPerCategory,key:"".concat(l,".").concat(n,".").concat(e.totalPerCategory),quantity:String(Number(y.quantity)+d),total:String(Number(y.total)+o),isBold:!0}),u+=d})),m.set("".concat(e.total,".").concat(i),{name:e.total,key:"".concat(e.total,".").concat(i),quantity:String(u),total:String(i),isBold:!0}),t.__spreadArray([],t.__read(m.values()),!1)};
|
|
@@ -18,7 +18,7 @@ type CalculateHorizontalScrollParametersProps = {
|
|
|
18
18
|
x: number;
|
|
19
19
|
totalLayerWidth: number;
|
|
20
20
|
};
|
|
21
|
-
export declare const twoDigitsRound: (value: number) =>
|
|
21
|
+
export declare const twoDigitsRound: (value: number) => any;
|
|
22
22
|
export declare const getElementParameters: ({ x, y, width, height, layer, }: GetElementParametersProps) => {
|
|
23
23
|
totalLayerHeight: number;
|
|
24
24
|
totalLayerWidth: number;
|
|
@@ -28,14 +28,14 @@ export declare const getElementParameters: ({ x, y, width, height, layer, }: Get
|
|
|
28
28
|
yAxisDifference: number;
|
|
29
29
|
};
|
|
30
30
|
export declare const calculateVerticalScrollParameters: ({ y, height, totalLayerHeight, }: CalculateVerticalScrollParametersProps) => {
|
|
31
|
-
height:
|
|
32
|
-
top:
|
|
33
|
-
scrollbarRatio:
|
|
31
|
+
height: any;
|
|
32
|
+
top: any;
|
|
33
|
+
scrollbarRatio: any;
|
|
34
34
|
};
|
|
35
35
|
export declare const calculateHorizontalScrollParameters: ({ width, x, totalLayerWidth, }: CalculateHorizontalScrollParametersProps) => {
|
|
36
|
-
width:
|
|
37
|
-
left:
|
|
38
|
-
scrollbarRatio:
|
|
36
|
+
width: any;
|
|
37
|
+
left: any;
|
|
38
|
+
scrollbarRatio: any;
|
|
39
39
|
};
|
|
40
40
|
export declare const calculateTextParameters: (text: string, fontSize?: number) => {
|
|
41
41
|
width: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/events/event-venue-map/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kDAAkD,CAAC;AACzE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAKhE,KAAK,yBAAyB,GAAG;IAC/B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;CACpB,CAAC;AAEF,KAAK,sCAAsC,GAAG;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,EAAE,MAAM,CAAC;IACV,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,KAAK,wCAAwC,GAAG;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAKF,eAAO,MAAM,cAAc,UAAW,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/events/event-venue-map/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kDAAkD,CAAC;AACzE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAKhE,KAAK,yBAAyB,GAAG;IAC/B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;CACpB,CAAC;AAEF,KAAK,sCAAsC,GAAG;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,EAAE,MAAM,CAAC;IACV,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,KAAK,wCAAwC,GAAG;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAKF,eAAO,MAAM,cAAc,UAAW,MAAM,QAAoB,CAAC;AAEjE,eAAO,MAAM,oBAAoB,oCAM9B,yBAAyB;;;;;;;CAkC3B,CAAC;AAEF,eAAO,MAAM,iCAAiC,qCAI3C,sCAAsC;;;;CA2BxC,CAAC;AAEF,eAAO,MAAM,mCAAmC,mCAI7C,wCAAwC;;;;CAyB1C,CAAC;AAEF,eAAO,MAAM,uBAAuB,SAC5B,MAAM,aACF,MAAM;;;CAwBjB,CAAC;AAEF,eAAO,MAAM,wBAAwB,cACxB,QAAQ,KAAK,CAAC,EAAE,OACtB,MAAM,YACD,MAAM,GAAG,MAAM,qBA+B1B,CAAC;AAEF,eAAO,MAAM,wBAAwB,gBACtB,MAAM,cACP,MAAM,eACL,MAAM,WAGpB,CAAC;AAEF,eAAO,MAAM,0BAA0B,MAClC,MAAM,KACN,MAAM,UACD,KAAK,WAAW,EAAE,OAAO,CAAC,aAMnC,CAAC;AAEF,eAAO,MAAM,wBAAwB,UAC5B,KAAK,uBAAuB,EAAE,GAAG,GAAG,GAAG,CAAC,SACxC,KAAK,uBAAuB,EAAE,GAAG,GAAG,GAAG,CAAC,GAAG,KAAK,WAAW,EAAE,OAAO,CAAC;;;CAY7E,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { StaticTableData } from "../../../../table";
|
|
2
3
|
import { OrderItemsTableProps } from "../types";
|
|
3
4
|
export declare const PAYMENT_TYPE_TRANSLATE_KEYS: {
|
|
@@ -5,5 +6,10 @@ export declare const PAYMENT_TYPE_TRANSLATE_KEYS: {
|
|
|
5
6
|
fee: string;
|
|
6
7
|
VAT: string;
|
|
7
8
|
};
|
|
8
|
-
export declare const useTableData: ({ order, externalDiscount, isPaymentProcessed, paymentDetail, }: OrderItemsTableProps) => StaticTableData
|
|
9
|
+
export declare const useTableData: ({ order, externalDiscount, isPaymentProcessed, paymentDetail, }: OrderItemsTableProps) => (StaticTableData | {
|
|
10
|
+
key: any;
|
|
11
|
+
name: JSX.Element;
|
|
12
|
+
quantity: string;
|
|
13
|
+
price: JSX.Element;
|
|
14
|
+
})[];
|
|
9
15
|
//# sourceMappingURL=useTableData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTableData.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/payment/order-items-table/hooks/useTableData.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAe,MAAM,UAAU,CAAC;AAI7D,eAAO,MAAM,2BAA2B;;;;CAIvC,CAAC;AAEF,eAAO,MAAM,YAAY,oEAKtB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"useTableData.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/payment/order-items-table/hooks/useTableData.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAe,MAAM,UAAU,CAAC;AAI7D,eAAO,MAAM,2BAA2B;;;;CAIvC,CAAC;AAEF,eAAO,MAAM,YAAY,oEAKtB,oBAAoB;;;;;IAqHtB,CAAC"}
|
|
@@ -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.550-dev.2",
|
|
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",
|
|
@@ -91,6 +91,57 @@ Default.args = {
|
|
|
91
91
|
],
|
|
92
92
|
},
|
|
93
93
|
],
|
|
94
|
+
"2023-08-31 10:35:00": [
|
|
95
|
+
{
|
|
96
|
+
eventId: 1236,
|
|
97
|
+
categoryName: "ticket",
|
|
98
|
+
totalPerCategory: 1300,
|
|
99
|
+
productsSummary: [
|
|
100
|
+
{
|
|
101
|
+
id: 221,
|
|
102
|
+
name: "VIP",
|
|
103
|
+
productsSold: 13,
|
|
104
|
+
totalQuantity: 25,
|
|
105
|
+
total: 1300,
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
eventId: 1236,
|
|
111
|
+
categoryName: "booking cat",
|
|
112
|
+
totalPerCategory: 275,
|
|
113
|
+
productsSummary: [
|
|
114
|
+
{
|
|
115
|
+
id: 222,
|
|
116
|
+
name: "Table booking",
|
|
117
|
+
productsSold: 11,
|
|
118
|
+
totalQuantity: null,
|
|
119
|
+
total: 275,
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
eventId: 1236,
|
|
125
|
+
categoryName: "Menu",
|
|
126
|
+
totalPerCategory: 450,
|
|
127
|
+
productsSummary: [
|
|
128
|
+
{
|
|
129
|
+
id: 223,
|
|
130
|
+
name: "Wine 1 bottle",
|
|
131
|
+
productsSold: 9,
|
|
132
|
+
totalQuantity: null,
|
|
133
|
+
total: 360,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: 224,
|
|
137
|
+
name: "caesar salad",
|
|
138
|
+
productsSold: 9,
|
|
139
|
+
totalQuantity: null,
|
|
140
|
+
total: 90,
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
],
|
|
94
145
|
},
|
|
95
146
|
},
|
|
96
147
|
};
|
|
@@ -8,6 +8,19 @@ export const TRANSLATION_KEYS = {
|
|
|
8
8
|
totalPerCategory: "totalPerCategory",
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
+
type TableDataRecord = {
|
|
12
|
+
name: string;
|
|
13
|
+
key: string;
|
|
14
|
+
isHeader?: boolean;
|
|
15
|
+
isBold?: boolean;
|
|
16
|
+
quantity: string;
|
|
17
|
+
total: string;
|
|
18
|
+
metadata?: {
|
|
19
|
+
_productsSold: number;
|
|
20
|
+
_total: number;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
11
24
|
export const convertEventStatisticToTableData = (
|
|
12
25
|
date: string,
|
|
13
26
|
eventStatistic: EventStatistic
|
|
@@ -19,15 +32,6 @@ export const convertEventStatisticToTableData = (
|
|
|
19
32
|
return [];
|
|
20
33
|
}
|
|
21
34
|
|
|
22
|
-
const tableDataArray: {
|
|
23
|
-
name: string;
|
|
24
|
-
key: string;
|
|
25
|
-
isHeader?: boolean;
|
|
26
|
-
isBold?: boolean;
|
|
27
|
-
quantity: string | number;
|
|
28
|
-
total: string | number;
|
|
29
|
-
}[] = [];
|
|
30
|
-
|
|
31
35
|
const summaryFormattedDate = DateTime.fromISO(date)
|
|
32
36
|
.toUTC()
|
|
33
37
|
.toFormat(DATE_FORMAT);
|
|
@@ -40,16 +44,26 @@ export const convertEventStatisticToTableData = (
|
|
|
40
44
|
) === summaryFormattedDate
|
|
41
45
|
) ?? [];
|
|
42
46
|
|
|
47
|
+
const summaryMap = new Map<string, TableDataRecord>();
|
|
48
|
+
|
|
43
49
|
summaryDays
|
|
44
50
|
.map((day) => eventStatistic?.productCategorySummary[day])
|
|
45
|
-
.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
.flat()
|
|
52
|
+
.sort((prev, next) =>
|
|
53
|
+
prev.categoryName === next.categoryName
|
|
54
|
+
? 0
|
|
55
|
+
: prev.categoryName > next.categoryName
|
|
56
|
+
? 1
|
|
57
|
+
: -1
|
|
58
|
+
)
|
|
59
|
+
.forEach(
|
|
60
|
+
({ totalPerCategory, productsSummary = [], categoryName, eventId }) => {
|
|
61
|
+
let quantity = 0;
|
|
49
62
|
|
|
50
|
-
|
|
63
|
+
totalAmount += totalPerCategory || 0;
|
|
51
64
|
|
|
52
|
-
|
|
65
|
+
if (!summaryMap.has(`${categoryName}`)) {
|
|
66
|
+
summaryMap.set(`${categoryName}`, {
|
|
53
67
|
name: categoryName,
|
|
54
68
|
key: `${eventId}.${categoryName}`,
|
|
55
69
|
isBold: true,
|
|
@@ -57,42 +71,64 @@ export const convertEventStatisticToTableData = (
|
|
|
57
71
|
quantity: TRANSLATION_KEYS.shortQuantity,
|
|
58
72
|
total: TRANSLATION_KEYS.total,
|
|
59
73
|
});
|
|
74
|
+
}
|
|
60
75
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
);
|
|
75
|
-
|
|
76
|
-
tableDataArray.push({
|
|
77
|
-
name: TRANSLATION_KEYS.totalPerCategory,
|
|
78
|
-
key: `${eventId}.${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`,
|
|
79
|
-
quantity,
|
|
80
|
-
total: totalPerCategory,
|
|
81
|
-
isBold: true,
|
|
82
|
-
});
|
|
76
|
+
productsSummary?.forEach(
|
|
77
|
+
({ productsSold, name, totalQuantity, total }) => {
|
|
78
|
+
quantity += productsSold;
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
80
|
+
const existingProduct = summaryMap.get(
|
|
81
|
+
`${categoryName}.${name}`
|
|
82
|
+
) ?? {
|
|
83
|
+
metadata: {
|
|
84
|
+
_productsSold: 0,
|
|
85
|
+
_total: 0,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
summaryMap.set(`${categoryName}.${name}`, {
|
|
90
|
+
name,
|
|
91
|
+
key: `${eventId}.${categoryName}.${name}`,
|
|
92
|
+
quantity: totalQuantity
|
|
93
|
+
? `${
|
|
94
|
+
existingProduct.metadata._productsSold + productsSold
|
|
95
|
+
} / ${totalQuantity}`
|
|
96
|
+
: String(existingProduct.metadata._productsSold + productsSold),
|
|
97
|
+
total: String(existingProduct.metadata._total + total),
|
|
98
|
+
metadata: {
|
|
99
|
+
_productsSold:
|
|
100
|
+
existingProduct.metadata._productsSold + productsSold,
|
|
101
|
+
_total: existingProduct.metadata._total + total,
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const prevTotalPerCategory = summaryMap.get(
|
|
108
|
+
`${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`
|
|
109
|
+
) ?? {
|
|
110
|
+
quantity: 0,
|
|
111
|
+
total: 0,
|
|
112
|
+
};
|
|
113
|
+
summaryMap.set(`${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`, {
|
|
114
|
+
name: TRANSLATION_KEYS.totalPerCategory,
|
|
115
|
+
key: `${eventId}.${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`,
|
|
116
|
+
quantity: String(Number(prevTotalPerCategory.quantity) + quantity),
|
|
117
|
+
total: String(Number(prevTotalPerCategory.total) + totalPerCategory),
|
|
118
|
+
isBold: true,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
totalQuantity += quantity;
|
|
122
|
+
}
|
|
123
|
+
);
|
|
88
124
|
|
|
89
|
-
|
|
125
|
+
summaryMap.set(`${TRANSLATION_KEYS.total}.${totalAmount}`, {
|
|
90
126
|
name: TRANSLATION_KEYS.total,
|
|
91
127
|
key: `${TRANSLATION_KEYS.total}.${totalAmount}`,
|
|
92
|
-
quantity: totalQuantity,
|
|
93
|
-
total: totalAmount,
|
|
128
|
+
quantity: String(totalQuantity),
|
|
129
|
+
total: String(totalAmount),
|
|
94
130
|
isBold: true,
|
|
95
131
|
});
|
|
96
132
|
|
|
97
|
-
return
|
|
133
|
+
return [...summaryMap.values()];
|
|
98
134
|
};
|
|
@@ -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,
|