@licklist/design 0.71.18-dev.18 → 0.71.18-dev.3

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 (135) hide show
  1. package/dist/events/edit-event-modal/IntervalInput.d.ts +1 -3
  2. package/dist/events/edit-event-modal/IntervalInput.d.ts.map +1 -1
  3. package/dist/events/edit-event-modal/IntervalInput.js +4 -11
  4. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts +1 -3
  5. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
  6. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +3 -14
  7. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +0 -1
  8. package/dist/events/edit-recurrent-event-modal/EditRecurrentEventModal.d.ts +1 -5
  9. package/dist/events/edit-recurrent-event-modal/EditRecurrentEventModal.d.ts.map +1 -1
  10. package/dist/events/edit-recurrent-event-modal/EditRecurrentEventModal.js +3 -5
  11. package/dist/events/event-statistic-modal/utils/index.js +3 -3
  12. package/dist/iframe/event/ticket-description/TicketDescription.d.ts +1 -3
  13. package/dist/iframe/event/ticket-description/TicketDescription.d.ts.map +1 -1
  14. package/dist/iframe/event/ticket-description/TicketDescription.js +7 -10
  15. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts +1 -1
  16. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
  17. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -2
  18. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts +1 -5
  19. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts.map +1 -1
  20. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.js +1 -12
  21. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +0 -1
  22. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
  23. package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts +0 -4
  24. package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
  25. package/dist/iframe/order-process/components/BookingSummary/utils/index.js +2 -29
  26. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
  27. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.js +2 -106
  28. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts +1 -3
  29. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
  30. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +1 -95
  31. package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
  32. package/dist/iframe/payment/order-items-table/hooks/useTableData.js +10 -83
  33. package/dist/iframe/payment/order-items-table/utils/index.d.ts.map +1 -1
  34. package/dist/iframe/payment/order-items-table/utils/index.js +0 -15
  35. package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +2 -2
  36. package/dist/iframe/payment/payment-page/PaymentPage.d.ts.map +1 -1
  37. package/dist/iframe/payment/payment-page/PaymentPage.js +1 -4
  38. package/dist/index.js +1 -1
  39. package/dist/product-set/form/ProductSetForm.d.ts +1 -3
  40. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  41. package/dist/product-set/form/ProductSetForm.js +4 -6
  42. package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
  43. package/dist/product-set/form/ProductsControl.js +5 -24
  44. package/dist/product-set/form/context.d.ts +1 -3
  45. package/dist/product-set/form/context.d.ts.map +1 -1
  46. package/dist/product-set/form/context.js +1 -2
  47. package/dist/product-set/product/ProductControl.d.ts +0 -8
  48. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  49. package/dist/product-set/product/ProductControl.js +1 -25
  50. package/dist/product-set/utils/index.d.ts +0 -88
  51. package/dist/product-set/utils/index.d.ts.map +1 -1
  52. package/dist/product-set/utils/index.js +1 -19
  53. package/dist/recurrence-input/RecurrenceInput.d.ts.map +1 -1
  54. package/dist/sales/coupon/utils/index.d.ts +1 -2
  55. package/dist/sales/coupon/utils/index.d.ts.map +1 -1
  56. package/dist/styles/date-time-button/DateTimeButton.scss +0 -7
  57. package/dist/styles/events/EditEventModal.scss +0 -2
  58. package/dist/styles/iframe-page/Page.scss +0 -16
  59. package/dist/styles/iframe-page/PageBody.scss +0 -4
  60. package/dist/styles/modals/Modals.scss +0 -16
  61. package/dist/styles/product-set/EditProductSetElement.scss +0 -1
  62. package/dist/styles/product-set/ProductSetForm.scss +0 -11
  63. package/dist/styles/sales/ManualBooking.scss +0 -6
  64. package/dist/styles/themes/bookedit/index.scss +0 -19
  65. package/package.json +6 -6
  66. package/src/events/edit-event-modal/IntervalInput.tsx +3 -13
  67. package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +1 -16
  68. package/src/events/edit-recurrent-event-modal/EditRecurrentEventModal.tsx +1 -9
  69. package/src/events/event-statistic-modal/utils/index.ts +4 -4
  70. package/src/iframe/event/ticket-description/TicketDescription.tsx +4 -11
  71. package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +0 -2
  72. package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx +2 -24
  73. package/src/iframe/order-process/components/BookingSummary/types/index.ts +0 -1
  74. package/src/iframe/order-process/components/BookingSummary/utils/index.ts +1 -42
  75. package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +75 -155
  76. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +1 -58
  77. package/src/iframe/payment/order-items-table/hooks/useTableData.tsx +14 -84
  78. package/src/iframe/payment/order-items-table/utils/index.ts +0 -23
  79. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +2 -2
  80. package/src/iframe/payment/payment-page/PaymentPage.tsx +10 -8
  81. package/src/product-set/form/ProductSetForm.tsx +3 -11
  82. package/src/product-set/form/ProductsControl.tsx +15 -33
  83. package/src/product-set/form/context.tsx +0 -5
  84. package/src/product-set/product/ProductControl.tsx +1 -37
  85. package/src/product-set/utils/index.ts +0 -19
  86. package/src/recurrence-input/RecurrenceInput.tsx +5 -3
  87. package/src/sales/coupon/utils/index.ts +3 -5
  88. package/src/styles/date-time-button/DateTimeButton.scss +0 -7
  89. package/src/styles/events/EditEventModal.scss +0 -2
  90. package/src/styles/iframe-page/Page.scss +0 -16
  91. package/src/styles/iframe-page/PageBody.scss +0 -4
  92. package/src/styles/modals/Modals.scss +0 -16
  93. package/src/styles/product-set/EditProductSetElement.scss +0 -1
  94. package/src/styles/product-set/ProductSetForm.scss +0 -11
  95. package/src/styles/sales/ManualBooking.scss +0 -6
  96. package/src/styles/themes/bookedit/index.scss +0 -19
  97. package/yarn.lock +376 -377
  98. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.d.ts +0 -18
  99. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.d.ts.map +0 -1
  100. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.js +0 -295
  101. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.d.ts +0 -15
  102. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.d.ts.map +0 -1
  103. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.js +0 -90
  104. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.d.ts +0 -14
  105. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.d.ts.map +0 -1
  106. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.js +0 -404
  107. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.d.ts +0 -10
  108. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.d.ts.map +0 -1
  109. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.js +0 -87
  110. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/index.d.ts +0 -2
  111. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/index.d.ts.map +0 -1
  112. package/dist/iframe/ProductWithModifierModal/index.d.ts +0 -2
  113. package/dist/iframe/ProductWithModifierModal/index.d.ts.map +0 -1
  114. package/dist/iframe/ProductWithModifierModal/utils.d.ts +0 -5
  115. package/dist/iframe/ProductWithModifierModal/utils.d.ts.map +0 -1
  116. package/dist/iframe/ProductWithModifierModal/utils.js +0 -21
  117. package/dist/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.d.ts +0 -23
  118. package/dist/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.d.ts.map +0 -1
  119. package/dist/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.js +0 -62
  120. package/dist/iframe/order-process/components/CategoryProduct/constants.d.ts +0 -2
  121. package/dist/iframe/order-process/components/CategoryProduct/constants.d.ts.map +0 -1
  122. package/dist/iframe/order-process/components/CategoryProduct/constants.js +0 -4
  123. package/dist/iframe/order-process/components/utils/useOnWindowUnmount.d.ts +0 -6
  124. package/dist/iframe/order-process/components/utils/useOnWindowUnmount.d.ts.map +0 -1
  125. package/dist/iframe/order-process/components/utils/useOnWindowUnmount.js +0 -18
  126. package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.tsx +0 -212
  127. package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.tsx +0 -76
  128. package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.tsx +0 -393
  129. package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.tsx +0 -98
  130. package/src/iframe/ProductWithModifierModal/ModifierSetModal/index.ts +0 -1
  131. package/src/iframe/ProductWithModifierModal/index.ts +0 -1
  132. package/src/iframe/ProductWithModifierModal/utils.ts +0 -29
  133. package/src/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.tsx +0 -86
  134. package/src/iframe/order-process/components/CategoryProduct/constants.ts +0 -1
  135. package/src/iframe/order-process/components/utils/useOnWindowUnmount.ts +0 -25
