@licklist/design 0.44.476-dev.1 → 0.44.476-dev.10
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/customers/components/filter/CustomerFilter.d.ts +14 -0
- package/dist/customers/components/filter/CustomerFilter.d.ts.map +1 -0
- package/dist/customers/components/filter/CustomerFilter.js +1 -0
- package/dist/customers/components/filter/index.d.ts +3 -0
- package/dist/customers/components/filter/index.d.ts.map +1 -0
- package/dist/customers/components/index.d.ts +2 -0
- package/dist/customers/components/index.d.ts.map +1 -0
- package/dist/customers/index.d.ts +2 -0
- package/dist/customers/index.d.ts.map +1 -0
- package/dist/events/event-statistic-modal/EventStatisticModal.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/SummaryTotal/SummaryTotal.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/SummaryTotal/SummaryTotal.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +2 -1
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts +0 -4
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.js +1 -1
- package/dist/iframe/payment/order-items-table/OrderItemsTable.js +1 -1
- package/dist/iframe/payment/payment-form/PaymentForm.js +1 -1
- package/dist/iframe/ryft/RyftPaymentForm.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/product-set/form/StepsControl.js +1 -1
- package/dist/sales/manual-booking/select-menu/SelectMenu.d.ts.map +1 -1
- package/dist/sales/manual-booking/select-menu/SelectMenu.js +1 -1
- package/dist/sales/notes/NotesTableRow.d.ts.map +1 -1
- package/dist/sales/notes/NotesTableRow.js +1 -1
- package/dist/sales/notes/note-form/NoteForm.d.ts.map +1 -1
- package/dist/sales/notes/note-form/NoteForm.js +1 -1
- package/dist/setting/dashboard/snippets/card/SnippetCard.js +1 -1
- package/dist/styles/customers/Filter.scss +34 -0
- package/dist/styles/customers/_index.scss +1 -0
- package/dist/styles/iframe-events/Event.scss +0 -2
- package/dist/styles/packages.scss +1 -0
- package/dist/styles/sales/Notes.scss +0 -4
- package/dist/table/ReactTableHelperComponent.d.ts +12 -0
- package/dist/table/ReactTableHelperComponent.d.ts.map +1 -0
- package/dist/table/ReactTableHelperComponent.js +1 -0
- package/dist/table/TableHelperComponent.d.ts +2 -3
- package/dist/table/TableHelperComponent.d.ts.map +1 -1
- package/dist/table/hooks/useTableQueryOptions.d.ts +20 -0
- package/dist/table/hooks/useTableQueryOptions.d.ts.map +1 -0
- package/dist/table/hooks/useTableQueryOptions.js +1 -0
- package/dist/table/index.d.ts +1 -0
- package/dist/table/index.d.ts.map +1 -1
- package/dist/table/types.d.ts +41 -0
- package/dist/table/types.d.ts.map +1 -0
- package/dist/table/utils/index.d.ts +1 -0
- package/dist/table/utils/index.d.ts.map +1 -1
- package/dist/table/utils/index.js +1 -1
- package/package.json +2 -1
- package/src/customers/components/filter/CustomerFilter.stories.tsx +19 -0
- package/src/customers/components/filter/CustomerFilter.tsx +50 -0
- package/src/customers/components/filter/index.ts +2 -0
- package/src/customers/components/index.ts +1 -0
- package/src/customers/index.ts +1 -0
- package/src/iframe/order-process/OrderProcess.stories.tsx +2 -5
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.stories.tsx +2 -2
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +6 -13
- package/src/iframe/order-process/components/BookingSummary/components/SummaryTotal/SummaryTotal.tsx +4 -12
- package/src/iframe/order-process/components/BookingSummary/types/index.ts +2 -1
- package/src/iframe/order-process/components/BookingSummary/utils/index.ts +0 -21
- package/src/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.stories.tsx +9 -1
- package/src/iframe/ryft/RyftPaymentForm.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/product-set/form/StepsControl.tsx +1 -1
- package/src/sales/manual-booking/select-menu/SelectMenu.tsx +3 -1
- package/src/sales/notes/NotesTableRow.tsx +6 -3
- package/src/sales/notes/note-form/NoteForm.tsx +21 -3
- package/src/styles/customers/Filter.scss +34 -0
- package/src/styles/customers/_index.scss +1 -0
- package/src/styles/iframe-events/Event.scss +0 -2
- package/src/styles/packages.scss +1 -0
- package/src/styles/sales/Notes.scss +0 -4
- package/src/table/ReactTableHelperComponent.tsx +321 -0
- package/src/table/Table.stories.tsx +127 -1
- package/src/table/TableHelperComponent.tsx +3 -1
- package/src/table/hooks/useTableQueryOptions.ts +49 -0
- package/src/table/index.ts +1 -0
- package/src/table/types.ts +47 -0
- package/src/table/utils/index.ts +2 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TableComponentProps, ExtendedTableOptions } from "../types";
|
|
3
|
+
export declare const useTableQueryOptions: <T extends object>({ initialOptions, externalFilters, }: Pick<TableComponentProps<T>, "initialOptions" | "externalFilters">) => {
|
|
4
|
+
page: number;
|
|
5
|
+
perPage: number;
|
|
6
|
+
sortKey: string;
|
|
7
|
+
sortDirection: string;
|
|
8
|
+
filter: string;
|
|
9
|
+
optionsCache: ExtendedTableOptions;
|
|
10
|
+
setOptionsCache: import("react").Dispatch<import("react").SetStateAction<ExtendedTableOptions>>;
|
|
11
|
+
options: ExtendedTableOptions;
|
|
12
|
+
setOptions: import("react").Dispatch<import("react").SetStateAction<ExtendedTableOptions>>;
|
|
13
|
+
cachedExternalFilters: {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
};
|
|
16
|
+
setCachedExternalFilters: import("react").Dispatch<import("react").SetStateAction<{
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}>>;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=useTableQueryOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableQueryOptions.d.ts","sourceRoot":"","sources":["../../../src/table/hooks/useTableQueryOptions.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;CA2ChC,CAAC"}
|
|
@@ -0,0 +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=require("tslib"),r=require("react"),i=(e(r),e(require("@licklist/plugins/dist/hooks/Query/useQuery"))),s=require("../utils/index.js");exports.useTableQueryOptions=function(e){var o=e.initialOptions,a=void 0===o?{}:o,n=e.externalFilters,l=void 0===n?{}:n,u=i(),p=Number(s.getFilterOptionsValue(u,a,"page")),c=Number(s.getFilterOptionsValue(u,a,"perPage")),g=String(s.getFilterOptionsValue(u,a,"sortKey")),d=String(s.getFilterOptionsValue(u,a,"sortDirection")),O=String(s.getFilterOptionsValue(u,a,"filter")),f=t.__read(r.useState(),2),y=f[0],F=f[1],_=t.__read(r.useState({page:p,perPage:c,sortKey:g,sortDirection:d,filter:O}),2),b=_[0],x=_[1],S=t.__read(r.useState(l),2);return{page:p,perPage:c,sortKey:g,sortDirection:d,filter:O,optionsCache:y,setOptionsCache:F,options:b,setOptions:x,cachedExternalFilters:S[0],setCachedExternalFilters:S[1]}};
|
package/dist/table/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/table/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/table/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ReactNode, CSSProperties } from "react";
|
|
2
|
+
import { TableOptions, ColumnDef, Row as TableRow } from "@tanstack/react-table";
|
|
3
|
+
import ILengthAwarePaginator from "@licklist/plugins/dist/types/services/Table/ILengthAwarePaginator";
|
|
4
|
+
import ITableHeader from "@licklist/plugins/dist/types/services/Table/ITableHeader";
|
|
5
|
+
import ITableProps from "@licklist/plugins/dist/types/services/Table/ITableProps";
|
|
6
|
+
export declare type ReactTableHelperRow<T extends object> = TableRow<T>;
|
|
7
|
+
export declare type ExtendedTableOptions = ITableProps & {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
};
|
|
10
|
+
export interface TableComponentProps<T extends object> extends Omit<TableOptions<T>, "columns" | "data" | "getCoreRowModel"> {
|
|
11
|
+
paginator?: ILengthAwarePaginator<T>;
|
|
12
|
+
isLoading?: boolean;
|
|
13
|
+
striped?: boolean;
|
|
14
|
+
bordered?: boolean;
|
|
15
|
+
displaySearchBar?: boolean;
|
|
16
|
+
displayPerPageSelect?: boolean;
|
|
17
|
+
displayShowingSection?: boolean;
|
|
18
|
+
externalFilters?: {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
};
|
|
21
|
+
initialOptions?: Partial<ITableProps>;
|
|
22
|
+
sortableColumns?: string[];
|
|
23
|
+
}
|
|
24
|
+
export declare type TableColumnMeta = {
|
|
25
|
+
onClick?: () => void;
|
|
26
|
+
className?: string;
|
|
27
|
+
style?: CSSProperties;
|
|
28
|
+
};
|
|
29
|
+
export declare type TableComponentPropsWithOldTableData<T extends object> = {
|
|
30
|
+
headers: ITableHeader[];
|
|
31
|
+
renderItemFn: (row: T, index: number) => void;
|
|
32
|
+
columns?: never;
|
|
33
|
+
renderRow?: never;
|
|
34
|
+
};
|
|
35
|
+
export declare type TableComponentPropsWithReactTableData<T extends object> = {
|
|
36
|
+
headers?: never;
|
|
37
|
+
renderItemFn?: never;
|
|
38
|
+
columns: ColumnDef<T, any>[];
|
|
39
|
+
renderRow: (row: ReactTableHelperRow<T>) => ReactNode;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/table/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EACL,YAAY,EACZ,SAAS,EACT,GAAG,IAAI,QAAQ,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,qBAAqB,MAAM,mEAAmE,CAAC;AACtG,OAAO,YAAY,MAAM,0DAA0D,CAAC;AACpF,OAAO,WAAW,MAAM,yDAAyD,CAAC;AAElF,oBAAY,mBAAmB,CAAC,CAAC,SAAS,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;AAEhE,oBAAY,oBAAoB,GAAG,WAAW,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAAC;AAExE,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM,CACnD,SAAQ,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,iBAAiB,CAAC;IACrE,SAAS,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,eAAe,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IACzC,cAAc,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,oBAAY,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF,oBAAY,mCAAmC,CAAC,CAAC,SAAS,MAAM,IAAI;IAClE,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,YAAY,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB,CAAC;AAEF,oBAAY,qCAAqC,CAAC,CAAC,SAAS,MAAM,IAAI;IACpE,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,OAAO,EAAE,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;IAC7B,SAAS,EAAE,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;CACvD,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import ITableProps from "@licklist/plugins/dist/types/services/Table/ITableProps";
|
|
2
|
+
export { flexRender } from "@tanstack/react-table";
|
|
2
3
|
export declare const getFilterOptionsValue: (query: URLSearchParams, initialOptions: Partial<ITableProps>, key: keyof ITableProps) => string | number;
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,yDAAyD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,yDAAyD,CAAC;AAGlF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAUnD,eAAO,MAAM,qBAAqB,UACzB,eAAe,kBACN,QAAQ,WAAW,CAAC,OAC/B,MAAM,WAAW,oBAWvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("@licklist/plugins/dist/services/Table/TableService"))&&"object"==typeof e&&"default"in e?e.default:e,r={page:t.DEFAULT_PAGE,perPage:t.DEFAULT_PER_PAGE,sortDirection:t.DEFAULT_SORT_DIRECTION,sortKey:t.DEFAULT_SORT_KEY,filter:""};exports.getFilterOptionsValue=function(e,t,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("@licklist/plugins/dist/services/Table/TableService"))&&"object"==typeof e&&"default"in e?e.default:e,r=require("@tanstack/react-table"),i={page:t.DEFAULT_PAGE,perPage:t.DEFAULT_PER_PAGE,sortDirection:t.DEFAULT_SORT_DIRECTION,sortKey:t.DEFAULT_SORT_KEY,filter:""};Object.defineProperty(exports,"flexRender",{enumerable:!0,get:function(){return r.flexRender}}),exports.getFilterOptionsValue=function(e,t,r){return e.get(r)?e.get(r):t[r]?t[r]:i[r]};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@licklist/design",
|
|
3
|
-
"version": "0.44.476-dev.
|
|
3
|
+
"version": "0.44.476-dev.10",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"@storybook/react": "6.3.12",
|
|
72
72
|
"@svgr/rollup": "5.5.0",
|
|
73
73
|
"@svgr/webpack": "5.5.0",
|
|
74
|
+
"@tanstack/react-table": "8.10.6",
|
|
74
75
|
"@testing-library/jest-dom": "5.16.1",
|
|
75
76
|
"@testing-library/react": "11.2.5",
|
|
76
77
|
"@testing-library/react-hooks": "5.1.0",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Meta, Story } from "@storybook/react";
|
|
3
|
+
import { CustomerFilter, CustomerFilterProps } from "./CustomerFilter";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Customers/Filter",
|
|
7
|
+
component: CustomerFilter,
|
|
8
|
+
} as Meta;
|
|
9
|
+
|
|
10
|
+
export const Default: Story<CustomerFilterProps> = () => {
|
|
11
|
+
const [values, setValues] = useState({
|
|
12
|
+
first_name: "",
|
|
13
|
+
last_name: "",
|
|
14
|
+
email: "",
|
|
15
|
+
phone: "",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return <CustomerFilter values={values} onChange={setValues} />;
|
|
19
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { TextField } from "../../../static/TextField";
|
|
5
|
+
|
|
6
|
+
type CustomerFilterValues = {
|
|
7
|
+
first_name: string;
|
|
8
|
+
last_name: string;
|
|
9
|
+
email: string;
|
|
10
|
+
phone: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const FILTER_FIELDS = {
|
|
14
|
+
first_name: "firstName",
|
|
15
|
+
last_name: "lastName",
|
|
16
|
+
email: "email",
|
|
17
|
+
phone: "phone",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export interface CustomerFilterProps {
|
|
21
|
+
values: CustomerFilterValues;
|
|
22
|
+
onChange: (values: CustomerFilterValues) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const CustomerFilter = ({ values, onChange }: CustomerFilterProps) => {
|
|
26
|
+
const { t } = useTranslation(["Design"]);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div className="customers-filter d-flex">
|
|
30
|
+
<div className="d-flex customers-filter-items">
|
|
31
|
+
{Object.keys(FILTER_FIELDS).map((filterKeyName) => {
|
|
32
|
+
const label = t(FILTER_FIELDS[filterKeyName]);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<TextField
|
|
36
|
+
key={filterKeyName}
|
|
37
|
+
className={clsx("mb-0")}
|
|
38
|
+
type="text"
|
|
39
|
+
label={label}
|
|
40
|
+
value={values[filterKeyName]}
|
|
41
|
+
onChange={(event) =>
|
|
42
|
+
onChange({ ...values, [filterKeyName]: event.target.value })
|
|
43
|
+
}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
})}
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./filter";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./components";
|
|
@@ -15,7 +15,6 @@ import { StepsForm } from "./components/StepsForm";
|
|
|
15
15
|
import { Page, PageBody, PageHeader } from "../page";
|
|
16
16
|
import { StepsFormRef } from "./components/StepsForm/StepsForm";
|
|
17
17
|
import { BookingSummaryFooter } from "./components/BookingSummaryFooter";
|
|
18
|
-
import { sanitizeFormValues } from "./components/BookingSummary/utils";
|
|
19
18
|
import { Order } from "../../types";
|
|
20
19
|
// eslint-disable-next-line max-len
|
|
21
20
|
import { RenderNumberOfPeopleInputComponent } from "../event/event-details/components/number-of-people-input/component/RenderNumberOfPeopleInputComponent";
|
|
@@ -267,10 +266,7 @@ export function Default() {
|
|
|
267
266
|
};
|
|
268
267
|
|
|
269
268
|
const shouldShowPeopleInput = useMemo(() => {
|
|
270
|
-
const
|
|
271
|
-
sanitizeFormValues(formValues);
|
|
272
|
-
|
|
273
|
-
const values = Object.values(orderProducts).filter(
|
|
269
|
+
const values = Object.values(formValues).filter(
|
|
274
270
|
Boolean
|
|
275
271
|
) as Order[];
|
|
276
272
|
const filteredValues = values.filter(
|
|
@@ -347,6 +343,7 @@ export function Default() {
|
|
|
347
343
|
date="29 Sept 2022 at 09:00"
|
|
348
344
|
menuSteps={menuSteps as any}
|
|
349
345
|
formValues={formValues}
|
|
346
|
+
peopleAmount={peopleAmount}
|
|
350
347
|
totalWithDiscount={5}
|
|
351
348
|
eventName="Glam!"
|
|
352
349
|
/>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { Meta } from "@storybook/react";
|
|
3
3
|
import { BookingSummary } from "./BookingSummary";
|
|
4
4
|
|
|
@@ -139,6 +139,7 @@ export function Default() {
|
|
|
139
139
|
<BookingSummary
|
|
140
140
|
date="29 Sept 2022 at 09:00"
|
|
141
141
|
menuSteps={menuSteps as any}
|
|
142
|
+
peopleAmount={5}
|
|
142
143
|
formValues={{
|
|
143
144
|
"3": {
|
|
144
145
|
id: 3,
|
|
@@ -161,7 +162,6 @@ export function Default() {
|
|
|
161
162
|
price: 1,
|
|
162
163
|
productsCategoryId: 1,
|
|
163
164
|
},
|
|
164
|
-
numberOfPeople: 5,
|
|
165
165
|
}}
|
|
166
166
|
totalWithDiscount={5}
|
|
167
167
|
transactionFee={0.01}
|
|
@@ -6,7 +6,6 @@ import { LoaderIndicator } from "../../../../static";
|
|
|
6
6
|
import { MenuStep, Order } from "../../../../types";
|
|
7
7
|
import { ProductsByMenuStep } from "./components/ProductsByMenuStep";
|
|
8
8
|
import { BookingSummaryProps } from "./types";
|
|
9
|
-
import { sanitizeFormValues } from "./utils";
|
|
10
9
|
import { SummaryTotal } from "./components/SummaryTotal";
|
|
11
10
|
import { BookingSummaryAccordion } from "./components/BookingSummaryAccordion";
|
|
12
11
|
|
|
@@ -20,21 +19,15 @@ export const BookingSummary = ({
|
|
|
20
19
|
productsWithErrors,
|
|
21
20
|
isLoading,
|
|
22
21
|
hasPeopleInput,
|
|
22
|
+
peopleAmount,
|
|
23
23
|
}: Omit<BookingSummaryProps, "totallWithDiscount">) => {
|
|
24
24
|
const { t } = useTranslation("Design");
|
|
25
25
|
const { formatNumber } = useIntl();
|
|
26
26
|
|
|
27
|
-
const
|
|
28
|
-
const
|
|
27
|
+
const orderProducts = useMemo(() => {
|
|
28
|
+
const products = Object.values(formValues).filter(Boolean) as Order[];
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
(productId) => orderProducts[productId]
|
|
32
|
-
) as Order[];
|
|
33
|
-
|
|
34
|
-
return [
|
|
35
|
-
numberOfPeople as number,
|
|
36
|
-
products.filter((prod) => prod.quantity !== 0),
|
|
37
|
-
];
|
|
30
|
+
return products?.filter((prod) => prod?.quantity !== 0);
|
|
38
31
|
}, [formValues]);
|
|
39
32
|
|
|
40
33
|
if (isLoading) {
|
|
@@ -67,12 +60,12 @@ export const BookingSummary = ({
|
|
|
67
60
|
/>
|
|
68
61
|
);
|
|
69
62
|
})}
|
|
70
|
-
{!isNotShownPeopleAmount &&
|
|
63
|
+
{!isNotShownPeopleAmount && peopleAmount > 0 && (
|
|
71
64
|
<>
|
|
72
65
|
<hr />
|
|
73
66
|
<div className="d-flex justify-content-between mt-3">
|
|
74
67
|
<p className="m-0">{t("people")}:</p>
|
|
75
|
-
<p className="price">{
|
|
68
|
+
<p className="price">{peopleAmount}</p>
|
|
76
69
|
</div>
|
|
77
70
|
</>
|
|
78
71
|
)}
|
package/src/iframe/order-process/components/BookingSummary/components/SummaryTotal/SummaryTotal.tsx
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
|
-
import { Order } from "../../../../../../types";
|
|
4
3
|
import { BookingSummaryProps } from "../../types";
|
|
5
|
-
import {
|
|
4
|
+
import { cartSumByOrderProducts } from "../../utils";
|
|
6
5
|
import { SummaryTotalBlock } from "./components/SummaryTotalBlock";
|
|
7
6
|
|
|
8
7
|
export const SummaryTotal = ({
|
|
@@ -15,17 +14,10 @@ export const SummaryTotal = ({
|
|
|
15
14
|
"formValues" | "totalWithDiscount" | "transactionFee" | "isFreePayment"
|
|
16
15
|
>) => {
|
|
17
16
|
const { t } = useTranslation("Design");
|
|
18
|
-
const
|
|
19
|
-
const
|
|
17
|
+
const orderProducts = useMemo(() => {
|
|
18
|
+
const products = Object.values(formValues).filter(Boolean);
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
(productId) => orderProducts[productId]
|
|
23
|
-
) as Order[];
|
|
24
|
-
|
|
25
|
-
return [
|
|
26
|
-
numberOfPeople as number,
|
|
27
|
-
products.filter((prod) => prod.quantity !== 0),
|
|
28
|
-
];
|
|
20
|
+
return products.filter((prod) => prod?.quantity !== 0);
|
|
29
21
|
}, [formValues]);
|
|
30
22
|
|
|
31
23
|
const cartSum = isFreePayment
|
|
@@ -8,7 +8,7 @@ export type BookingSummaryProps = {
|
|
|
8
8
|
date: string;
|
|
9
9
|
menuSteps: MenuStep[];
|
|
10
10
|
formValues: {
|
|
11
|
-
[key: string]: Order
|
|
11
|
+
[key: string]: Order;
|
|
12
12
|
};
|
|
13
13
|
totalWithDiscount?: number;
|
|
14
14
|
isNotShownPeopleAmount?: boolean;
|
|
@@ -18,4 +18,5 @@ export type BookingSummaryProps = {
|
|
|
18
18
|
isFreePayment?: boolean;
|
|
19
19
|
productsWithErrors?: ProductQuantityCheckResponse["products"];
|
|
20
20
|
isLoading?: boolean;
|
|
21
|
+
peopleAmount: number;
|
|
21
22
|
};
|
|
@@ -1,25 +1,4 @@
|
|
|
1
1
|
import { Order } from "../../../../../types";
|
|
2
|
-
import { BookingSummaryProps } from "../types";
|
|
3
|
-
|
|
4
|
-
export const sanitizeFormValues = (
|
|
5
|
-
formValues: BookingSummaryProps["formValues"]
|
|
6
|
-
) =>
|
|
7
|
-
Object.keys(formValues).reduce(
|
|
8
|
-
(
|
|
9
|
-
prevValues: {
|
|
10
|
-
[key: string]: Order | number;
|
|
11
|
-
},
|
|
12
|
-
currentKey: string
|
|
13
|
-
) => {
|
|
14
|
-
const value = formValues[currentKey];
|
|
15
|
-
if (value) {
|
|
16
|
-
return { ...prevValues, [currentKey]: value };
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return prevValues;
|
|
20
|
-
},
|
|
21
|
-
{}
|
|
22
|
-
);
|
|
23
2
|
|
|
24
3
|
export const cartSumByOrderProducts = (orderProducts: Order[]) =>
|
|
25
4
|
orderProducts.reduce((prevSumValue: number, product) => {
|
|
@@ -174,7 +174,12 @@ const OrderProcessContextProvider: React.FC = ({ children }) => {
|
|
|
174
174
|
|
|
175
175
|
return (
|
|
176
176
|
<OrderProcessContext.Provider
|
|
177
|
-
value={{
|
|
177
|
+
value={{
|
|
178
|
+
orderFormValues,
|
|
179
|
+
setOrderFormValues,
|
|
180
|
+
formValues,
|
|
181
|
+
setFormValues,
|
|
182
|
+
}}
|
|
178
183
|
>
|
|
179
184
|
{children}
|
|
180
185
|
</OrderProcessContext.Provider>
|
|
@@ -403,6 +408,8 @@ const MENU_STEPS = [
|
|
|
403
408
|
|
|
404
409
|
export function Default() {
|
|
405
410
|
const { formValues, setFormValues } = useContext(OrderProcessContext);
|
|
411
|
+
const [peopleAmount] = useState(0);
|
|
412
|
+
|
|
406
413
|
return (
|
|
407
414
|
<div className="snippet">
|
|
408
415
|
<OrderProcessContextProvider>
|
|
@@ -434,6 +441,7 @@ export function Default() {
|
|
|
434
441
|
<BookingSummary
|
|
435
442
|
date="29 Sept 2022 at 09:00"
|
|
436
443
|
menuSteps={menuSteps as any}
|
|
444
|
+
peopleAmount={peopleAmount}
|
|
437
445
|
formValues={formValues}
|
|
438
446
|
totalWithDiscount={5}
|
|
439
447
|
eventName="Glam!"
|
|
@@ -183,7 +183,7 @@ export const RyftPaymentForm = ({
|
|
|
183
183
|
onSubmit={methods.handleSubmit(handleSubmit)}
|
|
184
184
|
className="ryft-payment-form"
|
|
185
185
|
>
|
|
186
|
-
<div className="submit-button-wrapper mt-3
|
|
186
|
+
<div className="submit-button-wrapper mt-3 p-1">
|
|
187
187
|
<Button type="submit" disabled={isBtnDisabled || !isValid}>
|
|
188
188
|
{isBtnDisabled && <ButtonLoader />}
|
|
189
189
|
{t("Design:buyNow")}
|
package/src/index.ts
CHANGED
|
@@ -32,7 +32,9 @@ export const SelectMenu = ({
|
|
|
32
32
|
<div>
|
|
33
33
|
{(!menus || !menus.length) && !isLoading ? (
|
|
34
34
|
<div className="no-results-content">
|
|
35
|
-
<span className="no-results-found">
|
|
35
|
+
<span className="no-results-found">
|
|
36
|
+
{t("App:noResultsFoundForSelectedDate")}
|
|
37
|
+
</span>
|
|
36
38
|
</div>
|
|
37
39
|
) : (
|
|
38
40
|
<>
|
|
@@ -6,7 +6,10 @@ import { useTranslation } from "react-i18next";
|
|
|
6
6
|
import { Note } from "@licklist/core/dist/DataMapper/Order/NoteDataMapper";
|
|
7
7
|
import { capitalize } from "lodash";
|
|
8
8
|
import { DateTime } from "luxon";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
DATE_TIME_FORMAT,
|
|
11
|
+
DATE_TIME_FULL_FORMAT,
|
|
12
|
+
} from "@licklist/core/dist/Config";
|
|
10
13
|
import { ConfirmModal } from "../../modals";
|
|
11
14
|
import { MenuButton } from "../../table";
|
|
12
15
|
import { Icon } from "../../static";
|
|
@@ -25,7 +28,7 @@ export const TableRow = ({ note, onClick, onDeleteNote }: TableRowProps) => {
|
|
|
25
28
|
const date = DateTime.fromFormat(
|
|
26
29
|
note.updatedAt,
|
|
27
30
|
DATE_TIME_FULL_FORMAT
|
|
28
|
-
).toFormat(
|
|
31
|
+
).toFormat(DATE_TIME_FORMAT);
|
|
29
32
|
|
|
30
33
|
return (
|
|
31
34
|
<tr onClick={onClick}>
|
|
@@ -33,7 +36,7 @@ export const TableRow = ({ note, onClick, onDeleteNote }: TableRowProps) => {
|
|
|
33
36
|
<td className="note-author">
|
|
34
37
|
{capitalize(note.user.firstName)} {capitalize(note.user.lastName)}
|
|
35
38
|
</td>
|
|
36
|
-
<td className="
|
|
39
|
+
<td className="text-nowrap">{date}</td>
|
|
37
40
|
<td>
|
|
38
41
|
<div className="controls">
|
|
39
42
|
<span className="btn btn-sm eye">
|
|
@@ -19,7 +19,12 @@ export const NoteForm = ({
|
|
|
19
19
|
onClose,
|
|
20
20
|
defaultValues = { note: "" },
|
|
21
21
|
}: NoteFormProps) => {
|
|
22
|
-
const {
|
|
22
|
+
const {
|
|
23
|
+
register,
|
|
24
|
+
handleSubmit,
|
|
25
|
+
formState: { errors },
|
|
26
|
+
setValue,
|
|
27
|
+
} = useForm<FormModel>({
|
|
23
28
|
mode: "onChange",
|
|
24
29
|
defaultValues,
|
|
25
30
|
});
|
|
@@ -37,9 +42,18 @@ export const NoteForm = ({
|
|
|
37
42
|
<Form.Control
|
|
38
43
|
as="textarea"
|
|
39
44
|
rows={5}
|
|
45
|
+
isInvalid={!!errors.note}
|
|
40
46
|
placeholder={t("writeYourNoteHere")}
|
|
41
|
-
{...register("note"
|
|
47
|
+
{...register("note", {
|
|
48
|
+
required: {
|
|
49
|
+
value: true,
|
|
50
|
+
message: t("Validation:fieldRequired"),
|
|
51
|
+
},
|
|
52
|
+
})}
|
|
42
53
|
/>
|
|
54
|
+
<Form.Control.Feedback type="invalid">
|
|
55
|
+
{errors.note?.message}
|
|
56
|
+
</Form.Control.Feedback>
|
|
43
57
|
</Form.Group>
|
|
44
58
|
|
|
45
59
|
<footer className="d-flex">
|
|
@@ -52,7 +66,11 @@ export const NoteForm = ({
|
|
|
52
66
|
>
|
|
53
67
|
{t("close")}
|
|
54
68
|
</Button>
|
|
55
|
-
<Button
|
|
69
|
+
<Button
|
|
70
|
+
variant="danger"
|
|
71
|
+
className="ml-2"
|
|
72
|
+
onClick={() => setValue("note", "")}
|
|
73
|
+
>
|
|
56
74
|
{t("delete")}
|
|
57
75
|
</Button>
|
|
58
76
|
</footer>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.customers-filter {
|
|
2
|
+
gap: 0.5rem;
|
|
3
|
+
|
|
4
|
+
@include media-breakpoint-down(sm) {
|
|
5
|
+
label {
|
|
6
|
+
font-size: 0.8rem;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@include media-breakpoint-up(md) {
|
|
11
|
+
label {
|
|
12
|
+
font-size: 0.9rem;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@include media-breakpoint-up(lg) {
|
|
17
|
+
label {
|
|
18
|
+
font-size: 1rem;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@include media-breakpoint-down(lg) {
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.customers-filter-items {
|
|
27
|
+
gap: 0.5rem;
|
|
28
|
+
|
|
29
|
+
@include media-breakpoint-down(xs) {
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
gap: 0rem;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "./Filter.scss";
|
|
@@ -91,11 +91,9 @@
|
|
|
91
91
|
|
|
92
92
|
&__select-product {
|
|
93
93
|
width: 10.5rem !important;
|
|
94
|
-
margin-top: 1rem;
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
&__unselect-product {
|
|
98
|
-
margin-top: 1rem;
|
|
99
97
|
width: 10.5rem !important;
|
|
100
98
|
background-color: $snippet-elements-button-color !important;
|
|
101
99
|
color: $snippet-elements-button-background-color !important;
|
package/src/styles/packages.scss
CHANGED