mautourco-components 0.2.43 → 0.2.45
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/components/organisms/QuoteHeader/QuoteHeader.d.ts +3 -1
- package/dist/components/organisms/QuoteHeader/QuoteHeader.js +37 -4
- package/dist/components/organisms/Table/Table.css +5 -0
- package/dist/components/organisms/Table/columns/booking-columns.d.ts +2 -2
- package/dist/components/organisms/Table/columns/booking-columns.js +24 -4
- package/dist/components/organisms/Table/columns/index.d.ts +5 -4
- package/dist/components/organisms/Table/columns/quotation-columns.d.ts +3 -2
- package/dist/components/organisms/Table/columns/quotation-columns.js +25 -5
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/organisms/QuoteHeader/QuoteHeader.tsx +41 -6
- package/src/components/organisms/Table/Table.css +5 -0
- package/src/components/organisms/Table/columns/booking-columns.tsx +50 -14
- package/src/components/organisms/Table/columns/quotation-columns.tsx +55 -16
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import './QuoteHeader.css';
|
|
2
|
+
export type FilterType = 'date' | 'clientType' | 'fileStatus' | 'search';
|
|
2
3
|
export interface QuoteHeaderProps {
|
|
3
4
|
/** Current tab */
|
|
4
5
|
current: 'quotation' | 'booking';
|
|
@@ -6,6 +7,7 @@ export interface QuoteHeaderProps {
|
|
|
6
7
|
onNavigate: (tab: 'quotation' | 'booking') => void;
|
|
7
8
|
/** Callback to create a new quote */
|
|
8
9
|
onNewQuote: () => void;
|
|
9
|
-
onFilterChange?: (filter:
|
|
10
|
+
onFilterChange?: (filter: FilterType, value: string) => void;
|
|
11
|
+
currentFilter?: Record<FilterType, string>;
|
|
10
12
|
}
|
|
11
13
|
export declare function QuoteHeader(props: QuoteHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,8 +9,19 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
12
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useState } from 'react';
|
|
24
|
+
import { useEffect, useState } from 'react';
|
|
14
25
|
import Button from '../../atoms/Button/Button';
|
|
15
26
|
import DropdownInput from '../../atoms/Inputs/DropdownInput/DropdownInput';
|
|
16
27
|
import Input from '../../atoms/Inputs/Input/Input';
|
|
@@ -32,9 +43,31 @@ var filterConfig = {
|
|
|
32
43
|
},
|
|
33
44
|
};
|
|
34
45
|
export function QuoteHeader(props) {
|
|
35
|
-
var _a
|
|
36
|
-
var _b =
|
|
37
|
-
|
|
46
|
+
var _a;
|
|
47
|
+
var _b = props.current, current = _b === void 0 ? 'quotation' : _b, currentFilter = props.currentFilter, onNavigate = props.onNavigate, onNewQuote = props.onNewQuote, onFilterChange = props.onFilterChange;
|
|
48
|
+
var _c = useState(currentFilter || {
|
|
49
|
+
date: '',
|
|
50
|
+
clientType: '',
|
|
51
|
+
fileStatus: '',
|
|
52
|
+
search: '',
|
|
53
|
+
}), currentValue = _c[0], setCurrentValue = _c[1];
|
|
54
|
+
var _d = useState((_a = currentFilter === null || currentFilter === void 0 ? void 0 : currentFilter.search) !== null && _a !== void 0 ? _a : ''), searchValue = _d[0], setSearchValue = _d[1];
|
|
55
|
+
useEffect(function () {
|
|
56
|
+
if (currentFilter && Object.keys(currentFilter).length > 0) {
|
|
57
|
+
var search = currentFilter.search, rest = __rest(currentFilter, ["search"]);
|
|
58
|
+
setCurrentValue(rest);
|
|
59
|
+
setSearchValue(search);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
setCurrentValue({});
|
|
63
|
+
setSearchValue('');
|
|
64
|
+
}
|
|
65
|
+
}, [currentFilter]);
|
|
66
|
+
return (_jsxs("div", { className: "quote-header", children: [_jsx(Heading, { level: 4, as: "h1", className: "quote-header__title", color: "accent", children: "Quotation & Booking" }), _jsxs("div", { className: "flex gap-4", children: [_jsx(Button, { variant: current === 'quotation' ? 'primary' : 'outline-primary', className: "quote-header__button", onClick: function () { return onNavigate('quotation'); }, children: "Quotation" }), _jsx(Button, { variant: current === 'booking' ? 'primary' : 'outline-primary', className: "quote-header__button", onClick: function () { return onNavigate('booking'); }, children: "Booking" })] }), _jsxs("div", { className: "quote-header__search-container", children: [_jsx(Input, { placeholder: "Search", icon: "search", iconPosition: "leading", className: "quote-header__search", value: searchValue, onChange: function (e) {
|
|
67
|
+
onFilterChange === null || onFilterChange === void 0 ? void 0 : onFilterChange('search', e.target.value);
|
|
68
|
+
setCurrentValue(__assign(__assign({}, currentValue), { search: e.target.value }));
|
|
69
|
+
setSearchValue(e.target.value);
|
|
70
|
+
} }), _jsx(Button, { variant: "primary", leadingIcon: "plus-circle", iconSize: "md", size: "sm", onClick: onNewQuote, children: "New quote" })] }), _jsx("div", { className: "quote-header__filters", children: Object.entries(filterConfig).map(function (_a) {
|
|
38
71
|
var key = _a[0], value = _a[1];
|
|
39
72
|
return (_jsx(DropdownInput, { placeholder: value.placeholder, options: value.options, value: currentValue[key], onSelect: function (value) {
|
|
40
73
|
var _a;
|
|
@@ -2,6 +2,6 @@ import { ActionDropdownType } from '@/src/types/table';
|
|
|
2
2
|
import { BookingListItem } from '@/src/types/table/booking.types';
|
|
3
3
|
import { ColumnType } from '../TableCell';
|
|
4
4
|
export declare const bookingColumns: (params: {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
onAction?: (action: ActionDropdownType) => void;
|
|
6
|
+
keywords?: string;
|
|
7
7
|
}) => ColumnType<BookingListItem>[];
|
|
@@ -6,19 +6,39 @@ import { DateDisplay } from '../../../molecules/DateDisplay/DateDisplay';
|
|
|
6
6
|
import { PaxChips } from '../../../molecules/PaxChips/PaxChips';
|
|
7
7
|
import { actionDropdownData } from '../constant';
|
|
8
8
|
export var bookingColumns = function (_a) {
|
|
9
|
-
var
|
|
9
|
+
var onAction = _a.onAction, _b = _a.keywords, keywords = _b === void 0 ? '' : _b;
|
|
10
10
|
return [
|
|
11
11
|
{
|
|
12
12
|
header: 'Quote nb.',
|
|
13
13
|
key: 'booking_id',
|
|
14
14
|
width: 150,
|
|
15
|
-
cell: function (value) {
|
|
15
|
+
cell: function (value) {
|
|
16
|
+
if (value === void 0) { value = ''; }
|
|
17
|
+
var currentValue = String(value);
|
|
18
|
+
var regex = new RegExp("(".concat(keywords !== null && keywords !== void 0 ? keywords : '', ")"), 'gi');
|
|
19
|
+
if (regex.test(currentValue)) {
|
|
20
|
+
return (_jsx(Text, { variant: "medium", size: "sm", children: _jsx("span", { dangerouslySetInnerHTML: {
|
|
21
|
+
__html: currentValue.replace(regex, "<span class=\"text--highlight\">$1</span>"),
|
|
22
|
+
} }) }));
|
|
23
|
+
}
|
|
24
|
+
return (_jsx(Text, { variant: "medium", size: "sm", children: currentValue }));
|
|
25
|
+
},
|
|
16
26
|
},
|
|
17
27
|
{
|
|
18
28
|
header: 'Client name',
|
|
19
29
|
key: 'agency_name',
|
|
20
30
|
width: 150,
|
|
21
|
-
cell: function (value) {
|
|
31
|
+
cell: function (value) {
|
|
32
|
+
if (value === void 0) { value = ''; }
|
|
33
|
+
var currentValue = String(value);
|
|
34
|
+
var regex = new RegExp("(".concat(keywords !== null && keywords !== void 0 ? keywords : '', ")"), 'gi');
|
|
35
|
+
if (regex.test(currentValue)) {
|
|
36
|
+
return (_jsx(Text, { variant: "medium", size: "sm", children: _jsx("span", { dangerouslySetInnerHTML: {
|
|
37
|
+
__html: currentValue.replace(regex, "<span class=\"text--highlight\">$1</span>"),
|
|
38
|
+
} }) }));
|
|
39
|
+
}
|
|
40
|
+
return (_jsx(Text, { variant: "medium", size: "sm", children: currentValue }));
|
|
41
|
+
},
|
|
22
42
|
},
|
|
23
43
|
{
|
|
24
44
|
header: 'Type',
|
|
@@ -61,7 +81,7 @@ export var bookingColumns = function (_a) {
|
|
|
61
81
|
key: 'actions',
|
|
62
82
|
width: 232,
|
|
63
83
|
cell: function (_value, raw) {
|
|
64
|
-
return (_jsx("div", { children: _jsxs("div", { className: "flex items-center gap-x-8", children: [_jsxs("div", { className: "flex items-center gap-x-3", children: [_jsx(Button, { variant: "secondary", size: "sm", className: "w-[89px]", children: "Proforma" }), _jsx(Button, { variant: "outline-secondary", size: "sm", className: "w-[89px]", children: "Voucher" })] }), _jsx(ActionDropdown, { data: actionDropdownData(onAction) })] }) }));
|
|
84
|
+
return (_jsx("div", { children: _jsxs("div", { className: "flex items-center gap-x-8", children: [_jsxs("div", { className: "flex items-center gap-x-3", children: [_jsx(Button, { variant: "secondary", size: "sm", className: "w-[89px]", children: "Proforma" }), _jsx(Button, { variant: "outline-secondary", size: "sm", className: "w-[89px]", children: "Voucher" })] }), _jsx(ActionDropdown, { data: actionDropdownData(onAction !== null && onAction !== void 0 ? onAction : (function () { })) })] }) }));
|
|
65
85
|
},
|
|
66
86
|
},
|
|
67
87
|
];
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
declare const columns: {
|
|
2
2
|
quotation: (params: {
|
|
3
|
-
onExpand
|
|
4
|
-
onAction
|
|
3
|
+
onExpand?: (value?: import("../../../..").QuotationListItem) => void;
|
|
4
|
+
onAction?: (data: {
|
|
5
5
|
isChild?: boolean;
|
|
6
6
|
quote: import("../../../..").QuotationListItem;
|
|
7
7
|
}) => (action: import("../../../..").ActionDropdownType) => void;
|
|
8
|
+
keywords?: string;
|
|
8
9
|
}) => import("../TableCell").ColumnType<import("../../../..").QuotationListItem>[];
|
|
9
10
|
detailResume: (params?: {
|
|
10
11
|
onRemove?: (value: import("../../../..").DetailResumeItem, index?: number) => void;
|
|
11
12
|
}) => import("../TableCell").ColumnType<import("../../../..").DetailResumeItem>[];
|
|
12
13
|
booking: (params: {
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
onAction?: (action: import("../../../..").ActionDropdownType) => void;
|
|
15
|
+
keywords?: string;
|
|
15
16
|
}) => import("../TableCell").ColumnType<import("../../../../types/table/booking.types").BookingListItem>[];
|
|
16
17
|
bookingCancelService: (params?: {
|
|
17
18
|
onRemove?: (value: import("../../../..").DetailResumeItem, index?: number, childIndex?: number) => void;
|
|
@@ -2,9 +2,10 @@ import { ActionDropdownType } from '@/src/types/table/action-dropdown-type.types
|
|
|
2
2
|
import { QuotationListItem } from '@/src/types/table/quotation.types';
|
|
3
3
|
import { ColumnType } from '../TableCell';
|
|
4
4
|
export declare const quotationColumns: (params: {
|
|
5
|
-
onExpand
|
|
6
|
-
onAction
|
|
5
|
+
onExpand?: (value?: QuotationListItem) => void;
|
|
6
|
+
onAction?: (data: {
|
|
7
7
|
isChild?: boolean;
|
|
8
8
|
quote: QuotationListItem;
|
|
9
9
|
}) => (action: ActionDropdownType) => void;
|
|
10
|
+
keywords?: string;
|
|
10
11
|
}) => ColumnType<QuotationListItem>[];
|
|
@@ -7,20 +7,40 @@ import { DateDisplay } from '../../../molecules/DateDisplay/DateDisplay';
|
|
|
7
7
|
import { cn } from '../../../../lib/utils';
|
|
8
8
|
import { actionDropdownData, chipVariant, clientTypeMap } from '../constant';
|
|
9
9
|
export var quotationColumns = function (_a) {
|
|
10
|
-
var onExpand = _a.onExpand, onAction = _a.onAction;
|
|
10
|
+
var onExpand = _a.onExpand, onAction = _a.onAction, _b = _a.keywords, keywords = _b === void 0 ? '' : _b;
|
|
11
11
|
return [
|
|
12
12
|
{
|
|
13
13
|
header: 'Quote nb.',
|
|
14
14
|
key: 'file_nb',
|
|
15
15
|
width: 150,
|
|
16
|
-
cell: function (value) {
|
|
16
|
+
cell: function (value) {
|
|
17
|
+
if (value === void 0) { value = ''; }
|
|
18
|
+
var currentValue = String(value);
|
|
19
|
+
var regex = new RegExp("(".concat(keywords !== null && keywords !== void 0 ? keywords : '', ")"), 'gi');
|
|
20
|
+
if (regex.test(currentValue)) {
|
|
21
|
+
return (_jsx(Text, { variant: "medium", size: "sm", children: _jsx("span", { dangerouslySetInnerHTML: {
|
|
22
|
+
__html: currentValue.replace(regex, "<span class=\"text--highlight\">$1</span>"),
|
|
23
|
+
} }) }));
|
|
24
|
+
}
|
|
25
|
+
return (_jsx(Text, { variant: "medium", size: "sm", children: currentValue }));
|
|
26
|
+
},
|
|
17
27
|
},
|
|
18
28
|
{
|
|
19
29
|
header: 'Client name',
|
|
20
30
|
key: 'agency_name',
|
|
21
31
|
width: 150,
|
|
22
32
|
cell: function (value, _raw, _index, childIndex) {
|
|
23
|
-
|
|
33
|
+
if (value === void 0) { value = ''; }
|
|
34
|
+
if (childIndex === undefined) {
|
|
35
|
+
var currentValue = String(value);
|
|
36
|
+
var regex = new RegExp("(".concat(keywords !== null && keywords !== void 0 ? keywords : '', ")"), 'gi');
|
|
37
|
+
if (regex.test(currentValue)) {
|
|
38
|
+
return (_jsx(Text, { variant: "medium", size: "sm", children: _jsx("span", { dangerouslySetInnerHTML: {
|
|
39
|
+
__html: currentValue.replace(regex, "<span class=\"text--highlight\">$1</span>"),
|
|
40
|
+
} }) }));
|
|
41
|
+
}
|
|
42
|
+
return (_jsx(Text, { variant: "medium", size: "sm", children: currentValue }));
|
|
43
|
+
}
|
|
24
44
|
},
|
|
25
45
|
},
|
|
26
46
|
{
|
|
@@ -70,12 +90,12 @@ export var quotationColumns = function (_a) {
|
|
|
70
90
|
key: 'actions',
|
|
71
91
|
width: 232,
|
|
72
92
|
cell: function (_value, raw, _index, childIndex) {
|
|
73
|
-
var _a;
|
|
93
|
+
var _a, _b;
|
|
74
94
|
var hasChildren = raw.children && raw.children.length > 0;
|
|
75
95
|
var isExpanded = (_a = raw.children) === null || _a === void 0 ? void 0 : _a.some(function (child) { return child.visible; });
|
|
76
96
|
var buttonLabel = isExpanded ? 'See less' : 'See more';
|
|
77
97
|
var isOnRequest = raw.status.toLowerCase() === 'on request';
|
|
78
|
-
return (_jsx("div", { children: hasChildren ? (_jsx(Button, { variant: "outline-primary", size: "sm", trailingIcon: "chevron-down", className: cn('table__button', isExpanded && 'table__button-expanded'), onClick: function () { return onExpand(raw); }, children: buttonLabel })) : (_jsxs("div", { className: "flex items-center gap-x-8", children: [_jsx(Button, { variant: isOnRequest ? 'outline-secondary' : 'secondary', size: "sm", className: "table__button", children: isOnRequest ? 'Request to book' : 'Book now' }), _jsx(ActionDropdown, { data: actionDropdownData(onAction({ isChild: childIndex !== undefined, quote: raw })) })] })) }));
|
|
98
|
+
return (_jsx("div", { children: hasChildren ? (_jsx(Button, { variant: "outline-primary", size: "sm", trailingIcon: "chevron-down", className: cn('table__button', isExpanded && 'table__button-expanded'), onClick: function () { return onExpand === null || onExpand === void 0 ? void 0 : onExpand(raw); }, children: buttonLabel })) : (_jsxs("div", { className: "flex items-center gap-x-8", children: [_jsx(Button, { variant: isOnRequest ? 'outline-secondary' : 'secondary', size: "sm", className: "table__button", children: isOnRequest ? 'Request to book' : 'Book now' }), _jsx(ActionDropdown, { data: actionDropdownData((_b = onAction === null || onAction === void 0 ? void 0 : onAction({ isChild: childIndex !== undefined, quote: raw })) !== null && _b !== void 0 ? _b : (function () { })) })] })) }));
|
|
79
99
|
},
|
|
80
100
|
},
|
|
81
101
|
];
|
package/dist/index.d.ts
CHANGED
|
@@ -119,7 +119,7 @@ export type { ComparisonData, DialogComparisonProps, MultiComparisonData, } from
|
|
|
119
119
|
export type { DialogDeleteConfirmProps } from './components/organisms/DialogDeleteConfirm/DialogDeleteConfirm';
|
|
120
120
|
export type { DialogQuoteRenameProps } from './components/organisms/DialogQuoteRename/DialogQuoteRename';
|
|
121
121
|
export type { SelectedQuote } from './components/organisms/DialogSendingMail/DialogSendingMailMultiple/DialogSendingMailMultiple';
|
|
122
|
-
export type { QuoteHeaderProps } from './components/organisms/QuoteHeader/QuoteHeader';
|
|
122
|
+
export type { FilterType, QuoteHeaderProps, } from './components/organisms/QuoteHeader/QuoteHeader';
|
|
123
123
|
export type { TimelineProps, TimelineServices, } from './components/organisms/Timeline/Timeline';
|
|
124
124
|
export type { AccomodationDocket as AccomodationDocketType, ExcursionDocket as ExcursionDocketType, OtherServiceDocket as OtherServiceDocketType, ServiceDocket as ServiceDocketType, TransferDocket as TransferDocketType, } from './types/docket/services.types';
|
|
125
125
|
export * from './types/table';
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
2
|
import Button from '../../atoms/Button/Button';
|
|
3
3
|
import DropdownInput from '../../atoms/Inputs/DropdownInput/DropdownInput';
|
|
4
4
|
import Input from '../../atoms/Inputs/Input/Input';
|
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
} from './constant';
|
|
11
11
|
import './QuoteHeader.css';
|
|
12
12
|
|
|
13
|
+
export type FilterType = 'date' | 'clientType' | 'fileStatus' | 'search';
|
|
14
|
+
|
|
13
15
|
export interface QuoteHeaderProps {
|
|
14
16
|
/** Current tab */
|
|
15
17
|
current: 'quotation' | 'booking';
|
|
@@ -20,7 +22,9 @@ export interface QuoteHeaderProps {
|
|
|
20
22
|
/** Callback to create a new quote */
|
|
21
23
|
onNewQuote: () => void;
|
|
22
24
|
|
|
23
|
-
onFilterChange?: (filter:
|
|
25
|
+
onFilterChange?: (filter: FilterType, value: string) => void;
|
|
26
|
+
|
|
27
|
+
currentFilter?: Record<FilterType, string>;
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
const filterConfig = {
|
|
@@ -39,8 +43,33 @@ const filterConfig = {
|
|
|
39
43
|
};
|
|
40
44
|
|
|
41
45
|
export function QuoteHeader(props: QuoteHeaderProps) {
|
|
42
|
-
const {
|
|
43
|
-
|
|
46
|
+
const {
|
|
47
|
+
current = 'quotation',
|
|
48
|
+
currentFilter,
|
|
49
|
+
onNavigate,
|
|
50
|
+
onNewQuote,
|
|
51
|
+
onFilterChange,
|
|
52
|
+
} = props;
|
|
53
|
+
const [currentValue, setCurrentValue] = useState<Record<FilterType, string>>(
|
|
54
|
+
currentFilter || {
|
|
55
|
+
date: '',
|
|
56
|
+
clientType: '',
|
|
57
|
+
fileStatus: '',
|
|
58
|
+
search: '',
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
const [searchValue, setSearchValue] = useState<string>(currentFilter?.search ?? '');
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (currentFilter && Object.keys(currentFilter).length > 0) {
|
|
65
|
+
const { search, ...rest } = currentFilter;
|
|
66
|
+
setCurrentValue(rest as Record<FilterType, string>);
|
|
67
|
+
setSearchValue(search);
|
|
68
|
+
} else {
|
|
69
|
+
setCurrentValue({} as Record<FilterType, string>);
|
|
70
|
+
setSearchValue('');
|
|
71
|
+
}
|
|
72
|
+
}, [currentFilter]);
|
|
44
73
|
|
|
45
74
|
return (
|
|
46
75
|
<div className="quote-header">
|
|
@@ -67,6 +96,12 @@ export function QuoteHeader(props: QuoteHeaderProps) {
|
|
|
67
96
|
icon="search"
|
|
68
97
|
iconPosition="leading"
|
|
69
98
|
className="quote-header__search"
|
|
99
|
+
value={searchValue}
|
|
100
|
+
onChange={(e) => {
|
|
101
|
+
onFilterChange?.('search', e.target.value);
|
|
102
|
+
setCurrentValue({ ...currentValue, search: e.target.value });
|
|
103
|
+
setSearchValue(e.target.value);
|
|
104
|
+
}}
|
|
70
105
|
/>
|
|
71
106
|
<Button
|
|
72
107
|
variant="primary"
|
|
@@ -83,9 +118,9 @@ export function QuoteHeader(props: QuoteHeaderProps) {
|
|
|
83
118
|
key={key}
|
|
84
119
|
placeholder={value.placeholder}
|
|
85
120
|
options={value.options}
|
|
86
|
-
value={currentValue[key]}
|
|
121
|
+
value={currentValue[key as FilterType]}
|
|
87
122
|
onSelect={(value) => {
|
|
88
|
-
onFilterChange?.(key as
|
|
123
|
+
onFilterChange?.(key as FilterType, value);
|
|
89
124
|
setCurrentValue({ ...currentValue, [key]: value });
|
|
90
125
|
}}
|
|
91
126
|
/>
|
|
@@ -9,28 +9,64 @@ import { ColumnType } from '../TableCell';
|
|
|
9
9
|
import { actionDropdownData } from '../constant';
|
|
10
10
|
|
|
11
11
|
export const bookingColumns: (params: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}) => ColumnType<BookingListItem>[] = ({
|
|
12
|
+
onAction?: (action: ActionDropdownType) => void;
|
|
13
|
+
keywords?: string;
|
|
14
|
+
}) => ColumnType<BookingListItem>[] = ({ onAction, keywords = '' }) => [
|
|
15
15
|
{
|
|
16
16
|
header: 'Quote nb.',
|
|
17
17
|
key: 'booking_id',
|
|
18
18
|
width: 150,
|
|
19
|
-
cell: (value) =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
cell: (value = '') => {
|
|
20
|
+
const currentValue = String(value as string);
|
|
21
|
+
const regex = new RegExp(`(${keywords ?? ''})`, 'gi');
|
|
22
|
+
if (regex.test(currentValue)) {
|
|
23
|
+
return (
|
|
24
|
+
<Text variant="medium" size="sm">
|
|
25
|
+
<span
|
|
26
|
+
dangerouslySetInnerHTML={{
|
|
27
|
+
__html: currentValue.replace(
|
|
28
|
+
regex,
|
|
29
|
+
`<span class="text--highlight">$1</span>`
|
|
30
|
+
),
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
</Text>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
return (
|
|
37
|
+
<Text variant="medium" size="sm">
|
|
38
|
+
{currentValue}
|
|
39
|
+
</Text>
|
|
40
|
+
);
|
|
41
|
+
},
|
|
24
42
|
},
|
|
25
43
|
{
|
|
26
44
|
header: 'Client name',
|
|
27
45
|
key: 'agency_name',
|
|
28
46
|
width: 150,
|
|
29
|
-
cell: (value) =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
47
|
+
cell: (value = '') => {
|
|
48
|
+
const currentValue = String(value as string);
|
|
49
|
+
const regex = new RegExp(`(${keywords ?? ''})`, 'gi');
|
|
50
|
+
if (regex.test(currentValue)) {
|
|
51
|
+
return (
|
|
52
|
+
<Text variant="medium" size="sm">
|
|
53
|
+
<span
|
|
54
|
+
dangerouslySetInnerHTML={{
|
|
55
|
+
__html: currentValue.replace(
|
|
56
|
+
regex,
|
|
57
|
+
`<span class="text--highlight">$1</span>`
|
|
58
|
+
),
|
|
59
|
+
}}
|
|
60
|
+
/>
|
|
61
|
+
</Text>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
return (
|
|
65
|
+
<Text variant="medium" size="sm">
|
|
66
|
+
{currentValue}
|
|
67
|
+
</Text>
|
|
68
|
+
);
|
|
69
|
+
},
|
|
34
70
|
},
|
|
35
71
|
{
|
|
36
72
|
header: 'Type',
|
|
@@ -92,7 +128,7 @@ export const bookingColumns: (params: {
|
|
|
92
128
|
Voucher
|
|
93
129
|
</Button>
|
|
94
130
|
</div>
|
|
95
|
-
<ActionDropdown data={actionDropdownData(onAction)} />
|
|
131
|
+
<ActionDropdown data={actionDropdownData(onAction ?? (() => {}))} />
|
|
96
132
|
</div>
|
|
97
133
|
</div>
|
|
98
134
|
);
|
|
@@ -10,32 +10,70 @@ import { ColumnType } from '../TableCell';
|
|
|
10
10
|
import { actionDropdownData, chipVariant, clientTypeMap } from '../constant';
|
|
11
11
|
|
|
12
12
|
export const quotationColumns: (params: {
|
|
13
|
-
onExpand
|
|
14
|
-
onAction
|
|
13
|
+
onExpand?: (value?: QuotationListItem) => void;
|
|
14
|
+
onAction?: (data: {
|
|
15
15
|
isChild?: boolean;
|
|
16
16
|
quote: QuotationListItem;
|
|
17
17
|
}) => (action: ActionDropdownType) => void;
|
|
18
|
-
|
|
18
|
+
keywords?: string;
|
|
19
|
+
}) => ColumnType<QuotationListItem>[] = ({ onExpand, onAction, keywords = '' }) => [
|
|
19
20
|
{
|
|
20
21
|
header: 'Quote nb.',
|
|
21
22
|
key: 'file_nb',
|
|
22
23
|
width: 150,
|
|
23
|
-
cell: (value) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
cell: (value = '') => {
|
|
25
|
+
const currentValue = String(value as string);
|
|
26
|
+
const regex = new RegExp(`(${keywords ?? ''})`, 'gi');
|
|
27
|
+
if (regex.test(currentValue)) {
|
|
28
|
+
return (
|
|
29
|
+
<Text variant="medium" size="sm">
|
|
30
|
+
<span
|
|
31
|
+
dangerouslySetInnerHTML={{
|
|
32
|
+
__html: currentValue.replace(
|
|
33
|
+
regex,
|
|
34
|
+
`<span class="text--highlight">$1</span>`
|
|
35
|
+
),
|
|
36
|
+
}}
|
|
37
|
+
/>
|
|
38
|
+
</Text>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return (
|
|
42
|
+
<Text variant="medium" size="sm">
|
|
43
|
+
{currentValue}
|
|
44
|
+
</Text>
|
|
45
|
+
);
|
|
46
|
+
},
|
|
28
47
|
},
|
|
29
48
|
{
|
|
30
49
|
header: 'Client name',
|
|
31
50
|
key: 'agency_name',
|
|
32
51
|
width: 150,
|
|
33
|
-
cell: (value, _raw, _index, childIndex) =>
|
|
34
|
-
childIndex === undefined
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
52
|
+
cell: (value = '', _raw, _index, childIndex) => {
|
|
53
|
+
if (childIndex === undefined) {
|
|
54
|
+
const currentValue = String(value as string);
|
|
55
|
+
const regex = new RegExp(`(${keywords ?? ''})`, 'gi');
|
|
56
|
+
if (regex.test(currentValue)) {
|
|
57
|
+
return (
|
|
58
|
+
<Text variant="medium" size="sm">
|
|
59
|
+
<span
|
|
60
|
+
dangerouslySetInnerHTML={{
|
|
61
|
+
__html: currentValue.replace(
|
|
62
|
+
regex,
|
|
63
|
+
`<span class="text--highlight">$1</span>`
|
|
64
|
+
),
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
</Text>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
return (
|
|
71
|
+
<Text variant="medium" size="sm">
|
|
72
|
+
{currentValue}
|
|
73
|
+
</Text>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
39
77
|
},
|
|
40
78
|
{
|
|
41
79
|
header: 'File status',
|
|
@@ -138,7 +176,7 @@ export const quotationColumns: (params: {
|
|
|
138
176
|
size="sm"
|
|
139
177
|
trailingIcon="chevron-down"
|
|
140
178
|
className={cn('table__button', isExpanded && 'table__button-expanded')}
|
|
141
|
-
onClick={() => onExpand(raw)}>
|
|
179
|
+
onClick={() => onExpand?.(raw)}>
|
|
142
180
|
{buttonLabel}
|
|
143
181
|
</Button>
|
|
144
182
|
) : (
|
|
@@ -151,7 +189,8 @@ export const quotationColumns: (params: {
|
|
|
151
189
|
</Button>
|
|
152
190
|
<ActionDropdown
|
|
153
191
|
data={actionDropdownData(
|
|
154
|
-
onAction({ isChild: childIndex !== undefined, quote: raw })
|
|
192
|
+
onAction?.({ isChild: childIndex !== undefined, quote: raw }) ??
|
|
193
|
+
(() => {})
|
|
155
194
|
)}
|
|
156
195
|
/>
|
|
157
196
|
</div>
|