@licklist/design 0.74.0 → 0.74.1-dev.1
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/affiliate/form/AffiliateForm.d.ts.map +1 -1
- package/dist/assets/dashboard/chartBar.svg.js +2 -2
- package/dist/auth/Login/LoginComponent.js +2 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +3 -2
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +1 -1
- package/dist/events/event-statistic-modal/EventStatisticModal.d.ts +2 -1
- package/dist/events/event-statistic-modal/EventStatisticModal.d.ts.map +1 -1
- package/dist/events/event-statistic-modal/EventStatisticModal.js +2 -2
- package/dist/events/event-statistic-modal/hooks/useTableData.d.ts +1 -1
- package/dist/events/event-statistic-modal/hooks/useTableData.d.ts.map +1 -1
- package/dist/events/event-statistic-modal/hooks/useTableData.js +2 -1
- package/dist/events/event-statistic-modal/utils/index.js +3 -3
- package/dist/events/event-venue-map/EventVenueMap.d.ts.map +1 -1
- package/dist/events/event-venue-map/EventVenueMap.js +1 -0
- package/dist/events/event-venue-map/hooks/useCanvasSize.d.ts.map +1 -1
- package/dist/events/event-venue-map/hooks/useCanvasSize.js +11 -4
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.js +2 -3
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.d.ts.map +1 -1
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.js +4 -11
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +13 -0
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -1
- package/dist/iframe/ryft/utils/ryft-form.d.ts.map +1 -1
- package/dist/iframe/ryft/utils/ryft-form.js +4 -5
- package/dist/layout/DropDown.d.ts +2 -1
- package/dist/layout/DropDown.d.ts.map +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.js +3 -0
- package/dist/product-set/control/ProductSetControl.d.ts +2 -0
- package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
- package/dist/product-set/control/ProductSetControl.js +10 -0
- package/dist/product-set/form/ProductSetForm.d.ts +5 -3
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductSetForm.js +1 -1
- package/dist/product-set/form/ProductZonesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductZonesControl.js +0 -2
- package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductsControl.js +4 -1
- package/dist/product-set/form/StepsControl.d.ts.map +1 -1
- package/dist/product-set/form/StepsControl.js +2 -1
- package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/SubProductsControl.js +0 -3
- package/dist/product-set/form/VenueMapsControl.d.ts.map +1 -1
- package/dist/product-set/form/VenueMapsControl.js +0 -3
- package/dist/product-set/form/context.d.ts +1 -2
- package/dist/product-set/form/context.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.d.ts +4 -1
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.js +35 -0
- package/dist/product-set/product/booking-management/ProductBookingManagementControl.d.ts.map +1 -1
- package/dist/product-set/product/booking-management/ProductBookingManagementControl.js +6 -0
- package/dist/product-set/product/deposit/ProductDepositControl.d.ts.map +1 -1
- package/dist/product-set/product/deposit/ProductDepositControl.js +3 -0
- package/dist/product-set/product/duration/ProductDurationControl.d.ts.map +1 -1
- package/dist/product-set/product/duration/ProductDurationControl.js +6 -0
- package/dist/product-set/product/price/ProductPriceControl.d.ts.map +1 -1
- package/dist/product-set/product/price/ProductPriceControl.js +3 -0
- package/dist/product-set/product/quantity/ProductQuantityConstantControl.d.ts.map +1 -1
- package/dist/product-set/product/quantity/ProductQuantityConstantControl.js +6 -0
- package/dist/product-set/product/quantity/ProductQuantityControl.d.ts.map +1 -1
- package/dist/product-set/product/quantity/ProductQuantityControl.js +6 -0
- package/dist/product-set/product/quantity/ProductQuantityRechargingControl.d.ts.map +1 -1
- package/dist/product-set/product/quantity/ProductQuantityRechargingControl.js +4 -1
- package/dist/product-set/product/scanRange/ProductScanRangeControl.d.ts +12 -0
- package/dist/product-set/product/scanRange/ProductScanRangeControl.d.ts.map +1 -0
- package/dist/product-set/product/scanRange/ProductScanRangeControl.js +153 -0
- package/dist/product-set/product/scanRange/index.d.ts +2 -0
- package/dist/product-set/product/scanRange/index.d.ts.map +1 -0
- package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.js +12 -0
- package/dist/product-set/utils/index.d.ts +5 -1
- package/dist/product-set/utils/index.d.ts.map +1 -1
- package/dist/recurrence-input/RecurrenceEndInput.d.ts.map +1 -1
- package/dist/recurrence-input/RecurrenceEndInput.js +3 -0
- package/dist/recurring-date-picker-input/RecurrenceEndInput.d.ts.map +1 -1
- package/dist/resource/form/components/CapacityControl.d.ts.map +1 -1
- package/dist/resource/form/components/CapacityControl.js +3 -0
- package/dist/resource/form/components/SortControl.d.ts.map +1 -1
- package/dist/resource/form/components/SortControl.js +3 -0
- package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
- package/dist/sales/booking/results/components/ResultCard.js +0 -2
- package/dist/sales/coupon/control/CouponFormControl.d.ts.map +1 -1
- package/dist/sales/coupon/control/CouponFormControl.js +21 -0
- package/dist/setting/dashboard/DashboardSettingForm.d.ts.map +1 -1
- package/dist/setting/dashboard/DashboardSettingForm.js +4 -1
- package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
- package/dist/static/CurrencyNumberInput.d.ts.map +1 -1
- package/dist/static/CurrencyNumberInput.js +3 -0
- package/dist/static/form-number-input/FormNumberInput.d.ts.map +1 -1
- package/dist/static/form-number-input/FormNumberInput.js +3 -0
- package/dist/static/number-input/NumberInput.d.ts.map +1 -1
- package/dist/static/number-input/NumberInput.js +3 -0
- package/dist/styles/form/CustomCheckbox.scss +31 -0
- package/dist/styles/iframe-events/Calendar.scss +1 -1
- package/dist/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
- package/dist/styles/product-set/ProductSetForm.scss +2 -3
- package/dist/styles/ryft-payment-form/RyftPaymentForm.scss +1 -3
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/dist/zone/form/components/GameDurationControl.d.ts.map +1 -1
- package/dist/zone/form/components/GameDurationControl.js +3 -0
- package/dist/zone/form/components/SortControl.d.ts.map +1 -1
- package/dist/zone/form/components/SortControl.js +3 -0
- package/package.json +8 -6
- package/src/affiliate/form/AffiliateForm.tsx +1 -0
- package/src/auth/Login/LoginComponent.tsx +1 -1
- package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +12 -7
- package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +1 -1
- package/src/events/event-statistic-modal/EventStatisticModal.tsx +3 -1
- package/src/events/event-statistic-modal/hooks/useTableData.tsx +2 -1
- package/src/events/event-statistic-modal/utils/index.ts +4 -4
- package/src/events/event-venue-map/EventVenueMap.tsx +1 -0
- package/src/events/event-venue-map/hooks/useCanvasSize.ts +5 -1
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.tsx +2 -2
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.tsx +5 -13
- package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx +1 -0
- package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +9 -0
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +1 -0
- package/src/iframe/ryft/utils/ryft-form.ts +6 -5
- package/src/layout/DropDown.tsx +1 -1
- package/src/notification/email-template/control/EmailTemplateControl.tsx +1 -0
- package/src/product-set/control/ProductSetControl.tsx +14 -0
- package/src/product-set/form/ProductSetForm.tsx +7 -6
- package/src/product-set/form/ProductZonesControl.tsx +1 -4
- package/src/product-set/form/ProductsControl.tsx +3 -7
- package/src/product-set/form/StepsControl.tsx +1 -3
- package/src/product-set/form/SubProductsControl.tsx +0 -3
- package/src/product-set/form/VenueMapsControl.tsx +0 -3
- package/src/product-set/form/context.tsx +2 -5
- package/src/product-set/product/ProductControl.tsx +53 -18
- package/src/product-set/product/advanced-options/AdvancedOptions.tsx +1 -1
- package/src/product-set/product/booking-management/ProductBookingManagementControl.tsx +2 -0
- package/src/product-set/product/deposit/ProductDepositControl.tsx +1 -0
- package/src/product-set/product/duration/ProductDurationControl.tsx +2 -0
- package/src/product-set/product/price/ProductPriceControl.tsx +1 -0
- package/src/product-set/product/quantity/ProductQuantityConstantControl.tsx +2 -0
- package/src/product-set/product/quantity/ProductQuantityControl.tsx +2 -0
- package/src/product-set/product/quantity/ProductQuantityRechargingControl.tsx +1 -0
- package/src/product-set/product/scanRange/ProductScanRangeControl.stories.ts +45 -0
- package/src/product-set/product/scanRange/ProductScanRangeControl.tsx +163 -0
- package/src/product-set/product/scanRange/index.ts +1 -0
- package/src/product-set/product-category/ProductCategoryControl.tsx +4 -0
- package/src/product-set/product-zone/ProductZoneControl.tsx +1 -1
- package/src/recurrence-input/RecurrenceEndInput.tsx +1 -0
- package/src/recurring-date-picker-input/RecurrenceEndInput.tsx +1 -0
- package/src/resource/form/components/CapacityControl.tsx +1 -0
- package/src/resource/form/components/SortControl.tsx +1 -0
- package/src/sales/booking/results/components/ResultCard.tsx +0 -2
- package/src/sales/coupon/control/CouponFormControl.tsx +7 -0
- package/src/setting/dashboard/DashboardSettingForm.tsx +1 -0
- package/src/sortable-tree/SortableTreeItem.tsx +1 -6
- package/src/static/CurrencyNumberInput.tsx +1 -0
- package/src/static/form-number-input/FormNumberInput.tsx +1 -0
- package/src/static/number-input/NumberInput.tsx +1 -0
- package/src/styles/form/CustomCheckbox.scss +31 -0
- package/src/styles/iframe-events/Calendar.scss +1 -1
- package/src/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
- package/src/styles/product-set/ProductSetForm.scss +2 -3
- package/src/styles/ryft-payment-form/RyftPaymentForm.scss +1 -3
- package/src/styles/sales/BookingResults.scss +1 -1
- package/src/zone/form/components/GameDurationControl.tsx +1 -0
- package/src/zone/form/components/SortControl.tsx +1 -0
- package/yarn.lock +830 -850
package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.tsx
CHANGED
|
@@ -35,9 +35,6 @@ export const ModifiersSetControl = ({
|
|
|
35
35
|
const { t } = useTranslation('App')
|
|
36
36
|
|
|
37
37
|
const orderModifiersSets = watch(`${productId}.orderProductModifiers`)
|
|
38
|
-
const filteredOrderModifiersSets = orderModifiersSets
|
|
39
|
-
?.flat(Infinity)
|
|
40
|
-
?.filter((item) => item && typeof item === 'object')
|
|
41
38
|
|
|
42
39
|
const { formatNumber } = useIntl()
|
|
43
40
|
const formatToCurrency = (value: number) =>
|
|
@@ -61,9 +58,8 @@ export const ModifiersSetControl = ({
|
|
|
61
58
|
const selectedModifier = modifiers?.find(
|
|
62
59
|
(item) => item.id === Number(e.target.defaultValue || e.target.id),
|
|
63
60
|
)
|
|
64
|
-
|
|
65
61
|
const checkSelectedModifier =
|
|
66
|
-
|
|
62
|
+
orderModifiersSets?.find(
|
|
67
63
|
(modifier) => modifier?.modifierId === selectedModifier?.id,
|
|
68
64
|
)?.quantity === 1
|
|
69
65
|
|
|
@@ -129,11 +125,9 @@ export const ModifiersSetControl = ({
|
|
|
129
125
|
)
|
|
130
126
|
}, [isEditMode])
|
|
131
127
|
|
|
132
|
-
const radioButtonDefaultModifier = currentOrderModifiersSets
|
|
133
|
-
.
|
|
134
|
-
|
|
135
|
-
)
|
|
136
|
-
?.modifierId.toString()
|
|
128
|
+
const radioButtonDefaultModifier = currentOrderModifiersSets.find((modifier) =>
|
|
129
|
+
modifierSet.modifiers.some((rl) => rl.id === modifier.modifierId)
|
|
130
|
+
)?.modifierId.toString();
|
|
137
131
|
|
|
138
132
|
return (
|
|
139
133
|
<>
|
|
@@ -173,9 +167,7 @@ export const ModifiersSetControl = ({
|
|
|
173
167
|
inline
|
|
174
168
|
id={modifier.id.toString()}
|
|
175
169
|
defaultChecked={!!selectedOrderModifierId}
|
|
176
|
-
defaultValue={
|
|
177
|
-
selectedOrderModifierId || modifier.id.toString()
|
|
178
|
-
}
|
|
170
|
+
defaultValue={selectedOrderModifierId || modifier.id.toString()}
|
|
179
171
|
checked={field.value === modifier.id.toString()}
|
|
180
172
|
onChange={onChange}
|
|
181
173
|
type='radio'
|
|
@@ -3,6 +3,7 @@ import { useIntl } from 'react-intl'
|
|
|
3
3
|
import * as Config from '@licklist/core/dist/Config'
|
|
4
4
|
import { OrderItem } from '@licklist/plugins/dist/types/context/Iframe/orderItems'
|
|
5
5
|
import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct'
|
|
6
|
+
import { calculateTotalModifiersPrice } from '../../utils'
|
|
6
7
|
import { ProductWithModifier } from '../../../CategoryProduct/components/ProductWithModifier/ProductWithModifier'
|
|
7
8
|
|
|
8
9
|
|
package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx
CHANGED
|
@@ -89,6 +89,7 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
|
|
|
89
89
|
<FormControl
|
|
90
90
|
type='number'
|
|
91
91
|
onChange={(e) => handleChangeValue(Number(e.target.value))}
|
|
92
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
92
93
|
value={value}
|
|
93
94
|
min={0}
|
|
94
95
|
max={max}
|
|
@@ -101,6 +102,14 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
|
|
|
101
102
|
<button
|
|
102
103
|
type='button'
|
|
103
104
|
onClick={handleArrowUpClick}
|
|
105
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
106
|
+
onFocus={(event) =>
|
|
107
|
+
event.target.addEventListener(
|
|
108
|
+
'wheel',
|
|
109
|
+
(event) => event.preventDefault(),
|
|
110
|
+
{ passive: false },
|
|
111
|
+
)
|
|
112
|
+
}
|
|
104
113
|
className={`payment-number-input__btn-up ${
|
|
105
114
|
plusButtonGreyedOut && 'disabled-number-input-button'
|
|
106
115
|
}`}
|
|
@@ -61,6 +61,7 @@ const processedPaymentSummary = ({
|
|
|
61
61
|
const total = order.fullAmount || calculateTotalPrice(order, externalPaymentDetail)
|
|
62
62
|
|
|
63
63
|
const totalDiscount = calculateTotalDiscount(order.payments)
|
|
64
|
+
|
|
64
65
|
let summaryItems: SummaryItem[] = [
|
|
65
66
|
{
|
|
66
67
|
translateKey: AMOUNT_TOTAL,
|
|
@@ -61,20 +61,22 @@ export const injectComponentsInRyftForm = ({
|
|
|
61
61
|
divider.id = 'mobile-pay-divider'
|
|
62
62
|
container.id = 'mobile-pay-divider-container'
|
|
63
63
|
container.append(dividerText, divider)
|
|
64
|
-
const payIframe = document.getElementById(
|
|
64
|
+
const payIframe = document.getElementById('ryft-pay-iframe')
|
|
65
65
|
if (payIframe) {
|
|
66
66
|
const formBox = document.getElementById('form-disable-box')
|
|
67
67
|
if (formBox) {
|
|
68
|
-
formBox.style.display = isDisableButton ?
|
|
68
|
+
formBox.style.display = isDisableButton ? 'block' : 'none'
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
const googleButton = document.getElementById(
|
|
72
72
|
'gpay-button-online-api-id',
|
|
73
73
|
) as HTMLButtonElement
|
|
74
|
-
const appleButton =document.getElementById(
|
|
74
|
+
const appleButton = document.getElementById(
|
|
75
|
+
'ryft-pay-apple-pay-button',
|
|
76
|
+
) as HTMLButtonElement
|
|
75
77
|
if (googleButton) {
|
|
76
78
|
googleButton.disabled = isDisableButton
|
|
77
|
-
googleButton.style.opacity = isDisableButton ? '1' : '0.6'
|
|
79
|
+
googleButton.style.opacity = !isDisableButton ? '1' : '0.6'
|
|
78
80
|
}
|
|
79
81
|
if (appleButton) {
|
|
80
82
|
appleButton.disabled = isDisableButton
|
|
@@ -86,7 +88,6 @@ export const injectComponentsInRyftForm = ({
|
|
|
86
88
|
const applePayButton = document.createElement('button')
|
|
87
89
|
applePayButton.id = 'apple-pay'
|
|
88
90
|
applePayButton.type = 'button'
|
|
89
|
-
applePayButton.style.opacity = !isDisableButton ? '1' : '0.6'
|
|
90
91
|
applePayButton.className = 'bg-dark btn btn-primary apple-pay-button'
|
|
91
92
|
applePayButton.textContent = t('Events:payWithApple')
|
|
92
93
|
applePayButton.onclick = onApplePayButtonClick
|
package/src/layout/DropDown.tsx
CHANGED
|
@@ -434,6 +434,7 @@ export const EmailTemplateControl = forwardRef(
|
|
|
434
434
|
`templateOptionValues.${option?.id}.value`,
|
|
435
435
|
)}
|
|
436
436
|
type='number'
|
|
437
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
437
438
|
placeholder={t(`Design:${option.name}`)}
|
|
438
439
|
id={option.name + option.id}
|
|
439
440
|
defaultValue={option.selectedValue || ''}
|
|
@@ -69,6 +69,7 @@ export interface ProductSetControlValues extends DateAndRecurrenceInputValues {
|
|
|
69
69
|
fieldSetId?: number
|
|
70
70
|
saleDeadline?: number
|
|
71
71
|
steps: Step[]
|
|
72
|
+
hasGeneralTicket?: boolean
|
|
72
73
|
emailTemplates?: TemplateItem[]
|
|
73
74
|
smsTemplates?: TemplateItem[]
|
|
74
75
|
localImageBlobURL?: string
|
|
@@ -96,6 +97,7 @@ export interface ProductSetControlProps {
|
|
|
96
97
|
providerHasBookingManagement?: boolean
|
|
97
98
|
isOverrides?: boolean
|
|
98
99
|
saleDeadline?: number
|
|
100
|
+
hasGeneralTicket?: boolean
|
|
99
101
|
isCreateNewOverrides?: boolean
|
|
100
102
|
timeZone: string
|
|
101
103
|
}
|
|
@@ -307,6 +309,18 @@ export function ProductSetControl({
|
|
|
307
309
|
</Form.Control.Feedback>
|
|
308
310
|
</Form.Group>
|
|
309
311
|
|
|
312
|
+
<Form.Group
|
|
313
|
+
controlId='hasGeneralTicket'
|
|
314
|
+
className='checkbox-second-column mt-4'
|
|
315
|
+
>
|
|
316
|
+
<Form.Check
|
|
317
|
+
data-testid='save-as-template-checkbox'
|
|
318
|
+
label={t('Design:hasGeneralTicket')}
|
|
319
|
+
{...register('hasGeneralTicket')}
|
|
320
|
+
custom
|
|
321
|
+
/>
|
|
322
|
+
</Form.Group>
|
|
323
|
+
|
|
310
324
|
<Form.Group controlId={termsAndConditionsId}>
|
|
311
325
|
<Form.Label>{t('Design:termsAndConditions')}</Form.Label>
|
|
312
326
|
<Form.Control
|
|
@@ -7,13 +7,10 @@ import { VenueMapSet } from '@licklist/core/dist/DataMapper/Product/VenueMapSetD
|
|
|
7
7
|
import { ServerError } from '@licklist/plugins/dist/hooks/Api/useHttpQuery'
|
|
8
8
|
import FormErrorService from '@licklist/plugins/dist/services/Form/FormErrorService'
|
|
9
9
|
import { ModifierSet } from '@licklist/core/dist/DataMapper/Product/ModifierSetDataMapper'
|
|
10
|
-
|
|
11
10
|
import { isEqual } from 'lodash'
|
|
12
|
-
// eslint-disable-next-line max-len
|
|
13
|
-
import { ProviderBookingManagementSetting } from '@licklist/core/dist/DataMapper/Provider/ProviderBookingManagementSettingDataMapper'
|
|
14
11
|
import { Zone } from '@licklist/core/dist/DataMapper/Provider/ZoneDataMapper'
|
|
15
12
|
import { WorkHour } from '@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper'
|
|
16
|
-
import { transformErrorToMessage } from '@licklist/plugins'
|
|
13
|
+
import { transformErrorToMessage } from '@licklist/plugins/dist/utils/error'
|
|
17
14
|
import { Dialog, useDialogContext } from '../../modals/dialog'
|
|
18
15
|
import {
|
|
19
16
|
ProductSetControl,
|
|
@@ -33,12 +30,16 @@ import { ErrorModal } from '../../iframe/order-process/components/ErrorModal'
|
|
|
33
30
|
export interface WithIsLoading {
|
|
34
31
|
isLoading: boolean
|
|
35
32
|
}
|
|
33
|
+
export interface WithIdOptional {
|
|
34
|
+
id?: number
|
|
35
|
+
}
|
|
36
|
+
|
|
36
37
|
export interface WithId {
|
|
37
38
|
id: number
|
|
38
39
|
}
|
|
39
40
|
export interface ProductSetFormValues
|
|
40
41
|
extends FormValues,
|
|
41
|
-
|
|
42
|
+
WithIdOptional,
|
|
42
43
|
ProductSetControlValues {
|
|
43
44
|
steps: Step[]
|
|
44
45
|
isOverrides?: boolean
|
|
@@ -55,7 +56,7 @@ export interface ProductSetFormProps
|
|
|
55
56
|
serverErrors?: ServerError
|
|
56
57
|
providerHasMap?: boolean
|
|
57
58
|
venueMapSets?: VenueMapSet[]
|
|
58
|
-
providerHasBookingManagement?:
|
|
59
|
+
providerHasBookingManagement?: boolean
|
|
59
60
|
zones?: Zone[] | null
|
|
60
61
|
isCreateAction?: boolean
|
|
61
62
|
isOverrides?: boolean
|
|
@@ -12,15 +12,12 @@ import { useTranslation } from 'react-i18next'
|
|
|
12
12
|
import { DEFAULT_PRODUCT_TYPE } from '@licklist/core/dist/DataMapper/Product/ProductDataMapper'
|
|
13
13
|
import { generateUuid } from '@licklist/core/dist/Services'
|
|
14
14
|
import HookFormService from '@licklist/plugins/dist/services/Form/HookFormService'
|
|
15
|
-
|
|
16
15
|
import { CategoryType } from '@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper'
|
|
17
16
|
import { ProductControl, ProductControlProps, ProductSetFormValues } from '..'
|
|
18
17
|
import { SortableTree } from '../../sortable-tree'
|
|
19
18
|
import { CreateProductSetItem } from '../item/CreateProductSetItem'
|
|
20
19
|
import { Product } from '../types'
|
|
21
20
|
import { WithIsLoading } from './ProductSetForm'
|
|
22
|
-
// @TODO not for first release
|
|
23
|
-
// import Popover from "./ProductSetFormPopover";
|
|
24
21
|
import { useSortableTreeFunctions } from '../hooks/useSortableTreeFunctions'
|
|
25
22
|
import { SubProductsControl } from './SubProductsControl'
|
|
26
23
|
import { ProductSetModalClasses } from '../../sortable-tree/SortableTreeItem'
|
|
@@ -47,6 +44,8 @@ const getDefaultProductValue = (sort: number): Product => ({
|
|
|
47
44
|
deposit: 0,
|
|
48
45
|
minQuantity: null,
|
|
49
46
|
maxQuantity: null,
|
|
47
|
+
scanRangeStart: null,
|
|
48
|
+
scanRangeEnd: null,
|
|
50
49
|
totalQuantity: 0,
|
|
51
50
|
isAvailable: true,
|
|
52
51
|
modifiersSet: [],
|
|
@@ -287,7 +286,6 @@ export function ProductsControl({
|
|
|
287
286
|
trigger(`${productControlFieldName}.${index}`)
|
|
288
287
|
}
|
|
289
288
|
saveValidField={saveValidField}
|
|
290
|
-
// preItem={<Popover className="d-none d-sm-block" />}
|
|
291
289
|
>
|
|
292
290
|
<SubProductsControl
|
|
293
291
|
isLoading={isLoading}
|
|
@@ -313,9 +311,7 @@ export function ProductsControl({
|
|
|
313
311
|
}
|
|
314
312
|
}}
|
|
315
313
|
/>
|
|
316
|
-
<div className='manual-form-error'>
|
|
317
|
-
{categoryProductErrors && categoryProductErrors.message}
|
|
318
|
-
</div>
|
|
314
|
+
<div className='manual-form-error'>{categoryProductErrors?.message}</div>
|
|
319
315
|
</>
|
|
320
316
|
)
|
|
321
317
|
}
|
|
@@ -70,9 +70,6 @@ export function SubProductsControl({
|
|
|
70
70
|
images: subProducts[index]?.images as Image[],
|
|
71
71
|
}
|
|
72
72
|
// @ts-expect-error TS2345
|
|
73
|
-
// @TODO fix prod type error
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
75
|
-
// @ts-ignore
|
|
76
73
|
append(subProductCopy)
|
|
77
74
|
}}
|
|
78
75
|
/>
|
|
@@ -46,9 +46,6 @@ export const VenueMapsControl = ({
|
|
|
46
46
|
url={image.url}
|
|
47
47
|
name={name}
|
|
48
48
|
points={points}
|
|
49
|
-
// @TODO fix prod type error
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
51
|
-
// @ts-ignore
|
|
52
49
|
products={products}
|
|
53
50
|
pointProducts={pointProducts}
|
|
54
51
|
onPointProductsChange={onPointProductsChange}
|
|
@@ -8,12 +8,9 @@ import {
|
|
|
8
8
|
} from 'react'
|
|
9
9
|
import { VenueMapSet } from '@licklist/core/dist/DataMapper/Product/VenueMapSetDataMapper'
|
|
10
10
|
import { ModifierSet } from '@licklist/core/dist/DataMapper/Product/ModifierSetDataMapper'
|
|
11
|
-
// eslint-disable-next-line max-len
|
|
12
|
-
import { ProviderBookingManagementSetting } from '@licklist/core/dist/DataMapper/Provider/ProviderBookingManagementSettingDataMapper'
|
|
13
11
|
import { Zone } from '@licklist/core/dist/DataMapper/Provider/ZoneDataMapper'
|
|
14
12
|
import { SelectItem } from '../../types/generic/SelectItem'
|
|
15
13
|
|
|
16
|
-
|
|
17
14
|
interface LoadingContext {
|
|
18
15
|
isLoading: boolean
|
|
19
16
|
setLoading: (loading: boolean) => void
|
|
@@ -21,7 +18,7 @@ interface LoadingContext {
|
|
|
21
18
|
modifiersSetList?: ModifierSet[] | null
|
|
22
19
|
providerHasMap?: boolean | null
|
|
23
20
|
venueMapSets?: VenueMapSet[]
|
|
24
|
-
providerHasBookingManagement?:
|
|
21
|
+
providerHasBookingManagement?: boolean
|
|
25
22
|
zones?: Zone[] | null
|
|
26
23
|
expandedProductCategories: Record<string, boolean>
|
|
27
24
|
setExpandedProductCategories: Dispatch<
|
|
@@ -46,7 +43,7 @@ type ProductSetContextProviderProps = PropsWithChildren<
|
|
|
46
43
|
export function ProductSetContextProvider({
|
|
47
44
|
children,
|
|
48
45
|
productGroupList = [],
|
|
49
|
-
modifiersSetList =[],
|
|
46
|
+
modifiersSetList = [],
|
|
50
47
|
providerHasMap = false,
|
|
51
48
|
venueMapSets = [],
|
|
52
49
|
providerHasBookingManagement,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CategoryType,
|
|
3
3
|
QuantityType,
|
|
4
|
-
QUANTITY_TYPE_CONSTANT,
|
|
5
|
-
QUANTITY_TYPE_LIST_DTO,
|
|
6
|
-
QUANTITY_TYPE_RECHARGING,
|
|
7
4
|
} from '@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper'
|
|
8
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
PRODUCT_WAIVER_TYPE_ADULT,
|
|
7
|
+
PRODUCT_WAIVER_TYPE_CHILD,
|
|
8
|
+
ProductType,
|
|
9
|
+
ProductWaiverType,
|
|
10
|
+
} from '@licklist/core/dist/DataMapper/Product/ProductDataMapper'
|
|
9
11
|
import HookFormService from '@licklist/plugins/dist/services/Form/HookFormService'
|
|
10
12
|
import clsx from 'clsx'
|
|
11
13
|
import {
|
|
@@ -28,13 +30,11 @@ import {
|
|
|
28
30
|
Controller,
|
|
29
31
|
Path,
|
|
30
32
|
useFormContext,
|
|
31
|
-
useWatch,
|
|
32
33
|
UnpackNestedValue,
|
|
33
34
|
PathValue,
|
|
34
35
|
} from 'react-hook-form'
|
|
35
36
|
import { useTranslation } from 'react-i18next'
|
|
36
37
|
import { useImages } from '@licklist/plugins/dist/hooks/Media/useImages'
|
|
37
|
-
|
|
38
38
|
import {
|
|
39
39
|
Image,
|
|
40
40
|
IMAGE_TYPE_IMAGE,
|
|
@@ -65,7 +65,7 @@ import { MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH } from './constants'
|
|
|
65
65
|
import { ProductZoneControlValues } from '../product-zone'
|
|
66
66
|
import { AdvancedOptions } from './advanced-options'
|
|
67
67
|
import { ProductZonesControl } from '../form/ProductZonesControl'
|
|
68
|
-
|
|
68
|
+
import { ProductScanRangeControl } from './scanRange'
|
|
69
69
|
|
|
70
70
|
export interface ModifiersSet {
|
|
71
71
|
id: number
|
|
@@ -87,6 +87,8 @@ export interface ProductControlValues
|
|
|
87
87
|
deposit: number
|
|
88
88
|
minQuantity: number
|
|
89
89
|
maxQuantity: number
|
|
90
|
+
scanRangeStart?: number
|
|
91
|
+
scanRangeEnd?: number
|
|
90
92
|
totalQuantity: number
|
|
91
93
|
isAvailable: boolean
|
|
92
94
|
isSoldOut: boolean
|
|
@@ -106,6 +108,7 @@ export interface ProductControlValues
|
|
|
106
108
|
sort: number | null
|
|
107
109
|
color?: string
|
|
108
110
|
productZones?: ProductZoneControlValues[]
|
|
111
|
+
waiverType?: ProductWaiverType | null
|
|
109
112
|
}
|
|
110
113
|
|
|
111
114
|
export interface ProductControlProps<T>
|
|
@@ -122,7 +125,6 @@ export interface ProductControlProps<T>
|
|
|
122
125
|
hasTicket?: boolean
|
|
123
126
|
categoryType?: CategoryType
|
|
124
127
|
isOverrides?: boolean
|
|
125
|
-
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
export function ProductControl<T extends FormValues>({
|
|
@@ -137,7 +139,6 @@ export function ProductControl<T extends FormValues>({
|
|
|
137
139
|
categoryType,
|
|
138
140
|
isOverrides = false,
|
|
139
141
|
}: ProductControlProps<T>) {
|
|
140
|
-
|
|
141
142
|
const {
|
|
142
143
|
register,
|
|
143
144
|
control,
|
|
@@ -203,7 +204,6 @@ export function ProductControl<T extends FormValues>({
|
|
|
203
204
|
setInitialImages(formImages as Image[])
|
|
204
205
|
}, [getValues, setInitialImages, fieldNamePrefix])
|
|
205
206
|
|
|
206
|
-
|
|
207
207
|
useEffect(() => {
|
|
208
208
|
if (Array.isArray(images)) {
|
|
209
209
|
setValue(
|
|
@@ -299,14 +299,21 @@ export function ProductControl<T extends FormValues>({
|
|
|
299
299
|
isOverrides={isOverrides}
|
|
300
300
|
onFocus={onFocus}
|
|
301
301
|
/>
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
302
|
+
|
|
303
|
+
<ProductQuantityRechargingControl<T>
|
|
304
|
+
isLoading={isLoading}
|
|
305
|
+
fieldNamePrefix={fieldNamePrefix}
|
|
306
|
+
onFocus={onFocus}
|
|
307
|
+
disabled={isUnlimited}
|
|
308
|
+
/>
|
|
309
|
+
|
|
310
|
+
<ProductScanRangeControl<T>
|
|
311
|
+
isLoading={isLoading}
|
|
312
|
+
fieldNamePrefix={fieldNamePrefix}
|
|
313
|
+
isOverrides={isOverrides}
|
|
314
|
+
onFocus={onFocus}
|
|
315
|
+
/>
|
|
316
|
+
|
|
310
317
|
<Form.Group
|
|
311
318
|
controlId={unlimitedQuantityId}
|
|
312
319
|
className='custom-checkbox'
|
|
@@ -411,6 +418,34 @@ export function ProductControl<T extends FormValues>({
|
|
|
411
418
|
name={`${fieldNamePrefix}.isSoldOut` as Path<T>}
|
|
412
419
|
/>
|
|
413
420
|
</Form.Group>
|
|
421
|
+
|
|
422
|
+
<Form.Group>
|
|
423
|
+
<Form.Label>{t('Design:Type')}</Form.Label>
|
|
424
|
+
<Form.Control
|
|
425
|
+
{...register(`${fieldNamePrefix}.waiverType` as Path<T>)}
|
|
426
|
+
as='select'
|
|
427
|
+
defaultValue={PRODUCT_WAIVER_TYPE_ADULT}
|
|
428
|
+
disabled={isOverrides}
|
|
429
|
+
isInvalid={HookFormService.isInvalid(
|
|
430
|
+
`${fieldNamePrefix}.waiverType` as Path<T>,
|
|
431
|
+
errors,
|
|
432
|
+
)}
|
|
433
|
+
>
|
|
434
|
+
<option value={PRODUCT_WAIVER_TYPE_ADULT}>
|
|
435
|
+
{t('Design:adult')}
|
|
436
|
+
</option>
|
|
437
|
+
<option value={PRODUCT_WAIVER_TYPE_CHILD}>
|
|
438
|
+
{t('Design:child')}
|
|
439
|
+
</option>
|
|
440
|
+
</Form.Control>
|
|
441
|
+
<Form.Control.Feedback type='invalid'>
|
|
442
|
+
{HookFormService.getErrors(
|
|
443
|
+
`${fieldNamePrefix}.waiverType` as Path<T>,
|
|
444
|
+
errors,
|
|
445
|
+
)}
|
|
446
|
+
</Form.Control.Feedback>
|
|
447
|
+
</Form.Group>
|
|
448
|
+
|
|
414
449
|
<Form.Group controlId={advancedId} className='custom-checkbox'>
|
|
415
450
|
<Form.Check
|
|
416
451
|
custom
|
|
@@ -86,6 +86,7 @@ export function ProductBookingManagementControl<T extends FormValues>(
|
|
|
86
86
|
<Form.Control
|
|
87
87
|
ref={ref}
|
|
88
88
|
type='number'
|
|
89
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
89
90
|
min={0}
|
|
90
91
|
step={1}
|
|
91
92
|
value={value as string}
|
|
@@ -129,6 +130,7 @@ export function ProductBookingManagementControl<T extends FormValues>(
|
|
|
129
130
|
<Form.Control
|
|
130
131
|
ref={ref}
|
|
131
132
|
type='number'
|
|
133
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
132
134
|
min='0'
|
|
133
135
|
step='1'
|
|
134
136
|
value={value as string}
|
|
@@ -91,6 +91,7 @@ export const ProductDurationControl = <T,>({
|
|
|
91
91
|
<Form.Control
|
|
92
92
|
type='number'
|
|
93
93
|
min={0}
|
|
94
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
94
95
|
step={1}
|
|
95
96
|
value={durationHours}
|
|
96
97
|
disabled={disabled}
|
|
@@ -127,6 +128,7 @@ export const ProductDurationControl = <T,>({
|
|
|
127
128
|
type='number'
|
|
128
129
|
min={0}
|
|
129
130
|
step={1}
|
|
131
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
130
132
|
disabled={disabled}
|
|
131
133
|
value={durationMinutes}
|
|
132
134
|
isInvalid={isInvalid}
|
|
@@ -111,6 +111,7 @@ export function ProductQuantityConstantControl<T extends FormValues>(
|
|
|
111
111
|
type='number'
|
|
112
112
|
min={0}
|
|
113
113
|
step={1}
|
|
114
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
114
115
|
value={value as string}
|
|
115
116
|
isInvalid={HookFormService.isInvalid<T>(
|
|
116
117
|
`${fieldNamePrefix}.totalQuantity` as Path<T>,
|
|
@@ -165,6 +166,7 @@ export function ProductQuantityConstantControl<T extends FormValues>(
|
|
|
165
166
|
type='number'
|
|
166
167
|
min={0}
|
|
167
168
|
step={1}
|
|
169
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
168
170
|
value={value as string}
|
|
169
171
|
onChange={onChange}
|
|
170
172
|
onFocus={onFocus}
|
|
@@ -85,6 +85,7 @@ export function ProductQuantityControl<T extends FormValues>(
|
|
|
85
85
|
type='number'
|
|
86
86
|
min={0}
|
|
87
87
|
step={1}
|
|
88
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
88
89
|
value={value as string}
|
|
89
90
|
onChange={onChange}
|
|
90
91
|
onFocus={onFocus}
|
|
@@ -143,6 +144,7 @@ export function ProductQuantityControl<T extends FormValues>(
|
|
|
143
144
|
type='number'
|
|
144
145
|
min={0}
|
|
145
146
|
step={1}
|
|
147
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
146
148
|
value={value && (value as string)}
|
|
147
149
|
onFocus={onFocus}
|
|
148
150
|
onChange={onChange}
|
|
@@ -69,6 +69,7 @@ export function ProductQuantityRechargingControl<T extends FormValues>(
|
|
|
69
69
|
type='number'
|
|
70
70
|
min={0}
|
|
71
71
|
step={1}
|
|
72
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
72
73
|
{...register(`${fieldNamePrefix}.totalQuantity` as Path<T>, {
|
|
73
74
|
validate: (value) => {
|
|
74
75
|
if (unlimited) return true
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// ProductScanRangeControl.stories.tsx
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { FormProvider, useForm } from 'react-hook-form';
|
|
4
|
+
import Form from 'react-bootstrap/Form';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
ProductScanRangeControl,
|
|
8
|
+
ProductScanRangeControlProps,
|
|
9
|
+
ProductScanRangeControlValues,
|
|
10
|
+
} from './ProductScanRangeControl';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
const meta: Meta<typeof ProductScanRangeControl> = {
|
|
14
|
+
title: 'Product Set/Product/Scan Range',
|
|
15
|
+
component: ProductScanRangeControl,
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
type Story = StoryObj<typeof ProductScanRangeControl>;
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
isLoading: false,
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
render: (args: ProductScanRangeControlProps<{}>) => {
|
|
28
|
+
const methods = useForm<ProductScanRangeControlValues>({ mode: 'onChange' });
|
|
29
|
+
const onSubmit = (data: ProductScanRangeControlValues) =>
|
|
30
|
+
console.log('onSubmit', data);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<FormProvider {...methods}>
|
|
34
|
+
<Form
|
|
35
|
+
className="d-flex flex-column"
|
|
36
|
+
noValidate
|
|
37
|
+
onSubmit={methods.handleSubmit(onSubmit)}
|
|
38
|
+
>
|
|
39
|
+
<ProductScanRangeControl {...args} />
|
|
40
|
+
</Form>
|
|
41
|
+
</FormProvider>
|
|
42
|
+
);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|