mautourco-components 0.2.12 → 0.2.13
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/atoms/Icon/Icon.d.ts +1 -1
- package/dist/components/atoms/Icon/Icon.js +1 -1
- package/dist/components/atoms/Icon/icons/AccomIcon.d.ts +12 -0
- package/dist/components/atoms/Icon/icons/AccomIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/ArrowDownOutlineIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/ArrowDownOutlineIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/ArrowRightOutlineIcon.js +1 -1
- package/dist/components/atoms/Icon/icons/BusIcon.d.ts +12 -0
- package/dist/components/atoms/Icon/icons/BusIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/Calendar2Icon.d.ts +12 -0
- package/dist/components/atoms/Icon/icons/Calendar2Icon.js +36 -0
- package/dist/components/atoms/Icon/icons/MapIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/MapIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/MicroIcon.d.ts +12 -0
- package/dist/components/atoms/Icon/icons/MicroIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/MoreVerticalIcon.d.ts +12 -0
- package/dist/components/atoms/Icon/icons/MoreVerticalIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/NightIcon.d.ts +12 -0
- package/dist/components/atoms/Icon/icons/NightIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/RowExcursion.d.ts +16 -0
- package/dist/components/atoms/Icon/icons/RowExcursion.js +28 -0
- package/dist/components/atoms/Icon/icons/StopWatchIcon.d.ts +12 -0
- package/dist/components/atoms/Icon/icons/StopWatchIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/Utensils.d.ts +12 -0
- package/dist/components/atoms/Icon/icons/Utensils.js +36 -0
- package/dist/components/atoms/Icon/icons/WalletIcon.d.ts +12 -0
- package/dist/components/atoms/Icon/icons/WalletIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/registry.d.ts +11 -0
- package/dist/components/atoms/Icon/icons/registry.js +49 -27
- package/dist/components/atoms/Typography/Typography.d.ts +3 -1
- package/dist/components/atoms/Typography/Typography.js +3 -15
- package/dist/components/molecules/ActionDropdown/ActionDropdown.css +2119 -0
- package/dist/components/molecules/ActionDropdown/ActionDropdown.d.ts +21 -0
- package/dist/components/molecules/ActionDropdown/ActionDropdown.js +34 -0
- package/dist/components/molecules/DateDisplay/DateDisplay.d.ts +14 -0
- package/dist/components/molecules/DateDisplay/DateDisplay.js +39 -0
- package/dist/components/molecules/FromTo/FromTo.d.ts +8 -0
- package/dist/components/molecules/FromTo/FromTo.js +24 -0
- package/dist/components/molecules/TableServiceItem/DetailsCol.d.ts +12 -0
- package/dist/components/molecules/TableServiceItem/DetailsCol.js +17 -0
- package/dist/components/molecules/TableServiceItem/ItemCol.d.ts +13 -0
- package/dist/components/molecules/TableServiceItem/ItemCol.js +24 -0
- package/dist/components/molecules/TableServiceItem/RowAccommodation.d.ts +16 -0
- package/dist/components/molecules/TableServiceItem/RowAccommodation.js +37 -0
- package/dist/components/molecules/TableServiceItem/RowExcursion.d.ts +16 -0
- package/dist/components/molecules/TableServiceItem/RowExcursion.js +22 -0
- package/dist/components/molecules/TableServiceItem/RowOtherServices.d.ts +9 -0
- package/dist/components/molecules/TableServiceItem/RowOtherServices.js +34 -0
- package/dist/components/molecules/TableServiceItem/RowTransfer.d.ts +15 -0
- package/dist/components/molecules/TableServiceItem/RowTransfer.js +37 -0
- package/dist/components/molecules/TableServiceItem/index.d.ts +17 -0
- package/dist/components/molecules/TableServiceItem/index.js +15 -0
- package/dist/components/molecules/TextWithIcon/TextWithIcon.d.ts +30 -0
- package/dist/components/molecules/TextWithIcon/TextWithIcon.js +31 -0
- package/dist/components/molecules/TooltipDisplay/TooltipDisplay.d.ts +13 -0
- package/dist/components/molecules/TooltipDisplay/TooltipDisplay.js +18 -0
- package/dist/components/organisms/Table/Table.css +2280 -0
- package/dist/components/organisms/Table/Table.d.ts +50 -0
- package/dist/components/organisms/Table/Table.js +95 -0
- package/dist/components/organisms/Table/TableCell.d.ts +15 -0
- package/dist/components/organisms/Table/TableCell.js +16 -0
- package/dist/components/organisms/Table/columns/booking-columns.d.ts +7 -0
- package/dist/components/organisms/Table/columns/booking-columns.js +83 -0
- package/dist/components/organisms/Table/columns/detail-resume-columns.d.ts +3 -0
- package/dist/components/organisms/Table/columns/detail-resume-columns.js +178 -0
- package/dist/components/organisms/Table/columns/index.d.ts +12 -0
- package/dist/components/organisms/Table/columns/index.js +9 -0
- package/dist/components/organisms/Table/columns/quotation-columns.d.ts +7 -0
- package/dist/components/organisms/Table/columns/quotation-columns.js +91 -0
- package/dist/components/organisms/Table/constant.d.ts +6 -0
- package/dist/components/organisms/Table/constant.js +24 -0
- package/dist/components/organisms/Table/index.d.ts +2 -0
- package/dist/components/organisms/Table/index.js +2 -0
- package/dist/components/ui/popover.d.ts +3 -3
- package/dist/components/ui/popover.js +5 -5
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.js +42 -0
- package/dist/index.d.ts +41 -33
- package/dist/index.js +26 -20
- package/dist/styles/components/typography.css +1 -0
- package/dist/types/table/action-dropdown-type.types.d.ts +5 -0
- package/dist/types/table/action-dropdown-type.types.js +6 -0
- package/dist/types/table/booking.types.d.ts +16 -0
- package/dist/types/table/booking.types.js +1 -0
- package/dist/types/table/detail-resume.types.d.ts +155 -0
- package/dist/types/table/detail-resume.types.js +7 -0
- package/dist/types/table/index.d.ts +3 -0
- package/dist/types/table/index.js +3 -0
- package/dist/types/table/quotation.types.d.ts +23 -0
- package/dist/types/table/quotation.types.js +1 -0
- package/package.json +6 -1
- package/src/components/atoms/Icon/Icon.tsx +2 -8
- package/src/components/atoms/Icon/icons/AccomIcon.tsx +45 -0
- package/src/components/atoms/Icon/icons/ArrowDownOutlineIcon.tsx +41 -0
- package/src/components/atoms/Icon/icons/ArrowRightOutlineIcon.tsx +2 -7
- package/src/components/atoms/Icon/icons/BusIcon.tsx +52 -0
- package/src/components/atoms/Icon/icons/Calendar2Icon.tsx +54 -0
- package/src/components/atoms/Icon/icons/MapIcon.tsx +48 -0
- package/src/components/atoms/Icon/icons/MicroIcon.tsx +45 -0
- package/src/components/atoms/Icon/icons/MoreVerticalIcon.tsx +53 -0
- package/src/components/atoms/Icon/icons/NightIcon.tsx +45 -0
- package/src/components/atoms/Icon/icons/RowExcursion.tsx +54 -0
- package/src/components/atoms/Icon/icons/StopWatchIcon.tsx +45 -0
- package/src/components/atoms/Icon/icons/Utensils.tsx +45 -0
- package/src/components/atoms/Icon/icons/WalletIcon.tsx +45 -0
- package/src/components/atoms/Icon/icons/registry.tsx +50 -28
- package/src/components/atoms/Typography/Typography.tsx +22 -30
- package/src/components/molecules/ActionDropdown/ActionDropdown.css +23 -0
- package/src/components/molecules/ActionDropdown/ActionDropdown.tsx +53 -0
- package/src/components/molecules/DateDisplay/DateDisplay.tsx +47 -0
- package/src/components/molecules/FromTo/FromTo.tsx +31 -0
- package/src/components/molecules/TableServiceItem/DetailsCol.tsx +25 -0
- package/src/components/molecules/TableServiceItem/ItemCol.tsx +68 -0
- package/src/components/molecules/TableServiceItem/RowAccommodation.tsx +56 -0
- package/src/components/molecules/TableServiceItem/RowExcursion.tsx +40 -0
- package/src/components/molecules/TableServiceItem/RowOtherServices.tsx +50 -0
- package/src/components/molecules/TableServiceItem/RowTransfer.tsx +60 -0
- package/src/components/molecules/TableServiceItem/index.ts +24 -0
- package/src/components/molecules/TextWithIcon/TextWithIcon.tsx +62 -0
- package/src/components/molecules/TooltipDisplay/TooltipDisplay.tsx +32 -0
- package/src/components/organisms/CarBookingCard/index.ts +2 -0
- package/src/components/organisms/Table/Table.css +185 -0
- package/src/components/organisms/Table/Table.tsx +273 -0
- package/src/components/organisms/Table/TableCell.tsx +40 -0
- package/src/components/organisms/Table/columns/booking-columns.tsx +118 -0
- package/src/components/organisms/Table/columns/detail-resume-columns.tsx +226 -0
- package/src/components/organisms/Table/columns/index.ts +11 -0
- package/src/components/organisms/Table/columns/quotation-columns.tsx +150 -0
- package/src/components/organisms/Table/constant.ts +31 -0
- package/src/components/organisms/Table/index.ts +2 -0
- package/src/components/ui/popover.tsx +10 -10
- package/src/components/ui/tooltip.tsx +45 -0
- package/src/styles/components/typography.css +4 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import Button from '@/src/components/atoms/Button/Button';
|
|
2
|
+
import Chip from '@/src/components/atoms/Chip/Chip';
|
|
3
|
+
import { Text } from '@/src/components/atoms/Typography/Typography';
|
|
4
|
+
import { ActionDropdown } from '@/src/components/molecules/ActionDropdown/ActionDropdown';
|
|
5
|
+
import { DateDisplay } from '@/src/components/molecules/DateDisplay/DateDisplay';
|
|
6
|
+
import { ActionDropdownType } from '@/src/types/table';
|
|
7
|
+
import { BookingListItem } from '@/src/types/table/booking.types';
|
|
8
|
+
import { ColumnType } from '../TableCell';
|
|
9
|
+
import { actionDropdownData } from '../constant';
|
|
10
|
+
|
|
11
|
+
export const bookingColumns: (params: {
|
|
12
|
+
onExpand: (value?: BookingListItem) => void;
|
|
13
|
+
onAction: (action: ActionDropdownType) => void;
|
|
14
|
+
}) => ColumnType<BookingListItem>[] = ({ onExpand, onAction }) => [
|
|
15
|
+
{
|
|
16
|
+
header: 'Quote nb.',
|
|
17
|
+
key: 'booking_id',
|
|
18
|
+
width: 150,
|
|
19
|
+
cell: (value) => (
|
|
20
|
+
<Text variant="medium" size="sm">
|
|
21
|
+
{value as string}
|
|
22
|
+
</Text>
|
|
23
|
+
),
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
header: 'Client name',
|
|
27
|
+
key: 'agency_name',
|
|
28
|
+
width: 150,
|
|
29
|
+
cell: (value) => (
|
|
30
|
+
<Text variant="medium" size="sm">
|
|
31
|
+
{value as string}
|
|
32
|
+
</Text>
|
|
33
|
+
),
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
header: 'Type',
|
|
37
|
+
key: 'status',
|
|
38
|
+
width: 145,
|
|
39
|
+
cell: (value) => {
|
|
40
|
+
return (
|
|
41
|
+
<Text variant="medium" size="sm">
|
|
42
|
+
STD
|
|
43
|
+
</Text>
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
header: 'From → To',
|
|
49
|
+
key: 'date',
|
|
50
|
+
width: 260,
|
|
51
|
+
cell: (value) => {
|
|
52
|
+
const dates = value as string[];
|
|
53
|
+
return <DateDisplay date={dates} />;
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
header: 'No. of services',
|
|
58
|
+
key: 'pax_details',
|
|
59
|
+
width: 350,
|
|
60
|
+
cell: (value) => {
|
|
61
|
+
const paxDetails = value as BookingListItem['pax_details'];
|
|
62
|
+
const paxDetailsKeys = Object.keys(paxDetails);
|
|
63
|
+
if (paxDetailsKeys.length) {
|
|
64
|
+
return (
|
|
65
|
+
<div className="flex flex-wrap gap-2">
|
|
66
|
+
{paxDetailsKeys.map((key) => {
|
|
67
|
+
return (
|
|
68
|
+
<Chip
|
|
69
|
+
label={`${key} ${paxDetails[key as keyof BookingListItem['pax_details']]}`}
|
|
70
|
+
type={
|
|
71
|
+
paxDetails[key as keyof BookingListItem['pax_details']] > 0
|
|
72
|
+
? 'filled'
|
|
73
|
+
: 'outline'
|
|
74
|
+
}
|
|
75
|
+
color="accent"
|
|
76
|
+
size="sm"
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
})}
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
return <></>;
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
header: 'Created by',
|
|
88
|
+
key: 'created_by',
|
|
89
|
+
width: 160,
|
|
90
|
+
cell: (value) => (
|
|
91
|
+
<Text variant="medium" size="sm">
|
|
92
|
+
{value as string}
|
|
93
|
+
</Text>
|
|
94
|
+
),
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
header: '',
|
|
98
|
+
key: 'actions',
|
|
99
|
+
width: 232,
|
|
100
|
+
cell: (_value, raw) => {
|
|
101
|
+
return (
|
|
102
|
+
<div>
|
|
103
|
+
<div className="flex items-center gap-x-8">
|
|
104
|
+
<div className="flex items-center gap-x-3">
|
|
105
|
+
<Button variant="secondary" size="sm" className="w-[89px]">
|
|
106
|
+
Proforma
|
|
107
|
+
</Button>
|
|
108
|
+
<Button variant="outline-secondary" size="sm" className="w-[89px]">
|
|
109
|
+
Voucher
|
|
110
|
+
</Button>
|
|
111
|
+
</div>
|
|
112
|
+
<ActionDropdown data={actionDropdownData(onAction)} />
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
];
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import Chip from '@/src/components/atoms/Chip/Chip';
|
|
2
|
+
import { Text } from '@/src/components/atoms/Typography/Typography';
|
|
3
|
+
import { DateDisplay } from '@/src/components/molecules/DateDisplay/DateDisplay';
|
|
4
|
+
import {
|
|
5
|
+
DetailResumeAccommodation,
|
|
6
|
+
DetailResumeExcursion,
|
|
7
|
+
DetailResumeItem,
|
|
8
|
+
DetailResumeOtherService,
|
|
9
|
+
DetailResumeTransfer,
|
|
10
|
+
ServiceType,
|
|
11
|
+
} from '@/src/types/table';
|
|
12
|
+
import { RowAccommodation } from '../../../molecules/TableServiceItem/RowAccommodation';
|
|
13
|
+
import { RowExcursion } from '../../../molecules/TableServiceItem/RowExcursion';
|
|
14
|
+
import { RowOtherServices } from '../../../molecules/TableServiceItem/RowOtherServices';
|
|
15
|
+
import { RowTransfer } from '../../../molecules/TableServiceItem/RowTransfer';
|
|
16
|
+
import { ColumnType } from '../TableCell';
|
|
17
|
+
|
|
18
|
+
export const detailResumeColumns: () => ColumnType<DetailResumeItem>[] = () => {
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
header: 'Item',
|
|
22
|
+
key: 'Type',
|
|
23
|
+
width: 268,
|
|
24
|
+
cell: (value, raw) => {
|
|
25
|
+
if (value === ServiceType.ACCOMMODATION) {
|
|
26
|
+
const accom = raw as DetailResumeAccommodation;
|
|
27
|
+
console.log(accom);
|
|
28
|
+
return (
|
|
29
|
+
<RowAccommodation.FirstCol
|
|
30
|
+
serviceName={accom.HotelName as string}
|
|
31
|
+
offers={accom.Offers}
|
|
32
|
+
status={accom.RoomStatus}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
if (value === ServiceType.EXCURSION) {
|
|
37
|
+
const excursion = raw as DetailResumeExcursion;
|
|
38
|
+
return (
|
|
39
|
+
<RowExcursion.FirstCol serviceName={excursion.ExcursionName as string} />
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
if (value === ServiceType.TRANSFER) {
|
|
43
|
+
const transfer = raw as DetailResumeTransfer;
|
|
44
|
+
return (
|
|
45
|
+
<RowTransfer.FirstCol
|
|
46
|
+
serviceName={transfer.VehicleTypeName as string}
|
|
47
|
+
transferType={transfer.TransferType}
|
|
48
|
+
from={transfer.LocationFromName}
|
|
49
|
+
to={transfer.LocationToName}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (value === ServiceType.OTHER_SERVICE) {
|
|
55
|
+
return <RowOtherServices.FirstCol />;
|
|
56
|
+
}
|
|
57
|
+
return <></>;
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
header: 'Details',
|
|
62
|
+
key: 'Type',
|
|
63
|
+
width: 400,
|
|
64
|
+
cell: (value, raw, index) => {
|
|
65
|
+
if (value === ServiceType.ACCOMMODATION) {
|
|
66
|
+
const accom = raw as DetailResumeAccommodation;
|
|
67
|
+
return (
|
|
68
|
+
<RowAccommodation.DetailsCol
|
|
69
|
+
data={{
|
|
70
|
+
RoomName: accom.RoomName,
|
|
71
|
+
Dates: accom.Dates,
|
|
72
|
+
ClientCategory: accom.ClientCategory,
|
|
73
|
+
MealPlan: accom.MealPlan,
|
|
74
|
+
}}
|
|
75
|
+
index={(index || 0) + 1}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
if (value === ServiceType.EXCURSION) {
|
|
80
|
+
const excursion = raw as DetailResumeExcursion;
|
|
81
|
+
return (
|
|
82
|
+
<RowExcursion.DetailsCol
|
|
83
|
+
data={{
|
|
84
|
+
languages: excursion.AvailableLanguages,
|
|
85
|
+
duration: excursion.Duration,
|
|
86
|
+
accessibility: excursion.Accessibility,
|
|
87
|
+
transferType: excursion.TransferType,
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
if (value === ServiceType.TRANSFER) {
|
|
93
|
+
const transfer = raw as DetailResumeTransfer;
|
|
94
|
+
return (
|
|
95
|
+
<RowTransfer.DetailsCol
|
|
96
|
+
data={{
|
|
97
|
+
carType: transfer.VehicleTypeName,
|
|
98
|
+
clientType: 'STD',
|
|
99
|
+
}}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
if (value === ServiceType.OTHER_SERVICE) {
|
|
104
|
+
return <RowOtherServices.DetailsCol />;
|
|
105
|
+
}
|
|
106
|
+
return <></>;
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
header: 'Date',
|
|
111
|
+
key: 'Type',
|
|
112
|
+
width: 307,
|
|
113
|
+
cell: (value, raw) => {
|
|
114
|
+
let date: string[] = [];
|
|
115
|
+
switch (value) {
|
|
116
|
+
case ServiceType.ACCOMMODATION:
|
|
117
|
+
const accom = raw as DetailResumeAccommodation;
|
|
118
|
+
date = accom.Dates as string[];
|
|
119
|
+
break;
|
|
120
|
+
case ServiceType.EXCURSION:
|
|
121
|
+
const excursion = raw as DetailResumeExcursion;
|
|
122
|
+
date = [excursion.ServiceDate];
|
|
123
|
+
break;
|
|
124
|
+
case ServiceType.TRANSFER:
|
|
125
|
+
const transfer = raw as DetailResumeTransfer;
|
|
126
|
+
date = [transfer.TransferDate];
|
|
127
|
+
break;
|
|
128
|
+
case ServiceType.OTHER_SERVICE:
|
|
129
|
+
const otherService = raw as DetailResumeOtherService;
|
|
130
|
+
date = [otherService.service_date];
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
return <DateDisplay date={date} />;
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
header: 'No. of pax',
|
|
138
|
+
key: 'Type',
|
|
139
|
+
width: 396,
|
|
140
|
+
cell: (value, raw) => {
|
|
141
|
+
const pax: Record<'Adult' | 'Teen' | 'Infant' | 'Child', number | undefined> = {
|
|
142
|
+
Adult: 0,
|
|
143
|
+
Teen: 0,
|
|
144
|
+
Infant: 0,
|
|
145
|
+
Child: 0,
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
switch (value) {
|
|
149
|
+
case ServiceType.ACCOMMODATION:
|
|
150
|
+
case ServiceType.EXCURSION:
|
|
151
|
+
case ServiceType.TRANSFER:
|
|
152
|
+
const item = raw as
|
|
153
|
+
| DetailResumeAccommodation
|
|
154
|
+
| DetailResumeExcursion
|
|
155
|
+
| DetailResumeTransfer;
|
|
156
|
+
pax.Adult = item.AdultCount;
|
|
157
|
+
pax.Teen = item.TeenCount;
|
|
158
|
+
pax.Infant = item.InfantCount;
|
|
159
|
+
pax.Child = item.ChildCount;
|
|
160
|
+
break;
|
|
161
|
+
case ServiceType.OTHER_SERVICE:
|
|
162
|
+
const otherService = raw as DetailResumeOtherService;
|
|
163
|
+
pax.Adult = otherService.adult_pax;
|
|
164
|
+
pax.Teen = otherService.teen_pax;
|
|
165
|
+
pax.Infant = otherService.infant_pax;
|
|
166
|
+
pax.Child = otherService.child_pax;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
return (
|
|
170
|
+
<div className="flex items-center gap-x-3">
|
|
171
|
+
{Object.keys(pax).map((k, index) => {
|
|
172
|
+
const count = pax[k as keyof typeof pax] ?? 0;
|
|
173
|
+
const type = count > 0 ? 'filled' : 'outline';
|
|
174
|
+
return (
|
|
175
|
+
<Chip
|
|
176
|
+
key={`pax-${index}`}
|
|
177
|
+
label={`${k} ${count}`}
|
|
178
|
+
size="sm"
|
|
179
|
+
color="accent"
|
|
180
|
+
type={type}
|
|
181
|
+
className="!px-3"
|
|
182
|
+
/>
|
|
183
|
+
);
|
|
184
|
+
})}
|
|
185
|
+
</div>
|
|
186
|
+
);
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
header: 'Price',
|
|
191
|
+
key: 'Type',
|
|
192
|
+
width: 299,
|
|
193
|
+
cell: (value, raw) => {
|
|
194
|
+
let total: Record<'currency' | 'total', string | undefined> = {
|
|
195
|
+
currency: undefined,
|
|
196
|
+
total: undefined,
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
switch (value) {
|
|
200
|
+
case ServiceType.ACCOMMODATION:
|
|
201
|
+
const accom = raw as DetailResumeAccommodation;
|
|
202
|
+
total.currency = accom.Currency;
|
|
203
|
+
total.total = accom.Total;
|
|
204
|
+
break;
|
|
205
|
+
case ServiceType.EXCURSION:
|
|
206
|
+
case ServiceType.TRANSFER:
|
|
207
|
+
const item = raw as DetailResumeExcursion | DetailResumeTransfer;
|
|
208
|
+
total.currency = item.Currency;
|
|
209
|
+
total.total = item.TotalPrice;
|
|
210
|
+
break;
|
|
211
|
+
case ServiceType.OTHER_SERVICE:
|
|
212
|
+
const otherService = raw as DetailResumeOtherService;
|
|
213
|
+
total.currency = otherService.currency;
|
|
214
|
+
total.total = otherService.total_price;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return (
|
|
219
|
+
<Text size="sm" variant="bold">
|
|
220
|
+
{total.currency} {total.total}
|
|
221
|
+
</Text>
|
|
222
|
+
);
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
];
|
|
226
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { bookingColumns } from './booking-columns';
|
|
2
|
+
import { detailResumeColumns } from './detail-resume-columns';
|
|
3
|
+
import { quotationColumns } from './quotation-columns';
|
|
4
|
+
|
|
5
|
+
const columns = {
|
|
6
|
+
quotation: quotationColumns,
|
|
7
|
+
detailResume: detailResumeColumns,
|
|
8
|
+
booking: bookingColumns,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { columns };
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import Button from '@/src/components/atoms/Button/Button';
|
|
2
|
+
import Chip from '@/src/components/atoms/Chip/Chip';
|
|
3
|
+
import { Text } from '@/src/components/atoms/Typography/Typography';
|
|
4
|
+
import { ActionDropdown } from '@/src/components/molecules/ActionDropdown/ActionDropdown';
|
|
5
|
+
import { DateDisplay } from '@/src/components/molecules/DateDisplay/DateDisplay';
|
|
6
|
+
import { cn } from '@/src/lib/utils';
|
|
7
|
+
import { ActionDropdownType } from '@/src/types/table/action-dropdown-type.types';
|
|
8
|
+
import { QuotationListItem } from '@/src/types/table/quotation.types';
|
|
9
|
+
import { ColumnType } from '../TableCell';
|
|
10
|
+
import { actionDropdownData, chipVariant, clientTypeMap } from '../constant';
|
|
11
|
+
|
|
12
|
+
export const quotationColumns: (params: {
|
|
13
|
+
onExpand: (value?: QuotationListItem) => void;
|
|
14
|
+
onAction: (action: ActionDropdownType) => void;
|
|
15
|
+
}) => ColumnType<QuotationListItem>[] = ({ onExpand, onAction }) => [
|
|
16
|
+
{
|
|
17
|
+
header: 'Quote nb.',
|
|
18
|
+
key: 'file_nb',
|
|
19
|
+
width: 150,
|
|
20
|
+
cell: (value) => (
|
|
21
|
+
<Text variant="medium" size="sm">
|
|
22
|
+
{value as string}
|
|
23
|
+
</Text>
|
|
24
|
+
),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
header: 'Client name',
|
|
28
|
+
key: 'agency_name',
|
|
29
|
+
width: 150,
|
|
30
|
+
cell: (value) => (
|
|
31
|
+
<Text variant="medium" size="sm">
|
|
32
|
+
{value as string}
|
|
33
|
+
</Text>
|
|
34
|
+
),
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
header: 'File status',
|
|
38
|
+
key: 'status',
|
|
39
|
+
width: 160,
|
|
40
|
+
cell: (value, raw) => {
|
|
41
|
+
const isMultiple = raw.children && raw.children.length > 0;
|
|
42
|
+
return (
|
|
43
|
+
<Chip
|
|
44
|
+
color={isMultiple ? 'blue' : chipVariant[(value as string).toLowerCase()]}
|
|
45
|
+
size="sm">
|
|
46
|
+
{isMultiple ? 'Multiple' : (value as string)}
|
|
47
|
+
</Chip>
|
|
48
|
+
);
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
header: 'Type',
|
|
53
|
+
key: 'client_type',
|
|
54
|
+
width: 145,
|
|
55
|
+
cell: (value) => {
|
|
56
|
+
const clientType = clientTypeMap[value as string];
|
|
57
|
+
return (
|
|
58
|
+
<Text variant="medium" size="sm">
|
|
59
|
+
{clientType ?? value}
|
|
60
|
+
</Text>
|
|
61
|
+
);
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
header: 'From → To',
|
|
66
|
+
key: 'date',
|
|
67
|
+
width: 260,
|
|
68
|
+
cell: (value) => {
|
|
69
|
+
const dates = value as string[];
|
|
70
|
+
return <DateDisplay date={dates} />;
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
header: 'No. of services',
|
|
75
|
+
key: 'service_count',
|
|
76
|
+
width: 350,
|
|
77
|
+
cell: (value) => {
|
|
78
|
+
const { accom_count, transfer_count, tours_count } =
|
|
79
|
+
value as QuotationListItem['service_count'];
|
|
80
|
+
return (
|
|
81
|
+
<div className="flex flex-wrap gap-2">
|
|
82
|
+
<Chip
|
|
83
|
+
label={`Accomodation ${accom_count}`}
|
|
84
|
+
type={accom_count > 0 ? 'filled' : 'outline'}
|
|
85
|
+
color="accent"
|
|
86
|
+
size="sm"
|
|
87
|
+
/>
|
|
88
|
+
<Chip
|
|
89
|
+
label={`Transfer ${transfer_count}`}
|
|
90
|
+
type={transfer_count > 0 ? 'filled' : 'outline'}
|
|
91
|
+
color="accent"
|
|
92
|
+
size="sm"
|
|
93
|
+
/>
|
|
94
|
+
<Chip
|
|
95
|
+
label={`Excursion ${tours_count}`}
|
|
96
|
+
type={tours_count > 0 ? 'filled' : 'outline'}
|
|
97
|
+
color="accent"
|
|
98
|
+
size="sm"
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
header: 'Created by',
|
|
106
|
+
key: 'created_by',
|
|
107
|
+
width: 160,
|
|
108
|
+
cell: (value) => (
|
|
109
|
+
<Text variant="medium" size="sm">
|
|
110
|
+
{value as string}
|
|
111
|
+
</Text>
|
|
112
|
+
),
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
header: '',
|
|
116
|
+
key: 'actions',
|
|
117
|
+
width: 232,
|
|
118
|
+
cell: (_value, raw) => {
|
|
119
|
+
const hasChildren = raw.children && raw.children.length > 0;
|
|
120
|
+
const isExpanded = raw.children?.some((child) => child.visible);
|
|
121
|
+
const buttonLabel = isExpanded ? 'See less' : 'See more';
|
|
122
|
+
const isOnRequest = raw.status.toLowerCase() === 'on request';
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<div>
|
|
126
|
+
{hasChildren ? (
|
|
127
|
+
<Button
|
|
128
|
+
variant="outline-primary"
|
|
129
|
+
size="sm"
|
|
130
|
+
trailingIcon="chevron-down"
|
|
131
|
+
className={cn('table__button', isExpanded && 'table__button-expanded')}
|
|
132
|
+
onClick={() => onExpand(raw)}>
|
|
133
|
+
{buttonLabel}
|
|
134
|
+
</Button>
|
|
135
|
+
) : (
|
|
136
|
+
<div className="flex itemes-center gap-x-8">
|
|
137
|
+
<Button
|
|
138
|
+
variant={isOnRequest ? 'outline-secondary' : 'secondary'}
|
|
139
|
+
size="sm"
|
|
140
|
+
className="table__button">
|
|
141
|
+
{isOnRequest ? 'Request to book' : 'Book now'}
|
|
142
|
+
</Button>
|
|
143
|
+
<ActionDropdown data={actionDropdownData(onAction)} />
|
|
144
|
+
</div>
|
|
145
|
+
)}
|
|
146
|
+
</div>
|
|
147
|
+
);
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ActionDropdownType } from '@/src/types/table';
|
|
2
|
+
import { ChipProps } from '../../atoms/Chip/Chip';
|
|
3
|
+
import { ActionDropdownItem } from '../../molecules/ActionDropdown/ActionDropdown';
|
|
4
|
+
|
|
5
|
+
export const actionDropdownData: (
|
|
6
|
+
onAction: (action: ActionDropdownType) => void
|
|
7
|
+
) => ActionDropdownItem[] = (onAction) => [
|
|
8
|
+
{
|
|
9
|
+
label: 'Add item',
|
|
10
|
+
onClick: () => onAction(ActionDropdownType.ADD_ITEM),
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
label: 'Send via mail',
|
|
14
|
+
onClick: () => onAction(ActionDropdownType.SEND_VIA_MAIL),
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
label: 'Delete quote',
|
|
18
|
+
onClick: () => onAction(ActionDropdownType.DELETE_QUOTE),
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
export const chipVariant: Record<string, ChipProps['color']> = {
|
|
23
|
+
'free sales': 'accent',
|
|
24
|
+
'on request': 'yellow',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const clientTypeMap: Record<string, string> = {
|
|
28
|
+
'standard-client': 'STD',
|
|
29
|
+
honeymooners: 'HMN',
|
|
30
|
+
vip: 'VIP',
|
|
31
|
+
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
1
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
import { cn } from
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
5
|
|
|
6
6
|
function Popover({
|
|
7
7
|
...props
|
|
8
8
|
}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
9
|
-
return <PopoverPrimitive.Root data-slot="popover" {...props}
|
|
9
|
+
return <PopoverPrimitive.Root data-slot="popover" {...props} />;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
function PopoverTrigger({
|
|
13
13
|
...props
|
|
14
14
|
}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
15
|
-
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props}
|
|
15
|
+
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function PopoverContent({
|
|
19
19
|
className,
|
|
20
|
-
align =
|
|
20
|
+
align = 'center',
|
|
21
21
|
sideOffset = 4,
|
|
22
22
|
...props
|
|
23
23
|
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
@@ -28,19 +28,19 @@ function PopoverContent({
|
|
|
28
28
|
align={align}
|
|
29
29
|
sideOffset={sideOffset}
|
|
30
30
|
className={cn(
|
|
31
|
-
|
|
31
|
+
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden border-[var(--color-elevation-state-hover-subtle)]',
|
|
32
32
|
className
|
|
33
33
|
)}
|
|
34
34
|
{...props}
|
|
35
35
|
/>
|
|
36
36
|
</PopoverPrimitive.Portal>
|
|
37
|
-
)
|
|
37
|
+
);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function PopoverAnchor({
|
|
41
41
|
...props
|
|
42
42
|
}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
|
43
|
-
return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props}
|
|
43
|
+
return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export { Popover,
|
|
46
|
+
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import { cn } from '@/src/lib/utils';
|
|
5
|
+
|
|
6
|
+
function TooltipProvider({ delayDuration = 0, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
|
7
|
+
return <TooltipPrimitive.Provider data-slot="tooltip-provider" delayDuration={delayDuration} {...props} />;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
|
11
|
+
return (
|
|
12
|
+
<TooltipProvider>
|
|
13
|
+
<TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
|
14
|
+
</TooltipProvider>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
19
|
+
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function TooltipContent({
|
|
23
|
+
className,
|
|
24
|
+
sideOffset = 0,
|
|
25
|
+
children,
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
28
|
+
return (
|
|
29
|
+
<TooltipPrimitive.Portal>
|
|
30
|
+
<TooltipPrimitive.Content
|
|
31
|
+
data-slot="tooltip-content"
|
|
32
|
+
sideOffset={sideOffset}
|
|
33
|
+
className={cn(
|
|
34
|
+
'bg-foreground bg-[var(--tooltip-color-background-default)] text-white animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance',
|
|
35
|
+
className
|
|
36
|
+
)}
|
|
37
|
+
{...props}>
|
|
38
|
+
{children}
|
|
39
|
+
<TooltipPrimitive.Arrow className="bg-[var(--tooltip-color-background-default)] fill-[var(--tooltip-color-background-default)] z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
|
|
40
|
+
</TooltipPrimitive.Content>
|
|
41
|
+
</TooltipPrimitive.Portal>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|