@licklist/design 0.75.0 → 0.75.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/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/EditEventForm/EditEventForm.js +0 -6
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +2 -1
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +0 -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/index.js +0 -1
- 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.map +1 -1
- 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 -3
- 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 +2 -0
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.js +7 -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 +3 -1
- package/dist/product-set/utils/index.d.ts.map +1 -1
- package/dist/provider/index.d.ts +0 -1
- package/dist/provider/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/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 +0 -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 +11 -8
- 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 -9
- 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 +19 -17
- 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/provider/index.ts +0 -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/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 +183 -183
- package/dist/assets/dashboard/managerRole.svg.js +0 -18
- package/dist/assets/dashboard/subManagerRole.svg.js +0 -24
- package/dist/assets/dashboard/viewerRole.svg.js +0 -24
- package/dist/provider/company/index.d.ts +0 -2
- package/dist/provider/company/index.d.ts.map +0 -1
- package/dist/provider/company/user-form/UserForm.d.ts +0 -17
- package/dist/provider/company/user-form/UserForm.d.ts.map +0 -1
- package/dist/provider/company/user-form/UserForm.js +0 -205
- package/dist/provider/company/user-form/index.d.ts +0 -2
- package/dist/provider/company/user-form/index.d.ts.map +0 -1
- package/src/provider/company/index.ts +0 -1
- package/src/provider/company/user-form/UserForm.stories.tsx +0 -18
- package/src/provider/company/user-form/UserForm.tsx +0 -151
- package/src/provider/company/user-form/index.ts +0 -1
|
@@ -309,14 +309,17 @@ export function ProductSetControl({
|
|
|
309
309
|
</Form.Control.Feedback>
|
|
310
310
|
</Form.Group>
|
|
311
311
|
|
|
312
|
-
<Form.Group
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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>
|
|
320
323
|
|
|
321
324
|
<Form.Group controlId={termsAndConditionsId}>
|
|
322
325
|
<Form.Label>{t('Design:termsAndConditions')}</Form.Label>
|
|
@@ -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
|
|
@@ -9,18 +9,14 @@ import {
|
|
|
9
9
|
} from 'react-hook-form'
|
|
10
10
|
import { useSensor, MouseSensor } from '@dnd-kit/core'
|
|
11
11
|
import { useTranslation } from 'react-i18next'
|
|
12
|
-
import { DEFAULT_PRODUCT_TYPE } from '@licklist/core/dist/DataMapper/Product/ProductDataMapper'
|
|
13
12
|
import { generateUuid } from '@licklist/core/dist/Services'
|
|
14
13
|
import HookFormService from '@licklist/plugins/dist/services/Form/HookFormService'
|
|
15
|
-
|
|
16
14
|
import { CategoryType } from '@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper'
|
|
17
15
|
import { ProductControl, ProductControlProps, ProductSetFormValues } from '..'
|
|
18
16
|
import { SortableTree } from '../../sortable-tree'
|
|
19
17
|
import { CreateProductSetItem } from '../item/CreateProductSetItem'
|
|
20
18
|
import { Product } from '../types'
|
|
21
19
|
import { WithIsLoading } from './ProductSetForm'
|
|
22
|
-
// @TODO not for first release
|
|
23
|
-
// import Popover from "./ProductSetFormPopover";
|
|
24
20
|
import { useSortableTreeFunctions } from '../hooks/useSortableTreeFunctions'
|
|
25
21
|
import { SubProductsControl } from './SubProductsControl'
|
|
26
22
|
import { ProductSetModalClasses } from '../../sortable-tree/SortableTreeItem'
|
|
@@ -47,6 +43,8 @@ const getDefaultProductValue = (sort: number): Product => ({
|
|
|
47
43
|
deposit: 0,
|
|
48
44
|
minQuantity: null,
|
|
49
45
|
maxQuantity: null,
|
|
46
|
+
scanRangeStart: null,
|
|
47
|
+
scanRangeEnd: null,
|
|
50
48
|
totalQuantity: 0,
|
|
51
49
|
isAvailable: true,
|
|
52
50
|
modifiersSet: [],
|
|
@@ -58,7 +56,6 @@ const getDefaultProductValue = (sort: number): Product => ({
|
|
|
58
56
|
hasSpecialNotes: false,
|
|
59
57
|
weight: 0,
|
|
60
58
|
originalProductId: null,
|
|
61
|
-
type: DEFAULT_PRODUCT_TYPE,
|
|
62
59
|
tierId: Number(uniqueId()),
|
|
63
60
|
subProducts: [],
|
|
64
61
|
images: [],
|
|
@@ -287,7 +284,6 @@ export function ProductsControl({
|
|
|
287
284
|
trigger(`${productControlFieldName}.${index}`)
|
|
288
285
|
}
|
|
289
286
|
saveValidField={saveValidField}
|
|
290
|
-
// preItem={<Popover className="d-none d-sm-block" />}
|
|
291
287
|
>
|
|
292
288
|
<SubProductsControl
|
|
293
289
|
isLoading={isLoading}
|
|
@@ -313,9 +309,7 @@ export function ProductsControl({
|
|
|
313
309
|
}
|
|
314
310
|
}}
|
|
315
311
|
/>
|
|
316
|
-
<div className='manual-form-error'>
|
|
317
|
-
{categoryProductErrors && categoryProductErrors.message}
|
|
318
|
-
</div>
|
|
312
|
+
<div className='manual-form-error'>{categoryProductErrors?.message}</div>
|
|
319
313
|
</>
|
|
320
314
|
)
|
|
321
315
|
}
|
|
@@ -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,9 +1,6 @@
|
|
|
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
5
|
import { ProductType } from '@licklist/core/dist/DataMapper/Product/ProductDataMapper'
|
|
9
6
|
import HookFormService from '@licklist/plugins/dist/services/Form/HookFormService'
|
|
@@ -28,13 +25,11 @@ import {
|
|
|
28
25
|
Controller,
|
|
29
26
|
Path,
|
|
30
27
|
useFormContext,
|
|
31
|
-
useWatch,
|
|
32
28
|
UnpackNestedValue,
|
|
33
29
|
PathValue,
|
|
34
30
|
} from 'react-hook-form'
|
|
35
31
|
import { useTranslation } from 'react-i18next'
|
|
36
32
|
import { useImages } from '@licklist/plugins/dist/hooks/Media/useImages'
|
|
37
|
-
|
|
38
33
|
import {
|
|
39
34
|
Image,
|
|
40
35
|
IMAGE_TYPE_IMAGE,
|
|
@@ -65,7 +60,7 @@ import { MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH } from './constants'
|
|
|
65
60
|
import { ProductZoneControlValues } from '../product-zone'
|
|
66
61
|
import { AdvancedOptions } from './advanced-options'
|
|
67
62
|
import { ProductZonesControl } from '../form/ProductZonesControl'
|
|
68
|
-
|
|
63
|
+
import { ProductScanRangeControl } from './scanRange'
|
|
69
64
|
|
|
70
65
|
export interface ModifiersSet {
|
|
71
66
|
id: number
|
|
@@ -87,6 +82,8 @@ export interface ProductControlValues
|
|
|
87
82
|
deposit: number
|
|
88
83
|
minQuantity: number
|
|
89
84
|
maxQuantity: number
|
|
85
|
+
scanRangeStart?: number
|
|
86
|
+
scanRangeEnd?: number
|
|
90
87
|
totalQuantity: number
|
|
91
88
|
isAvailable: boolean
|
|
92
89
|
isSoldOut: boolean
|
|
@@ -122,7 +119,6 @@ export interface ProductControlProps<T>
|
|
|
122
119
|
hasTicket?: boolean
|
|
123
120
|
categoryType?: CategoryType
|
|
124
121
|
isOverrides?: boolean
|
|
125
|
-
|
|
126
122
|
}
|
|
127
123
|
|
|
128
124
|
export function ProductControl<T extends FormValues>({
|
|
@@ -137,7 +133,6 @@ export function ProductControl<T extends FormValues>({
|
|
|
137
133
|
categoryType,
|
|
138
134
|
isOverrides = false,
|
|
139
135
|
}: ProductControlProps<T>) {
|
|
140
|
-
|
|
141
136
|
const {
|
|
142
137
|
register,
|
|
143
138
|
control,
|
|
@@ -203,7 +198,6 @@ export function ProductControl<T extends FormValues>({
|
|
|
203
198
|
setInitialImages(formImages as Image[])
|
|
204
199
|
}, [getValues, setInitialImages, fieldNamePrefix])
|
|
205
200
|
|
|
206
|
-
|
|
207
201
|
useEffect(() => {
|
|
208
202
|
if (Array.isArray(images)) {
|
|
209
203
|
setValue(
|
|
@@ -299,14 +293,14 @@ export function ProductControl<T extends FormValues>({
|
|
|
299
293
|
isOverrides={isOverrides}
|
|
300
294
|
onFocus={onFocus}
|
|
301
295
|
/>
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
296
|
+
|
|
297
|
+
<ProductQuantityRechargingControl<T>
|
|
298
|
+
isLoading={isLoading}
|
|
299
|
+
fieldNamePrefix={fieldNamePrefix}
|
|
300
|
+
onFocus={onFocus}
|
|
301
|
+
disabled={isUnlimited}
|
|
302
|
+
/>
|
|
303
|
+
|
|
310
304
|
<Form.Group
|
|
311
305
|
controlId={unlimitedQuantityId}
|
|
312
306
|
className='custom-checkbox'
|
|
@@ -320,6 +314,13 @@ export function ProductControl<T extends FormValues>({
|
|
|
320
314
|
/>
|
|
321
315
|
<Form.Check.Label>{t('isUnlimited')}</Form.Check.Label>
|
|
322
316
|
</Form.Group>
|
|
317
|
+
|
|
318
|
+
<ProductScanRangeControl<T>
|
|
319
|
+
isLoading={isLoading}
|
|
320
|
+
fieldNamePrefix={fieldNamePrefix}
|
|
321
|
+
isOverrides={isOverrides}
|
|
322
|
+
onFocus={onFocus}
|
|
323
|
+
/>
|
|
323
324
|
</div>
|
|
324
325
|
</Col>
|
|
325
326
|
</Row>
|
|
@@ -411,6 +412,7 @@ export function ProductControl<T extends FormValues>({
|
|
|
411
412
|
name={`${fieldNamePrefix}.isSoldOut` as Path<T>}
|
|
412
413
|
/>
|
|
413
414
|
</Form.Group>
|
|
415
|
+
|
|
414
416
|
<Form.Group controlId={advancedId} className='custom-checkbox'>
|
|
415
417
|
<Form.Check
|
|
416
418
|
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
|
+
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import HookFormService from '@licklist/plugins/dist/services/Form/HookFormService'
|
|
2
|
+
import {
|
|
3
|
+
FieldNamePrefixPath,
|
|
4
|
+
FormValues,
|
|
5
|
+
} from '@licklist/plugins/dist/types/services/Form/hook-form-service'
|
|
6
|
+
import { useId } from '@react-aria/utils'
|
|
7
|
+
import { Form } from 'react-bootstrap'
|
|
8
|
+
import Col from 'react-bootstrap/Col'
|
|
9
|
+
import InputGroup from 'react-bootstrap/InputGroup'
|
|
10
|
+
import Row from 'react-bootstrap/Row'
|
|
11
|
+
import { Controller, Path, useFormContext } from 'react-hook-form'
|
|
12
|
+
import { useTranslation } from 'react-i18next'
|
|
13
|
+
|
|
14
|
+
import { ReactComponent as IncrementIcon } from '../../../assets/dashboard/increment.svg'
|
|
15
|
+
|
|
16
|
+
export interface ProductScanRangeControlValues extends FormValues {
|
|
17
|
+
scanRangeStart: number
|
|
18
|
+
scanRangeEnd: number
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ProductScanRangeControlProps<T> extends FieldNamePrefixPath<T> {
|
|
22
|
+
isLoading: boolean
|
|
23
|
+
onFocus?: (e: React.SyntheticEvent) => void
|
|
24
|
+
isOverrides?: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function ProductScanRangeControl<T extends FormValues>(
|
|
28
|
+
props: ProductScanRangeControlProps<T>,
|
|
29
|
+
) {
|
|
30
|
+
const { isLoading = false, fieldNamePrefix, onFocus, isOverrides } = props
|
|
31
|
+
const {
|
|
32
|
+
control,
|
|
33
|
+
formState: { errors },
|
|
34
|
+
setValue,
|
|
35
|
+
watch
|
|
36
|
+
} = useFormContext<T>()
|
|
37
|
+
const { t } = useTranslation('Design')
|
|
38
|
+
|
|
39
|
+
const scanRangeStartId = useId()
|
|
40
|
+
const scanRangeEndId = useId()
|
|
41
|
+
|
|
42
|
+
const scanRangeStartValue = watch(`${fieldNamePrefix}.scanRangeStart` as Path<T>)
|
|
43
|
+
const scanRangeEndValue = watch(`${fieldNamePrefix}.scanRangeEnd` as Path<T>)
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
<Form.Label>{t('scanningRange')}</Form.Label>
|
|
48
|
+
<Row>
|
|
49
|
+
<Col xs={12} sm={6}>
|
|
50
|
+
<Form.Group controlId={scanRangeStartId}>
|
|
51
|
+
<Form.Label>{t('beforeEventStart')}</Form.Label>
|
|
52
|
+
|
|
53
|
+
<InputGroup hasValidation>
|
|
54
|
+
<InputGroup.Prepend
|
|
55
|
+
className='arrow-up-btn'
|
|
56
|
+
onClick={() => {
|
|
57
|
+
setValue(
|
|
58
|
+
`${fieldNamePrefix}.scanRangeStart` as Path<T>,
|
|
59
|
+
(Number(scanRangeStartValue) + 1) as any,
|
|
60
|
+
)
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
<InputGroup.Text className='py-0 px-3'>
|
|
64
|
+
<IncrementIcon />
|
|
65
|
+
</InputGroup.Text>
|
|
66
|
+
</InputGroup.Prepend>
|
|
67
|
+
|
|
68
|
+
<Controller
|
|
69
|
+
render={({ field: { value, onChange, ref } }) => (
|
|
70
|
+
<Form.Control
|
|
71
|
+
ref={ref}
|
|
72
|
+
type='number'
|
|
73
|
+
min={0}
|
|
74
|
+
step={1}
|
|
75
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
76
|
+
value={value as string}
|
|
77
|
+
onChange={onChange}
|
|
78
|
+
onFocus={onFocus}
|
|
79
|
+
disabled={isLoading || isOverrides}
|
|
80
|
+
/>
|
|
81
|
+
)}
|
|
82
|
+
control={control}
|
|
83
|
+
name={`${fieldNamePrefix}.scanRangeStart` as Path<T>}
|
|
84
|
+
rules={{
|
|
85
|
+
min: {
|
|
86
|
+
value: 0,
|
|
87
|
+
message: t('Validation:fieldMinNumber', {
|
|
88
|
+
attribute: t('scanRangeStart'),
|
|
89
|
+
min: 0,
|
|
90
|
+
}) as string,
|
|
91
|
+
},
|
|
92
|
+
}}
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
<Form.Control.Feedback type='invalid'>
|
|
96
|
+
{HookFormService.getErrors<T>(
|
|
97
|
+
`${fieldNamePrefix}.scanRangeStart` as Path<T>,
|
|
98
|
+
errors,
|
|
99
|
+
)}
|
|
100
|
+
</Form.Control.Feedback>
|
|
101
|
+
</InputGroup>
|
|
102
|
+
</Form.Group>
|
|
103
|
+
</Col>
|
|
104
|
+
|
|
105
|
+
<Col xs={12} sm={6}>
|
|
106
|
+
<Form.Group controlId={scanRangeEndId}>
|
|
107
|
+
<Form.Label>{t('AfterEventStart')}</Form.Label>
|
|
108
|
+
|
|
109
|
+
<InputGroup hasValidation>
|
|
110
|
+
<InputGroup.Prepend
|
|
111
|
+
className='arrow-up-btn'
|
|
112
|
+
onClick={() => {
|
|
113
|
+
setValue(
|
|
114
|
+
`${fieldNamePrefix}.scanRangeEnd` as Path<T>,
|
|
115
|
+
(Number(scanRangeEndValue) + 1) as any,
|
|
116
|
+
)
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
<InputGroup.Text className='py-0 px-3'>
|
|
120
|
+
<IncrementIcon />
|
|
121
|
+
</InputGroup.Text>
|
|
122
|
+
</InputGroup.Prepend>
|
|
123
|
+
|
|
124
|
+
<Controller
|
|
125
|
+
render={({ field: { value, onChange, ref } }) => (
|
|
126
|
+
<Form.Control
|
|
127
|
+
ref={ref}
|
|
128
|
+
type='number'
|
|
129
|
+
min={0}
|
|
130
|
+
step={1}
|
|
131
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
132
|
+
value={value && (value as string)}
|
|
133
|
+
onFocus={onFocus}
|
|
134
|
+
onChange={onChange}
|
|
135
|
+
disabled={isLoading || isOverrides}
|
|
136
|
+
/>
|
|
137
|
+
)}
|
|
138
|
+
control={control}
|
|
139
|
+
name={`${fieldNamePrefix}.scanRangeEnd` as Path<T>}
|
|
140
|
+
rules={{
|
|
141
|
+
min: {
|
|
142
|
+
value: 0,
|
|
143
|
+
message: t('Validation:fieldMinNumber', {
|
|
144
|
+
attribute: t('scanRangeEnd'),
|
|
145
|
+
min: 0,
|
|
146
|
+
}) as string,
|
|
147
|
+
},
|
|
148
|
+
}}
|
|
149
|
+
/>
|
|
150
|
+
|
|
151
|
+
<Form.Control.Feedback type='invalid'>
|
|
152
|
+
{HookFormService.getErrors<T>(
|
|
153
|
+
`${fieldNamePrefix}.scanRangeEnd` as Path<T>,
|
|
154
|
+
errors,
|
|
155
|
+
)}
|
|
156
|
+
</Form.Control.Feedback>
|
|
157
|
+
</InputGroup>
|
|
158
|
+
</Form.Group>
|
|
159
|
+
</Col>
|
|
160
|
+
</Row>
|
|
161
|
+
</>
|
|
162
|
+
)
|
|
163
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ProductScanRangeControl'
|
|
@@ -221,6 +221,7 @@ export function ProductCategoryControl({
|
|
|
221
221
|
step={1}
|
|
222
222
|
value={value === null ? '' : value}
|
|
223
223
|
onChange={onChange}
|
|
224
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
224
225
|
isInvalid={HookFormService.isInvalid<ProductSetFormValues>(
|
|
225
226
|
`${fieldNamePrefix}.minSubItems` as const,
|
|
226
227
|
errors,
|
|
@@ -293,6 +294,7 @@ export function ProductCategoryControl({
|
|
|
293
294
|
name={name}
|
|
294
295
|
value={value === null ? '' : value}
|
|
295
296
|
onChange={onChange}
|
|
297
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
296
298
|
isInvalid={HookFormService.isInvalid<ProductSetFormValues>(
|
|
297
299
|
`${fieldNamePrefix}.maxSubItems` as const,
|
|
298
300
|
errors,
|
|
@@ -353,6 +355,7 @@ export function ProductCategoryControl({
|
|
|
353
355
|
min={0}
|
|
354
356
|
step={1}
|
|
355
357
|
type='number'
|
|
358
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
356
359
|
disabled={isOverride}
|
|
357
360
|
isInvalid={HookFormService.isInvalid<ProductSetFormValues>(
|
|
358
361
|
`${fieldNamePrefix}.overallQuantity`,
|
|
@@ -543,6 +546,7 @@ export function ProductCategoryControl({
|
|
|
543
546
|
step={1}
|
|
544
547
|
value={value}
|
|
545
548
|
onChange={onChange}
|
|
549
|
+
onWheel={(event) => event.currentTarget.blur()}
|
|
546
550
|
isInvalid={HookFormService.isInvalid<ProductSetFormValues>(
|
|
547
551
|
`${fieldNamePrefix}.remainderExpireAfter` as const,
|
|
548
552
|
errors,
|
package/src/provider/index.ts
CHANGED