mautourco-components 0.2.11 → 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.
Files changed (141) hide show
  1. package/dist/components/atoms/Icon/Icon.d.ts +1 -1
  2. package/dist/components/atoms/Icon/Icon.js +1 -1
  3. package/dist/components/atoms/Icon/icons/AccomIcon.d.ts +12 -0
  4. package/dist/components/atoms/Icon/icons/AccomIcon.js +36 -0
  5. package/dist/components/atoms/Icon/icons/ArrowDownOutlineIcon.d.ts +8 -0
  6. package/dist/components/atoms/Icon/icons/ArrowDownOutlineIcon.js +36 -0
  7. package/dist/components/atoms/Icon/icons/ArrowRightOutlineIcon.js +1 -1
  8. package/dist/components/atoms/Icon/icons/BusIcon.d.ts +12 -0
  9. package/dist/components/atoms/Icon/icons/BusIcon.js +36 -0
  10. package/dist/components/atoms/Icon/icons/Calendar2Icon.d.ts +12 -0
  11. package/dist/components/atoms/Icon/icons/Calendar2Icon.js +36 -0
  12. package/dist/components/atoms/Icon/icons/MapIcon.d.ts +8 -0
  13. package/dist/components/atoms/Icon/icons/MapIcon.js +36 -0
  14. package/dist/components/atoms/Icon/icons/MicroIcon.d.ts +12 -0
  15. package/dist/components/atoms/Icon/icons/MicroIcon.js +36 -0
  16. package/dist/components/atoms/Icon/icons/MoreVerticalIcon.d.ts +12 -0
  17. package/dist/components/atoms/Icon/icons/MoreVerticalIcon.js +36 -0
  18. package/dist/components/atoms/Icon/icons/NightIcon.d.ts +12 -0
  19. package/dist/components/atoms/Icon/icons/NightIcon.js +36 -0
  20. package/dist/components/atoms/Icon/icons/RowExcursion.d.ts +16 -0
  21. package/dist/components/atoms/Icon/icons/RowExcursion.js +28 -0
  22. package/dist/components/atoms/Icon/icons/StopWatchIcon.d.ts +12 -0
  23. package/dist/components/atoms/Icon/icons/StopWatchIcon.js +36 -0
  24. package/dist/components/atoms/Icon/icons/Utensils.d.ts +12 -0
  25. package/dist/components/atoms/Icon/icons/Utensils.js +36 -0
  26. package/dist/components/atoms/Icon/icons/WalletIcon.d.ts +12 -0
  27. package/dist/components/atoms/Icon/icons/WalletIcon.js +36 -0
  28. package/dist/components/atoms/Icon/icons/registry.d.ts +11 -0
  29. package/dist/components/atoms/Icon/icons/registry.js +49 -27
  30. package/dist/components/atoms/Typography/Typography.d.ts +3 -1
  31. package/dist/components/atoms/Typography/Typography.js +3 -15
  32. package/dist/components/molecules/ActionDropdown/ActionDropdown.css +2119 -0
  33. package/dist/components/molecules/ActionDropdown/ActionDropdown.d.ts +21 -0
  34. package/dist/components/molecules/ActionDropdown/ActionDropdown.js +34 -0
  35. package/dist/components/molecules/DateDisplay/DateDisplay.d.ts +14 -0
  36. package/dist/components/molecules/DateDisplay/DateDisplay.js +39 -0
  37. package/dist/components/molecules/FromTo/FromTo.d.ts +8 -0
  38. package/dist/components/molecules/FromTo/FromTo.js +24 -0
  39. package/dist/components/molecules/TableServiceItem/DetailsCol.d.ts +12 -0
  40. package/dist/components/molecules/TableServiceItem/DetailsCol.js +17 -0
  41. package/dist/components/molecules/TableServiceItem/ItemCol.d.ts +13 -0
  42. package/dist/components/molecules/TableServiceItem/ItemCol.js +24 -0
  43. package/dist/components/molecules/TableServiceItem/RowAccommodation.d.ts +16 -0
  44. package/dist/components/molecules/TableServiceItem/RowAccommodation.js +37 -0
  45. package/dist/components/molecules/TableServiceItem/RowExcursion.d.ts +16 -0
  46. package/dist/components/molecules/TableServiceItem/RowExcursion.js +22 -0
  47. package/dist/components/molecules/TableServiceItem/RowOtherServices.d.ts +9 -0
  48. package/dist/components/molecules/TableServiceItem/RowOtherServices.js +34 -0
  49. package/dist/components/molecules/TableServiceItem/RowTransfer.d.ts +15 -0
  50. package/dist/components/molecules/TableServiceItem/RowTransfer.js +37 -0
  51. package/dist/components/molecules/TableServiceItem/index.d.ts +17 -0
  52. package/dist/components/molecules/TableServiceItem/index.js +15 -0
  53. package/dist/components/molecules/TextWithIcon/TextWithIcon.d.ts +30 -0
  54. package/dist/components/molecules/TextWithIcon/TextWithIcon.js +31 -0
  55. package/dist/components/molecules/TooltipDisplay/TooltipDisplay.d.ts +13 -0
  56. package/dist/components/molecules/TooltipDisplay/TooltipDisplay.js +18 -0
  57. package/dist/components/organisms/DateTimePicker/DateTimePicker.d.ts +2 -0
  58. package/dist/components/organisms/DateTimePicker/DateTimePicker.js +31 -3
  59. package/dist/components/organisms/RoundTrip/RoundTrip.js +1 -1
  60. package/dist/components/organisms/Table/Table.css +2280 -0
  61. package/dist/components/organisms/Table/Table.d.ts +50 -0
  62. package/dist/components/organisms/Table/Table.js +95 -0
  63. package/dist/components/organisms/Table/TableCell.d.ts +15 -0
  64. package/dist/components/organisms/Table/TableCell.js +16 -0
  65. package/dist/components/organisms/Table/columns/booking-columns.d.ts +7 -0
  66. package/dist/components/organisms/Table/columns/booking-columns.js +83 -0
  67. package/dist/components/organisms/Table/columns/detail-resume-columns.d.ts +3 -0
  68. package/dist/components/organisms/Table/columns/detail-resume-columns.js +178 -0
  69. package/dist/components/organisms/Table/columns/index.d.ts +12 -0
  70. package/dist/components/organisms/Table/columns/index.js +9 -0
  71. package/dist/components/organisms/Table/columns/quotation-columns.d.ts +7 -0
  72. package/dist/components/organisms/Table/columns/quotation-columns.js +91 -0
  73. package/dist/components/organisms/Table/constant.d.ts +6 -0
  74. package/dist/components/organisms/Table/constant.js +24 -0
  75. package/dist/components/organisms/Table/index.d.ts +2 -0
  76. package/dist/components/organisms/Table/index.js +2 -0
  77. package/dist/components/organisms/TransferLine/TransferLine.js +1 -1
  78. package/dist/components/ui/popover.d.ts +3 -3
  79. package/dist/components/ui/popover.js +5 -5
  80. package/dist/components/ui/tooltip.d.ts +7 -0
  81. package/dist/components/ui/tooltip.js +42 -0
  82. package/dist/index.d.ts +41 -33
  83. package/dist/index.js +26 -20
  84. package/dist/styles/components/typography.css +1 -0
  85. package/dist/types/table/action-dropdown-type.types.d.ts +5 -0
  86. package/dist/types/table/action-dropdown-type.types.js +6 -0
  87. package/dist/types/table/booking.types.d.ts +16 -0
  88. package/dist/types/table/booking.types.js +1 -0
  89. package/dist/types/table/detail-resume.types.d.ts +155 -0
  90. package/dist/types/table/detail-resume.types.js +7 -0
  91. package/dist/types/table/index.d.ts +3 -0
  92. package/dist/types/table/index.js +3 -0
  93. package/dist/types/table/quotation.types.d.ts +23 -0
  94. package/dist/types/table/quotation.types.js +1 -0
  95. package/package.json +6 -1
  96. package/src/components/atoms/Icon/Icon.tsx +2 -8
  97. package/src/components/atoms/Icon/icons/AccomIcon.tsx +45 -0
  98. package/src/components/atoms/Icon/icons/ArrowDownOutlineIcon.tsx +41 -0
  99. package/src/components/atoms/Icon/icons/ArrowRightOutlineIcon.tsx +2 -7
  100. package/src/components/atoms/Icon/icons/BusIcon.tsx +52 -0
  101. package/src/components/atoms/Icon/icons/Calendar2Icon.tsx +54 -0
  102. package/src/components/atoms/Icon/icons/MapIcon.tsx +48 -0
  103. package/src/components/atoms/Icon/icons/MicroIcon.tsx +45 -0
  104. package/src/components/atoms/Icon/icons/MoreVerticalIcon.tsx +53 -0
  105. package/src/components/atoms/Icon/icons/NightIcon.tsx +45 -0
  106. package/src/components/atoms/Icon/icons/RowExcursion.tsx +54 -0
  107. package/src/components/atoms/Icon/icons/StopWatchIcon.tsx +45 -0
  108. package/src/components/atoms/Icon/icons/Utensils.tsx +45 -0
  109. package/src/components/atoms/Icon/icons/WalletIcon.tsx +45 -0
  110. package/src/components/atoms/Icon/icons/registry.tsx +50 -28
  111. package/src/components/atoms/Typography/Typography.tsx +22 -30
  112. package/src/components/molecules/ActionDropdown/ActionDropdown.css +23 -0
  113. package/src/components/molecules/ActionDropdown/ActionDropdown.tsx +53 -0
  114. package/src/components/molecules/DateDisplay/DateDisplay.tsx +47 -0
  115. package/src/components/molecules/FromTo/FromTo.tsx +31 -0
  116. package/src/components/molecules/TableServiceItem/DetailsCol.tsx +25 -0
  117. package/src/components/molecules/TableServiceItem/ItemCol.tsx +68 -0
  118. package/src/components/molecules/TableServiceItem/RowAccommodation.tsx +56 -0
  119. package/src/components/molecules/TableServiceItem/RowExcursion.tsx +40 -0
  120. package/src/components/molecules/TableServiceItem/RowOtherServices.tsx +50 -0
  121. package/src/components/molecules/TableServiceItem/RowTransfer.tsx +60 -0
  122. package/src/components/molecules/TableServiceItem/index.ts +24 -0
  123. package/src/components/molecules/TextWithIcon/TextWithIcon.tsx +62 -0
  124. package/src/components/molecules/TooltipDisplay/TooltipDisplay.tsx +32 -0
  125. package/src/components/organisms/CarBookingCard/index.ts +2 -0
  126. package/src/components/organisms/DateTimePicker/DateTimePicker.tsx +33 -2
  127. package/src/components/organisms/RoundTrip/RoundTrip.tsx +1 -0
  128. package/src/components/organisms/SearchBarTransfer/index.ts +1 -0
  129. package/src/components/organisms/Table/Table.css +185 -0
  130. package/src/components/organisms/Table/Table.tsx +273 -0
  131. package/src/components/organisms/Table/TableCell.tsx +40 -0
  132. package/src/components/organisms/Table/columns/booking-columns.tsx +118 -0
  133. package/src/components/organisms/Table/columns/detail-resume-columns.tsx +226 -0
  134. package/src/components/organisms/Table/columns/index.ts +11 -0
  135. package/src/components/organisms/Table/columns/quotation-columns.tsx +150 -0
  136. package/src/components/organisms/Table/constant.ts +31 -0
  137. package/src/components/organisms/Table/index.ts +2 -0
  138. package/src/components/organisms/TransferLine/TransferLine.tsx +1 -0
  139. package/src/components/ui/popover.tsx +10 -10
  140. package/src/components/ui/tooltip.tsx +45 -0
  141. 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
+ };
@@ -0,0 +1,2 @@
1
+ export * from './columns';
2
+ export * from './Table';
@@ -311,6 +311,7 @@ const TransferLine: React.FC<TransferLineProps> = ({
311
311
  showChevron={true}
312
312
  onValueChange={handleDateChange}
313
313
  selectionMode="single"
314
+ defaultValue={transferDate}
314
315
  />
315
316
  </div>
316
317
 
@@ -1,23 +1,23 @@
1
- import * as React from "react"
2
- import * as PopoverPrimitive from "@radix-ui/react-popover"
1
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
2
+ import * as React from 'react';
3
3
 
4
- import { cn } from "../../lib/utils"
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 = "center",
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
- "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",
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, PopoverTrigger, PopoverContent, PopoverAnchor }
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 };
@@ -1,3 +1,7 @@
1
+ :root {
2
+ --color-text-yellow: var(--color-yellow-600);
3
+ }
4
+
1
5
  .heading-3xl {
2
6
  margin: 0;
3
7
  color: var(--color-text-default, #262626);