@@ -1,404 +0,0 @@
1
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
- import { Col, Form } from 'react-bootstrap';
3
- import { useTranslation } from 'react-i18next';
4
- import { useMemo, useEffect } from 'react';
5
- import { useId } from '@mantine/hooks';
6
- import { useFormContext, Controller } from 'react-hook-form';
7
- import { xor } from 'lodash';
8
- import clsx from 'clsx';
9
- import { Currency } from '@licklist/core/dist/Config';
10
- import { useIntl } from 'react-intl';
11
- import { MAX_PRODUCT_NUMBER } from '../../../order-process/components/CategoryProduct/constants.js';
12
- import 'recharts';
13
- import 'react-loader';
14
- import '@licklist/plugins/dist/hooks/Media/useWindowDimensions';
15
- import 'moment';
16
- import '@react-aria/utils';
17
- import 'react-date-range';
18
- import 'react-use';
19
- import 'react-icons/fa';
20
- import 'luxon';
21
- import 'react-date-range/dist/styles.css';
22
- import 'react-date-range/dist/theme/default.css';
23
- import '@licklist/core/dist/DataMapper/User/UserDetailDataMapper';
24
- import 'react-bootstrap/Col';
25
- import 'react-bootstrap/Row';
26
- import '@licklist/plugins/dist/services/Media/MediaService';
27
- import '@licklist/plugins/dist/services/Form/FormErrorService';
28
- import '@licklist/core/dist/DataMapper/Product/CouponDataMapper';
29
- import '@licklist/plugins/dist/validation/Rules/couponCodeRules';
30
- import 'react-select';
31
- import 'rrule';
32
- import '@licklist/core/dist/Services';
33
- import { NumberInputHorizontal } from '../../../../sales/manual-booking/number-input-horizontal/NumberInputHorizontal.js';
34
- import '@licklist/core/dist/DataMapper/Product/ProductSetDataMapper';
35
- import '@licklist/plugins/dist/utils/relyOnPeople';
36
- import 'react-highlighter';
37
- import '@licklist/plugins/dist';
38
- import '@licklist/core/dist/Config/DefaultUser';
39
- import '../../../../typeahead-helper/TypeaheadHelperComponent.js';
40
- import 'react-bootstrap/ModalHeader';
41
- import 'react-bootstrap/ModalTitle';
42
- import '../../../../sales/constants.js';
43
- import '../../../../static/CurrencyNumberInput.js';
44
- import '@licklist/core/dist/DataMapper/Order/OrderPaymentDataMapper';
45
- import '@licklist/plugins/dist/context/sale/SalePaymentFormContext';
46
- import '@licklist/core/dist/Services/Date';
47
- import 'react-router-dom';
48
- import '../../../../static/index.js';
49
- import '@licklist/core/dist/DataMapper/Order/OrderDataMapper';
50
- import '@licklist/plugins/dist/utils/formatDate';
51
- import '@licklist/plugins/dist/utils/sourceTitle';
52
- import 'react-bootstrap/ModalBody';
53
- import 'react-bootstrap/ModalFooter';
54
- import 'react-bootstrap/Modal';
55
- import 'react-bootstrap/PageItem';
56
- import '@licklist/plugins/dist/services/Table/PaginationService';
57
- import '@licklist/plugins/dist/services/Table/TableService';
58
- import '@licklist/plugins/dist/hooks/Query/useQuery';
59
- import '@licklist/plugins/dist/services/Route/RouteService';
60
- import '../../../../table/utils/index.js';
61
- import '@tanstack/react-table';
62
-
63
- var ModifiersSetControl = function(param) {
64
- var modifierSet = param.modifierSet, modifiers = param.modifiers, productId = param.productId, _param_isLoading = param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, _param_isEditMode = param.isEditMode, isEditMode = _param_isEditMode === void 0 ? false : _param_isEditMode, orderProductModifierSets = param.orderProductModifierSets;
65
- var _currentOrderModifiersSets_find;
66
- var _useFormContext = useFormContext(), control = _useFormContext.control, watch = _useFormContext.watch, setValue = _useFormContext.setValue, trigger = _useFormContext.trigger;
67
- var t = useTranslation('App').t;
68
- var orderModifiersSets = watch("".concat(productId, ".orderProductModifiers"));
69
- var formatNumber = useIntl().formatNumber;
70
- var formatToCurrency = function(value) {
71
- return formatNumber(value, {
72
- style: 'currency',
73
- currency: Currency.GBP
74
- });
75
- };
76
- var currentOrderModifiersSets = useMemo(function() {
77
- return (orderProductModifierSets === null || orderProductModifierSets === void 0 ? void 0 : orderProductModifierSets.filter(function(modifier) {
78
- return modifier.modifierSetId === modifierSet.id;
79
- })) || [];
80
- }, [
81
- orderProductModifierSets,
82
- modifierSet.id
83
- ]);
84
- var onChangeModifiers = function(e, type, quantity) {
85
- var _orderModifiersSets_find;
86
- if (!modifiers) return;
87
- var selectedModifier = modifiers === null || modifiers === void 0 ? void 0 : modifiers.find(function(item) {
88
- return item.id === Number(e.target.defaultValue || e.target.id);
89
- });
90
- var checkSelectedModifier = (orderModifiersSets === null || orderModifiersSets === void 0 ? void 0 : (_orderModifiersSets_find = orderModifiersSets.find(function(modifier) {
91
- return (modifier === null || modifier === void 0 ? void 0 : modifier.modifierId) === (selectedModifier === null || selectedModifier === void 0 ? void 0 : selectedModifier.id);
92
- })) === null || _orderModifiersSets_find === void 0 ? void 0 : _orderModifiersSets_find.quantity) === 1;
93
- if (selectedModifier && type === 'radio') {
94
- modifiers.forEach(function(modifier) {
95
- var isSelected = modifier.id === selectedModifier.id;
96
- var orderModifiers = {
97
- modifierId: modifier.id,
98
- price: modifier.price,
99
- productId: productId,
100
- name: modifier.name,
101
- quantity: isSelected ? 1 : 0,
102
- modifierSetId: modifierSet.id
103
- };
104
- setValue("".concat(productId, ".orderProductModifiers.").concat(modifierSet.id, ".").concat(orderModifiers.modifierId), orderModifiers);
105
- });
106
- }
107
- if (selectedModifier && type === 'checkbox') {
108
- var orderModifiers = {
109
- modifierId: selectedModifier.id,
110
- price: selectedModifier.price,
111
- productId: productId,
112
- name: selectedModifier.name,
113
- quantity: checkSelectedModifier ? 0 : 1,
114
- modifierSetId: modifierSet.id
115
- };
116
- setValue("".concat(productId, ".orderProductModifiers.").concat(modifierSet.id, ".").concat(selectedModifier.id), orderModifiers);
117
- }
118
- if (selectedModifier && type === 'selector') {
119
- var orderModifiers1 = {
120
- modifierId: selectedModifier.id,
121
- price: selectedModifier.price,
122
- productId: productId,
123
- quantity: quantity,
124
- name: selectedModifier.name,
125
- modifierSetId: modifierSet.id
126
- };
127
- setValue("".concat(productId, ".orderProductModifiers.").concat(modifierSet.id, ".").concat(selectedModifier.id), orderModifiers1);
128
- }
129
- trigger("".concat(productId, ".orderProductModifiers"));
130
- };
131
- useEffect(function() {
132
- if (!(orderProductModifierSets === null || orderProductModifierSets === void 0 ? void 0 : orderProductModifierSets.length)) return;
133
- orderProductModifierSets.forEach(function(orderModifier) {
134
- return setValue("".concat(productId, ".orderProductModifiers.").concat(orderModifier.modifierSetId, ".").concat(orderModifier.modifierId), orderModifier);
135
- });
136
- }, [
137
- isEditMode
138
- ]);
139
- var radioButtonDefaultModifier = (_currentOrderModifiersSets_find = currentOrderModifiersSets.find(function(modifier) {
140
- return modifierSet.modifiers.some(function(rl) {
141
- return rl.id === modifier.modifierId;
142
- });
143
- })) === null || _currentOrderModifiersSets_find === void 0 ? void 0 : _currentOrderModifiersSets_find.modifierId.toString();
144
- return /*#__PURE__*/ jsx(Fragment, {
145
- children: (modifierSet === null || modifierSet === void 0 ? void 0 : modifierSet.maxItems) === 1 && modifiers.every(function(modifier) {
146
- return modifier.maxItems === 1;
147
- }) ? /*#__PURE__*/ jsx(Fragment, {
148
- children: /*#__PURE__*/ jsx(Controller, {
149
- name: "".concat(productId, ".modifier"),
150
- control: control,
151
- rules: {
152
- required: {
153
- value: !!modifierSet.minItems,
154
- message: t('Validation:fieldRequired')
155
- }
156
- },
157
- render: function(param) {
158
- var field = param.field, fieldState = param.fieldState;
159
- var onChange = function(e) {
160
- onChangeModifiers(e, 'radio');
161
- field.onChange(e.target.id);
162
- };
163
- return /*#__PURE__*/ jsxs(Fragment, {
164
- children: [
165
- modifiers.map(function(modifier) {
166
- var _currentOrderModifiersSets_find_modifierId, _currentOrderModifiersSets_find;
167
- var selectedOrderModifierId = currentOrderModifiersSets === null || currentOrderModifiersSets === void 0 ? void 0 : (_currentOrderModifiersSets_find = currentOrderModifiersSets.find(function(orderModifier) {
168
- return orderModifier.modifierId === modifier.id;
169
- })) === null || _currentOrderModifiersSets_find === void 0 ? void 0 : (_currentOrderModifiersSets_find_modifierId = _currentOrderModifiersSets_find.modifierId) === null || _currentOrderModifiersSets_find_modifierId === void 0 ? void 0 : _currentOrderModifiersSets_find_modifierId.toString();
170
- return /*#__PURE__*/ jsx(Col, {
171
- children: /*#__PURE__*/ jsxs("div", {
172
- className: "modifier-container d-flex flex-column p-2",
173
- children: [
174
- /*#__PURE__*/ jsx(Form.Check, {
175
- className: "custom-radio p-2",
176
- inline: true,
177
- id: modifier.id.toString(),
178
- defaultChecked: !!selectedOrderModifierId,
179
- defaultValue: selectedOrderModifierId || modifier.id.toString(),
180
- checked: field.value === modifier.id.toString(),
181
- onChange: onChange,
182
- type: "radio",
183
- label: modifier.name,
184
- name: modifier.name
185
- }),
186
- /*#__PURE__*/ jsxs("div", {
187
- className: "mt-3 w-100 pl-2",
188
- children: [
189
- /*#__PURE__*/ jsx("p", {
190
- children: modifier.description
191
- }),
192
- /*#__PURE__*/ jsxs("div", {
193
- className: "modifier-price",
194
- children: [
195
- "+ ",
196
- formatToCurrency(modifier.price)
197
- ]
198
- })
199
- ]
200
- })
201
- ]
202
- })
203
- }, modifier.id);
204
- }),
205
- fieldState.error && /*#__PURE__*/ jsx("div", {
206
- className: "invalid-feedback d-block",
207
- children: fieldState.error.message
208
- })
209
- ]
210
- });
211
- },
212
- defaultValue: radioButtonDefaultModifier
213
- })
214
- }) : /*#__PURE__*/ jsx(Fragment, {
215
- children: modifiers === null || modifiers === void 0 ? void 0 : modifiers.map(function(modifier, index) {
216
- var _currentOrderModifiersSets_find;
217
- var selectedOrderModifier = currentOrderModifiersSets === null || currentOrderModifiersSets === void 0 ? void 0 : (_currentOrderModifiersSets_find = currentOrderModifiersSets.find(function(orderModifier) {
218
- return orderModifier.modifierId === modifier.id;
219
- })) === null || _currentOrderModifiersSets_find === void 0 ? void 0 : _currentOrderModifiersSets_find.quantity;
220
- return /*#__PURE__*/ jsx(Fragment, {
221
- children: modifier.maxItems === 1 ? /*#__PURE__*/ jsx(Fragment, {
222
- children: /*#__PURE__*/ jsx(Controller, {
223
- name: "".concat(productId, ".").concat(modifierSet.id, ".modifiers[").concat(index, "]"),
224
- control: control,
225
- rules: {
226
- required: {
227
- value: !!modifier.minItems,
228
- message: t('Validation:fieldRequired')
229
- },
230
- validate: function(value) {
231
- var maxItems = modifier.maxItems, minItems = modifier.minItems;
232
- if ((value === null || value === void 0 ? void 0 : value.length) > maxItems) {
233
- return t('Validation:quantityMaxNumberModifier', {
234
- max: maxItems
235
- });
236
- }
237
- if ((value === null || value === void 0 ? void 0 : value.length) < minItems) {
238
- return t('Validation:quantityMinNumberModifier', {
239
- min: minItems
240
- });
241
- }
242
- return true;
243
- }
244
- },
245
- render: function(param) {
246
- var field = param.field, error = param.fieldState.error;
247
- var onChange = function(e) {
248
- onChangeModifiers(e, 'checkbox');
249
- field.onChange(xor(field.value, [
250
- Number(e.target.value)
251
- ]));
252
- };
253
- return /*#__PURE__*/ jsxs(Col, {
254
- className: "modifier-container pl-4",
255
- children: [
256
- /*#__PURE__*/ jsx("div", {
257
- className: "d-flex justify-content-between pl-2 align-items-center",
258
- children: /*#__PURE__*/ jsx(Checkbox, {
259
- value: modifier.id,
260
- onChange: onChange,
261
- label: modifier.name,
262
- defaultChecked: !!selectedOrderModifier
263
- })
264
- }),
265
- /*#__PURE__*/ jsxs("div", {
266
- className: "mt-3 w-100 pl-2",
267
- children: [
268
- /*#__PURE__*/ jsx("p", {
269
- children: modifier.description
270
- }),
271
- /*#__PURE__*/ jsxs("div", {
272
- className: "modifier-price",
273
- children: [
274
- "+ ",
275
- formatToCurrency(modifier.price)
276
- ]
277
- })
278
- ]
279
- }),
280
- (error === null || error === void 0 ? void 0 : error.message) && /*#__PURE__*/ jsx("div", {
281
- className: "invalid-feedback d-flex",
282
- children: error === null || error === void 0 ? void 0 : error.message
283
- })
284
- ]
285
- }, modifier.id.toString());
286
- }
287
- })
288
- }) : /*#__PURE__*/ jsxs(Fragment, {
289
- children: [
290
- /*#__PURE__*/ jsx("div", {
291
- className: "modifier-header m-0",
292
- children: /*#__PURE__*/ jsx("div", {
293
- className: "title",
294
- children: modifier.name
295
- })
296
- }),
297
- /*#__PURE__*/ jsx(Controller, {
298
- control: control,
299
- name: "".concat(productId, ".").concat(modifierSet.id, ".modifiers[").concat(index, "].quantity"),
300
- rules: {
301
- required: {
302
- value: !!modifier.minItems,
303
- message: t('Validation:fieldRequired')
304
- },
305
- validate: function(value) {
306
- var maxItems = modifier.maxItems, minItems = modifier.minItems;
307
- if (value > maxItems) {
308
- return t('Validation:quantityMaxNumberModifier', {
309
- max: maxItems
310
- });
311
- }
312
- if (value < minItems) {
313
- return t('Validation:quantityMinNumberModifier', {
314
- min: minItems
315
- });
316
- }
317
- return true;
318
- }
319
- },
320
- render: function(param) {
321
- var _param_field = param.field, onChange = _param_field.onChange, value = _param_field.value, ref = _param_field.ref, _param_fieldState = param.fieldState, invalid = _param_fieldState.invalid, error = _param_fieldState.error;
322
- var onChangeProductQuantity = function(val) {
323
- var quantity = Math.min(MAX_PRODUCT_NUMBER, Math.max(0, Math.ceil(val)));
324
- onChange(quantity);
325
- trigger("".concat(productId, ".").concat(modifierSet.id, ".modifiers[").concat(index, "].quantity"));
326
- onChangeModifiers({
327
- target: {
328
- id: modifier.id.toString()
329
- }
330
- }, 'selector', quantity);
331
- };
332
- var _ref;
333
- return /*#__PURE__*/ jsxs("div", {
334
- className: "modifier-container",
335
- children: [
336
- /*#__PURE__*/ jsx("div", {
337
- className: "d-flex align-items-center column mb-8 pl-6 pt-2",
338
- children: /*#__PURE__*/ jsx("div", {
339
- className: "quantity-container mb-0",
340
- children: /*#__PURE__*/ jsx(NumberInputHorizontal, {
341
- ref: ref,
342
- size: "big",
343
- onChange: onChangeProductQuantity,
344
- onMinusClick: onChangeProductQuantity,
345
- onPlusClick: onChangeProductQuantity,
346
- min: 0,
347
- max: MAX_PRODUCT_NUMBER,
348
- value: (_ref = value !== null && value !== void 0 ? value : selectedOrderModifier) !== null && _ref !== void 0 ? _ref : 0,
349
- className: clsx(invalid && 'error'),
350
- isLoading: isLoading
351
- })
352
- })
353
- }),
354
- /*#__PURE__*/ jsxs("div", {
355
- className: "p-2 mt-3 w-100 pl-4",
356
- children: [
357
- /*#__PURE__*/ jsx("p", {
358
- className: "pl-2",
359
- children: modifier.description
360
- }),
361
- /*#__PURE__*/ jsxs("div", {
362
- className: "pl-2 modifier-price",
363
- children: [
364
- "+ ",
365
- formatToCurrency(modifier.price)
366
- ]
367
- }),
368
- (error === null || error === void 0 ? void 0 : error.message) && /*#__PURE__*/ jsx("div", {
369
- className: "d-flex mt-3 w-100",
370
- children: /*#__PURE__*/ jsx("p", {
371
- className: "iframe-event__message-error",
372
- children: error.message
373
- })
374
- })
375
- ]
376
- })
377
- ]
378
- });
379
- }
380
- })
381
- ]
382
- })
383
- });
384
- })
385
- })
386
- });
387
- };
388
- var Checkbox = function(param) {
389
- var onChange = param.onChange, value = param.value, label = param.label, defaultChecked = param.defaultChecked;
390
- var checkboxId = useId();
391
- return /*#__PURE__*/ jsx(Form.Group, {
392
- controlId: checkboxId,
393
- className: "custom-checkbox mt-0",
394
- children: /*#__PURE__*/ jsx(Form.Check, {
395
- label: label,
396
- value: value,
397
- defaultChecked: defaultChecked,
398
- onChange: onChange,
399
- type: "checkbox"
400
- })
401
- });
402
- };
403
-
404
- export { ModifiersSetControl };
@@ -1,10 +0,0 @@
1
- import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct';
2
- import { Product } from '@licklist/plugins/dist/types/context/sale/menuSteps';
3
- interface ProductControlProps {
4
- product: Product;
5
- isLoading?: boolean;
6
- editOrderModifier?: OrderModifierByProduct;
7
- }
8
- export declare const ProductControl: ({ product, isLoading, editOrderModifier, }: ProductControlProps) => import("react/jsx-runtime").JSX.Element;
9
- export {};
10
- //# sourceMappingURL=ProductControll.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductControll.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8DAA8D,CAAA;AACrG,OAAO,EAAE,OAAO,EAAE,MAAM,qDAAqD,CAAA;AAK7E,UAAU,mBAAmB;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,iBAAiB,CAAC,EAAE,sBAAsB,CAAA;CAC3C;AAED,eAAO,MAAM,cAAc,+CAIxB,mBAAmB,4CA+ErB,CAAA"}
@@ -1,87 +0,0 @@
1
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { useEffect } from 'react';
3
- import { useFormContext, Controller } from 'react-hook-form';
4
- import { useTranslation } from 'react-i18next';
5
- import { ModifiersSetControl } from './ModifierSetControll.js';
6
- import { orderProductModifiersQuantity } from '../../utils.js';
7
-
8
- var ProductControl = function(param) {
9
- var product = param.product, _param_isLoading = param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, editOrderModifier = param.editOrderModifier;
10
- var t = useTranslation() // Added translation hook
11
- .t;
12
- var _useFormContext = useFormContext(), control = _useFormContext.control, watch = _useFormContext.watch, isValid = _useFormContext.formState.isValid, clearErrors = _useFormContext.clearErrors;
13
- var modifiersSet = (product === null || product === void 0 ? void 0 : product.modifiersSet) || [];
14
- var orderModifiersSets = watch("".concat(product.id, ".orderProductModifiers"));
15
- useEffect(function() {
16
- if (!isValid) return;
17
- clearErrors();
18
- }, [
19
- isValid,
20
- clearErrors
21
- ]);
22
- return /*#__PURE__*/ jsx("div", {
23
- className: "mb-8 pt-4",
24
- children: /*#__PURE__*/ jsx("div", {
25
- className: "d-flex flex-column",
26
- children: modifiersSet.map(function(modifierSet) {
27
- var orderProductModifiersMaxQuantity = orderProductModifiersQuantity(orderModifiersSets, modifierSet);
28
- return /*#__PURE__*/ jsxs("div", {
29
- className: "modifier-set-container",
30
- children: [
31
- /*#__PURE__*/ jsx("div", {
32
- className: "modifier-header",
33
- children: /*#__PURE__*/ jsx("div", {
34
- className: "title",
35
- children: modifierSet.name
36
- })
37
- }),
38
- /*#__PURE__*/ jsx(Controller, {
39
- control: control,
40
- name: "".concat(product.id, ".").concat(modifierSet.id),
41
- rules: {
42
- validate: function() {
43
- var maxItems = modifierSet.maxItems, minItems = modifierSet.minItems;
44
- if (!!minItems && orderProductModifiersMaxQuantity < minItems) {
45
- return t('Validation:quantityMinNumberModifier', {
46
- min: minItems
47
- });
48
- }
49
- if (orderProductModifiersMaxQuantity > maxItems) {
50
- return t('Validation:quantityMaxNumberModifier', {
51
- max: maxItems
52
- });
53
- }
54
- return true;
55
- }
56
- },
57
- render: function(param) {
58
- var error = param.fieldState.error;
59
- return /*#__PURE__*/ jsxs(Fragment, {
60
- children: [
61
- /*#__PURE__*/ jsx(ModifiersSetControl, {
62
- modifierSet: modifierSet,
63
- productId: product.id,
64
- modifiers: modifierSet.modifiers,
65
- isEditMode: !!(editOrderModifier === null || editOrderModifier === void 0 ? void 0 : editOrderModifier.modifiers),
66
- orderProductModifierSets: editOrderModifier === null || editOrderModifier === void 0 ? void 0 : editOrderModifier.modifiers,
67
- isLoading: isLoading
68
- }),
69
- (error === null || error === void 0 ? void 0 : error.message) && /*#__PURE__*/ jsxs("div", {
70
- className: "invalid-feedback d-flex pl-4",
71
- children: [
72
- error === null || error === void 0 ? void 0 : error.message,
73
- "!"
74
- ]
75
- })
76
- ]
77
- });
78
- }
79
- })
80
- ]
81
- }, modifierSet.id);
82
- })
83
- })
84
- });
85
- };
86
-
87
- export { ProductControl };
@@ -1,2 +0,0 @@
1
- import './ProductWithModifierSetModal.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/iframe/ProductWithModifierModal/ModifierSetModal/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAA"}
@@ -1,2 +0,0 @@
1
- export { ProductWithModifierSetModal } from './ModifierSetModal/ProductWithModifierSetModal';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/iframe/ProductWithModifierModal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAA"}
@@ -1,5 +0,0 @@
1
- import { OrderModifier } from "@licklist/core/dist/DataMapper/Order/OrderModifierDataMapper";
2
- export type selectModifierType = 'radio' | 'checkbox' | 'selector';
3
- export declare const filteredOrderModifierSets: (modifiersSet: OrderModifier[]) => OrderModifier[];
4
- export declare const orderProductModifiersQuantity: (orderModifiersSets: OrderModifier[], modifierSet: any) => number;
5
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/iframe/ProductWithModifierModal/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAG5F,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAA;AAElE,eAAO,MAAM,yBAAyB,iBACpB,aAAa,EAAE,KAC5B,aAAa,EAUf,CAAA;AAED,eAAO,MAAM,6BAA6B,uBACpB,aAAa,EAAE,6BAQpC,CAAA"}
@@ -1,21 +0,0 @@
1
- import { uniqBy } from 'lodash';
2
-
3
- var filteredOrderModifierSets = function(modifiersSet) {
4
- var _modifiersSet_flat;
5
- if (!modifiersSet) return [];
6
- var orderModifier = modifiersSet === null || modifiersSet === void 0 ? void 0 : (_modifiersSet_flat = modifiersSet.flat()) === null || _modifiersSet_flat === void 0 ? void 0 : _modifiersSet_flat.filter(function(modifier) {
7
- return !!(modifier === null || modifier === void 0 ? void 0 : modifier.quantity);
8
- });
9
- return uniqBy(orderModifier, function(item) {
10
- return "".concat(item.modifierId, "-").concat(item.modifierSetId);
11
- });
12
- };
13
- var orderProductModifiersQuantity = function(orderModifiersSets, modifierSet) {
14
- if (!(orderModifiersSets === null || orderModifiersSets === void 0 ? void 0 : orderModifiersSets.length)) return 0;
15
- var filteredOrderModifier = filteredOrderModifierSets(orderModifiersSets);
16
- return filteredOrderModifier.filter(function(item) {
17
- return (item === null || item === void 0 ? void 0 : item.modifierSetId) === modifierSet.id;
18
- }).length;
19
- };
20
-
21
- export { filteredOrderModifierSets, orderProductModifiersQuantity };
@@ -1,23 +0,0 @@
1
- import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct';
2
- export interface FormOrderItem {
3
- id: number;
4
- name: string;
5
- price: number;
6
- productCategoryId: number;
7
- hasDeposit?: boolean;
8
- deposit?: number | null;
9
- quantity: number;
10
- capacity?: number | null;
11
- orderModifiersSets?: OrderModifierByProduct[] | null;
12
- }
13
- interface ProductQuantityInputProps {
14
- modifier: OrderModifierByProduct;
15
- modifierKey: number;
16
- isManualBooking?: boolean;
17
- isSummary?: boolean;
18
- deleteOrderModifier?: (order: number) => void;
19
- editOrderModifierSet?: (order: number) => void;
20
- }
21
- export declare const ProductWithModifier: ({ modifier, modifierKey, isManualBooking, isSummary, deleteOrderModifier, editOrderModifierSet, }: ProductQuantityInputProps) => import("react/jsx-runtime").JSX.Element;
22
- export {};
23
- //# sourceMappingURL=ProductWithModifier.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductWithModifier.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8DAA8D,CAAA;AAMrG,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,iBAAiB,EAAE,MAAM,CAAA;IACzB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,kBAAkB,CAAC,EAAE,sBAAsB,EAAE,GAAG,IAAI,CAAA;CACrD;AAED,UAAU,yBAAyB;IACjC,QAAQ,EAAE,sBAAsB,CAAA;IAChC,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7C,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/C;AAED,eAAO,MAAM,mBAAmB,sGAO7B,yBAAyB,4CA8C3B,CAAA"}
@@ -1,62 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { Button } from 'react-bootstrap';
3
- import { useTranslation } from 'react-i18next';
4
- import { FaTrashAlt } from 'react-icons/fa';
5
- import { Config } from '@licklist/core';
6
- import { useIntl } from 'react-intl';
7
- import { getModifierName, getOrderProductModifiersPrice } from '../../../BookingSummary/utils/index.js';
8
-
9
- var ProductWithModifier = function(param) {
10
- var modifier = param.modifier, modifierKey = param.modifierKey, _param_isManualBooking = param.isManualBooking, isManualBooking = _param_isManualBooking === void 0 ? false : _param_isManualBooking, _param_isSummary = param.isSummary, isSummary = _param_isSummary === void 0 ? false : _param_isSummary, deleteOrderModifier = param.deleteOrderModifier, editOrderModifierSet = param.editOrderModifierSet;
11
- var t = useTranslation('Design').t;
12
- var formatNumber = useIntl().formatNumber;
13
- var modifierName = getModifierName(modifier);
14
- var orderModifierDescription = "".concat(modifier.productQuantity);
15
- var modifierPrice = getOrderProductModifiersPrice(modifier);
16
- var fullModifiersPrice = formatNumber(modifierPrice, {
17
- style: 'currency',
18
- currency: Config.Currency.GBP
19
- });
20
- return /*#__PURE__*/ jsxs("div", {
21
- className: "d-flex p-2 justify-content-between align-items-center",
22
- children: [
23
- /*#__PURE__*/ jsxs("div", {
24
- className: "d-flex",
25
- children: [
26
- /*#__PURE__*/ jsx("p", {
27
- className: "font-weight-bold w-25 pr-4",
28
- children: "".concat(orderModifierDescription, " x")
29
- }),
30
- /*#__PURE__*/ jsx("p", {
31
- children: modifierName ? " ".concat(modifierName) : t('withoutModifier')
32
- })
33
- ]
34
- }),
35
- isManualBooking || isSummary ? /*#__PURE__*/ jsx("p", {
36
- className: "price",
37
- children: fullModifiersPrice
38
- }) : /*#__PURE__*/ jsxs("div", {
39
- children: [
40
- /*#__PURE__*/ jsx(Button, {
41
- className: "ml-2",
42
- variant: "link",
43
- onClick: function() {
44
- return editOrderModifierSet(modifierKey);
45
- },
46
- children: t('customise')
47
- }),
48
- /*#__PURE__*/ jsx(Button, {
49
- className: "ml-2",
50
- variant: "link",
51
- onClick: function() {
52
- return deleteOrderModifier(modifierKey);
53
- },
54
- children: /*#__PURE__*/ jsx(FaTrashAlt, {})
55
- })
56
- ]
57
- })
58
- ]
59
- }, modifierKey);
60
- };
61
-
62
- export { ProductWithModifier };