@licklist/design 0.44.550 → 0.44.551-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/assets/dashboard/info.svg +8 -0
- package/dist/assets/dashboard/info.svg.js +1 -0
- package/dist/calendar/components/CalendarDates/CalendarDates.d.ts.map +1 -1
- package/dist/calendar/components/CalendarDates/CalendarDates.js +1 -1
- package/dist/date-time-button/DateContent.d.ts +2 -2
- package/dist/date-time-button/DateContent.d.ts.map +1 -1
- package/dist/date-time-button/DateContent.js +1 -1
- package/dist/date-time-button/DateTimeButton.d.ts +10 -6
- package/dist/date-time-button/DateTimeButton.d.ts.map +1 -1
- package/dist/date-time-button/DateTimeButton.js +1 -1
- package/dist/events/event-card/utils.d.ts.map +1 -1
- package/dist/events/event-card/utils.js +1 -1
- package/dist/events/event-statistic-modal/utils/index.d.ts +10 -4
- package/dist/events/event-statistic-modal/utils/index.d.ts.map +1 -1
- package/dist/events/event-statistic-modal/utils/index.js +1 -1
- package/dist/events/event-venue-map/components/MapPoint/MapPoint.d.ts +1 -1
- package/dist/events/event-venue-map/components/MapPoint/MapPoint.d.ts.map +1 -1
- package/dist/iframe/event/event-booking-products/EventBookingProducts.d.ts +4 -2
- package/dist/iframe/event/event-booking-products/EventBookingProducts.d.ts.map +1 -1
- package/dist/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.d.ts +4 -2
- package/dist/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/dist/iframe/event/event-order-summary/EventOrderSummary.d.ts +1 -1
- package/dist/iframe/event/event-order-summary/EventOrderSummary.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts +10 -0
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts.map +1 -0
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.js +1 -0
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/index.d.ts +2 -0
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/index.d.ts.map +1 -0
- package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.d.ts +4 -3
- package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +3 -4
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts +4 -2
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.js +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/Category.d.ts +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/Category.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.d.ts +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
- package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts +2 -2
- package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts.map +1 -1
- package/dist/iframe/payment/payment-page/PaymentPage.d.ts.map +1 -1
- package/dist/iframe/payment/payment-page/PaymentPage.js +1 -1
- package/dist/iframe/payment/payment-status-page/PaymentStatusPage.d.ts +2 -2
- package/dist/iframe/payment/payment-status-page/PaymentStatusPage.d.ts.map +1 -1
- package/dist/iframe/payment/payment-status-page/PaymentStatusPage.js +1 -1
- package/dist/iframe/payment/payment-status-page/component/PaymentStatusBody.d.ts +2 -2
- package/dist/iframe/payment/payment-status-page/component/PaymentStatusBody.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
- package/dist/report/DataFieldsSelector/DataFieldsSelector.d.ts +13 -0
- package/dist/report/DataFieldsSelector/DataFieldsSelector.d.ts.map +1 -0
- package/dist/report/DataFieldsSelector/DataFieldsSelector.js +1 -0
- package/dist/report/DataFieldsSelector/index.d.ts +2 -0
- package/dist/report/DataFieldsSelector/index.d.ts.map +1 -0
- package/dist/report/ReportRunnerModal/ReportRunnerModal.d.ts +22 -0
- package/dist/report/ReportRunnerModal/ReportRunnerModal.d.ts.map +1 -0
- package/dist/report/ReportRunnerModal/ReportRunnerModal.js +1 -0
- package/dist/report/ReportRunnerModal/index.d.ts +2 -0
- package/dist/report/ReportRunnerModal/index.d.ts.map +1 -0
- package/dist/report/ReportTypeSelect/ReportTypeSelect.d.ts +3 -0
- package/dist/report/ReportTypeSelect/ReportTypeSelect.d.ts.map +1 -0
- package/dist/report/ReportTypeSelect/ReportTypeSelect.js +1 -0
- package/dist/report/ReportTypeSelect/index.d.ts +2 -0
- package/dist/report/ReportTypeSelect/index.d.ts.map +1 -0
- package/dist/report/index.d.ts +3 -0
- package/dist/report/index.d.ts.map +1 -1
- package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.d.ts +3 -1
- package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.d.ts.map +1 -1
- package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.js +1 -1
- package/dist/styles/iframe-order-process/IframeOrderProcess.scss +6 -4
- package/dist/styles/report/ReportEditorModal.scss +98 -0
- package/dist/styles/report/ReportRunnerModal.scss +95 -0
- package/dist/styles/report/_index.scss +3 -1
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/dist/types/iframe.d.ts +2 -50
- package/dist/types/iframe.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/assets/dashboard/info.svg +8 -0
- package/src/calendar/components/CalendarDates/CalendarDates.tsx +3 -4
- package/src/date-time-button/DateContent.tsx +27 -9
- package/src/date-time-button/DateTimeButton.stories.tsx +13 -14
- package/src/date-time-button/DateTimeButton.tsx +35 -26
- package/src/events/event-card/utils.ts +10 -2
- package/src/events/event-statistic-modal/EventStatisticModal.stories.tsx +51 -0
- package/src/events/event-statistic-modal/utils/index.ts +81 -45
- package/src/events/event-venue-map/components/MapPoint/MapPoint.tsx +1 -1
- package/src/iframe/event/event-booking-products/EventBookingProducts.tsx +4 -3
- package/src/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.tsx +8 -4
- package/src/iframe/event/event-order-summary/EventOrderSummary.tsx +0 -2
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.stories.tsx +46 -31
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +12 -19
- package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx +43 -0
- package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/index.ts +1 -0
- package/src/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.tsx +48 -66
- package/src/iframe/order-process/components/BookingSummary/types/index.ts +3 -4
- package/src/iframe/order-process/components/BookingSummary/utils/index.ts +11 -2
- package/src/iframe/order-process/components/CalendarStepsForm/components/Category.tsx +1 -1
- package/src/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.tsx +4 -1
- package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +4 -1
- package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +4 -1
- package/src/iframe/order-process/components/utils/useCategoryVerification.ts +3 -2
- package/src/iframe/payment/payment-page/PaymentPage.tsx +5 -6
- package/src/iframe/payment/payment-status-page/PaymentStatusPage.tsx +13 -26
- package/src/iframe/payment/payment-status-page/component/PaymentStatusBody.tsx +2 -2
- package/src/product-set/control/DateAndRecurrenceInput.tsx +2 -1
- package/src/report/DataFieldsSelector/DataFieldsSelector.tsx +112 -0
- package/src/report/DataFieldsSelector/index.ts +1 -0
- package/src/report/ReportRunnerModal/ReportRunnerModal.tsx +183 -0
- package/src/report/ReportRunnerModal/index.ts +1 -0
- package/src/report/ReportTypeSelect/ReportTypeSelect.tsx +67 -0
- package/src/report/ReportTypeSelect/index.ts +1 -0
- package/src/report/index.ts +3 -0
- package/src/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.stories.tsx +48 -0
- package/src/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.tsx +17 -4
- package/src/styles/iframe-order-process/IframeOrderProcess.scss +6 -4
- package/src/styles/report/ReportEditorModal.scss +98 -0
- package/src/styles/report/ReportRunnerModal.scss +95 -0
- package/src/styles/report/_index.scss +3 -1
- package/src/styles/sales/BookingResults.scss +1 -1
- package/src/types/iframe.ts +2 -58
|
@@ -3,12 +3,12 @@ import { useTranslation } from "react-i18next";
|
|
|
3
3
|
import {
|
|
4
4
|
ORDER_STATUS_PENDING,
|
|
5
5
|
ORDER_STATUS_SUCCESS,
|
|
6
|
-
|
|
6
|
+
OrderStatus,
|
|
7
7
|
} from "../PaymentStatusPage";
|
|
8
8
|
import { StatusBody } from "../../status-body/StatusBody";
|
|
9
9
|
|
|
10
10
|
interface PaymentStatusBodyProps {
|
|
11
|
-
status:
|
|
11
|
+
status: OrderStatus;
|
|
12
12
|
onBack: () => void;
|
|
13
13
|
onTryAgain?: () => void;
|
|
14
14
|
email?: string;
|
|
@@ -126,7 +126,8 @@ export const DateAndRecurrenceInput = ({
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
const availableTime =
|
|
129
|
+
const availableTime =
|
|
130
|
+
availableTimesFormRef?.current?.getValues()?.availableTimes || null;
|
|
130
131
|
|
|
131
132
|
const values = {
|
|
132
133
|
rrule: next.rrule,
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React, { ChangeEvent } from "react";
|
|
2
|
+
import { useId } from "@react-aria/utils";
|
|
3
|
+
import { xor } from "lodash";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import { Form, Row, Col } from "react-bootstrap";
|
|
6
|
+
import { Controller, useFormContext } from "react-hook-form";
|
|
7
|
+
import { LoaderIndicator } from "../../static/loader/LoaderIndicator";
|
|
8
|
+
|
|
9
|
+
type ReportField = {
|
|
10
|
+
id: number;
|
|
11
|
+
key: string;
|
|
12
|
+
title: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
interface DataFieldsSelectorType {
|
|
16
|
+
reportFields: ReportField[];
|
|
17
|
+
isLoading?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const DataFieldsSelector = ({
|
|
21
|
+
reportFields,
|
|
22
|
+
isLoading,
|
|
23
|
+
}: DataFieldsSelectorType) => {
|
|
24
|
+
const { t } = useTranslation(["App", "Design"]);
|
|
25
|
+
const {
|
|
26
|
+
control,
|
|
27
|
+
formState: { errors },
|
|
28
|
+
} = useFormContext();
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
{isLoading && (
|
|
33
|
+
<div className="report-fields-loader">
|
|
34
|
+
<LoaderIndicator />
|
|
35
|
+
</div>
|
|
36
|
+
)}
|
|
37
|
+
|
|
38
|
+
{!isLoading && (
|
|
39
|
+
<>
|
|
40
|
+
<Form.Label className="mt-4">{t("dataFields")}</Form.Label>
|
|
41
|
+
<Row>
|
|
42
|
+
<Controller
|
|
43
|
+
name="reportFieldValues"
|
|
44
|
+
data-testid="report-field-values-select"
|
|
45
|
+
control={control}
|
|
46
|
+
rules={{
|
|
47
|
+
validate: (value) => {
|
|
48
|
+
if (value.length > 0) return true;
|
|
49
|
+
return t("dataFieldRequired") as string;
|
|
50
|
+
},
|
|
51
|
+
}}
|
|
52
|
+
render={({ field }) => {
|
|
53
|
+
const onChange = (e: ChangeEvent<HTMLInputElement>) => {
|
|
54
|
+
// xor adds value if not present, removes if present
|
|
55
|
+
field.onChange(xor(field.value, [Number(e.target.value)]));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<>
|
|
60
|
+
{reportFields?.map((reportField) => (
|
|
61
|
+
<Col key={reportField.id} lg={6}>
|
|
62
|
+
<Checkbox
|
|
63
|
+
value={reportField.id}
|
|
64
|
+
onChange={onChange}
|
|
65
|
+
label={reportField.title}
|
|
66
|
+
checked={field.value.includes(reportField.id)}
|
|
67
|
+
/>
|
|
68
|
+
</Col>
|
|
69
|
+
))}
|
|
70
|
+
</>
|
|
71
|
+
);
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
</Row>
|
|
75
|
+
|
|
76
|
+
{errors.reportFieldValues?.message && (
|
|
77
|
+
<Row>
|
|
78
|
+
<Col>
|
|
79
|
+
<div className="invalid-feedback field-values-error">
|
|
80
|
+
{errors.reportFieldValues?.message}
|
|
81
|
+
</div>
|
|
82
|
+
</Col>
|
|
83
|
+
</Row>
|
|
84
|
+
)}
|
|
85
|
+
</>
|
|
86
|
+
)}
|
|
87
|
+
</>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
type CheckboxProps = {
|
|
92
|
+
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
93
|
+
value: number;
|
|
94
|
+
label: string;
|
|
95
|
+
checked: boolean;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const Checkbox = ({ onChange, value, label, checked }: CheckboxProps) => {
|
|
99
|
+
const checkboxId = useId();
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<Form.Group controlId={checkboxId} className="custom-checkbox">
|
|
103
|
+
<Form.Check
|
|
104
|
+
label={label}
|
|
105
|
+
value={value}
|
|
106
|
+
onChange={onChange}
|
|
107
|
+
checked={checked}
|
|
108
|
+
custom
|
|
109
|
+
/>
|
|
110
|
+
</Form.Group>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./DataFieldsSelector";
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { Report, ReportType } from "@licklist/core/dist/DataMapper/Report";
|
|
2
|
+
import { capitalize } from "lodash";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Button, Form, Modal } from "react-bootstrap";
|
|
5
|
+
import { useForm } from "react-hook-form";
|
|
6
|
+
import { useTranslation } from "react-i18next";
|
|
7
|
+
import { openOnlineViewer } from "@licklist/plugins/dist/utils/report";
|
|
8
|
+
import { HttpQuery } from "@licklist/plugins/dist/hooks/Api/useHttpQuery";
|
|
9
|
+
import { CachedHttpQueryResponse } from "@licklist/plugins/dist/hooks/Api/useCachedHttpQuery";
|
|
10
|
+
import { BlockLoader } from "../../static/loader";
|
|
11
|
+
|
|
12
|
+
interface ReportField {
|
|
13
|
+
id: number;
|
|
14
|
+
key: string;
|
|
15
|
+
title: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type ReportRunnerModalProps = {
|
|
19
|
+
reportId: Report["id"] | null;
|
|
20
|
+
show: boolean;
|
|
21
|
+
useShowReportFields: (
|
|
22
|
+
reportType?: ReportType
|
|
23
|
+
) => CachedHttpQueryResponse<ReportField[], unknown>;
|
|
24
|
+
generate?: HttpQuery<Record<string, string>[] | null> ;
|
|
25
|
+
download?: HttpQuery<Blob | null>;
|
|
26
|
+
onHide: () => void;
|
|
27
|
+
onEdit: () => void;
|
|
28
|
+
reports?: Report[] | null;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type FormValues = {
|
|
32
|
+
dateFrom: string;
|
|
33
|
+
dateTo: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const ReportRunnerModal = ({
|
|
37
|
+
reportId,
|
|
38
|
+
show,
|
|
39
|
+
onHide,
|
|
40
|
+
useShowReportFields,
|
|
41
|
+
reports,
|
|
42
|
+
generate,
|
|
43
|
+
download,
|
|
44
|
+
onEdit,
|
|
45
|
+
}: ReportRunnerModalProps) => {
|
|
46
|
+
const { t } = useTranslation(["App", "Design"]);
|
|
47
|
+
const report = reports?.find((report) => report.id === reportId);
|
|
48
|
+
|
|
49
|
+
const { data: reportFields = [], isLoading: isLoadingReportFields } =
|
|
50
|
+
useShowReportFields(report?.type);
|
|
51
|
+
|
|
52
|
+
const {
|
|
53
|
+
handleSubmit,
|
|
54
|
+
register,
|
|
55
|
+
formState: { errors },
|
|
56
|
+
reset,
|
|
57
|
+
} = useForm<FormValues>({ mode: "onChange" });
|
|
58
|
+
|
|
59
|
+
const onDownload = handleSubmit((values) => {
|
|
60
|
+
download.execute({ ...values, reportId, type: report?.type });
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const onViewOnline = handleSubmit(async (values) => {
|
|
64
|
+
const data = await generate.execute({
|
|
65
|
+
...values,
|
|
66
|
+
reportId,
|
|
67
|
+
});
|
|
68
|
+
if (!report || !data || generate.isError) return;
|
|
69
|
+
|
|
70
|
+
openOnlineViewer({
|
|
71
|
+
type: report.type,
|
|
72
|
+
dateFrom: values.dateFrom,
|
|
73
|
+
dateTo: values.dateTo,
|
|
74
|
+
data,
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const onClose = () => {
|
|
79
|
+
reset();
|
|
80
|
+
onHide();
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const isLoading =
|
|
84
|
+
generate.isLoading || download.isLoading || isLoadingReportFields;
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<Modal
|
|
88
|
+
show={show}
|
|
89
|
+
onHide={onClose}
|
|
90
|
+
className="report-runner-modal"
|
|
91
|
+
centered
|
|
92
|
+
>
|
|
93
|
+
<header>
|
|
94
|
+
<h5>{t("generateReport")}</h5>
|
|
95
|
+
<Button variant="" data-testid="cancel-button" onClick={onClose}>
|
|
96
|
+
{t("cancel")}
|
|
97
|
+
</Button>
|
|
98
|
+
</header>
|
|
99
|
+
|
|
100
|
+
{isLoading && <BlockLoader />}
|
|
101
|
+
|
|
102
|
+
{!isLoading && (
|
|
103
|
+
<div>
|
|
104
|
+
<div className="report-type-label">{capitalize(report?.type)}</div>
|
|
105
|
+
<div>{report?.name}</div>
|
|
106
|
+
<div className="data-fields">
|
|
107
|
+
{report?.reportFieldValues.map((fieldValue) => {
|
|
108
|
+
const field = reportFields?.find(
|
|
109
|
+
(field) => field.id === fieldValue.reportFieldId
|
|
110
|
+
);
|
|
111
|
+
if (!field) return null;
|
|
112
|
+
return <span key={fieldValue.id}>{field.title}</span>;
|
|
113
|
+
})}
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<Button
|
|
117
|
+
className="edit-button"
|
|
118
|
+
type="button"
|
|
119
|
+
variant=""
|
|
120
|
+
data-testid="edit-button"
|
|
121
|
+
onClick={onEdit}
|
|
122
|
+
>
|
|
123
|
+
{t("Design:edit")}
|
|
124
|
+
</Button>
|
|
125
|
+
|
|
126
|
+
<form noValidate>
|
|
127
|
+
<div className="controls">
|
|
128
|
+
<Form.Group controlId="from-input">
|
|
129
|
+
<Form.Label>{t("Design:from")}</Form.Label>
|
|
130
|
+
<Form.Control
|
|
131
|
+
type="datetime-local"
|
|
132
|
+
data-testid="date-from-input"
|
|
133
|
+
isInvalid={!!errors.dateFrom}
|
|
134
|
+
{...register("dateFrom", {
|
|
135
|
+
required: {
|
|
136
|
+
value: true,
|
|
137
|
+
message: `${t("Validation:fieldRequired", {
|
|
138
|
+
attribute: t("Design:to"),
|
|
139
|
+
})}`,
|
|
140
|
+
},
|
|
141
|
+
})}
|
|
142
|
+
/>
|
|
143
|
+
<Form.Control.Feedback type="invalid">
|
|
144
|
+
{errors.dateFrom?.message}
|
|
145
|
+
</Form.Control.Feedback>
|
|
146
|
+
</Form.Group>
|
|
147
|
+
|
|
148
|
+
<Form.Group controlId="to-input">
|
|
149
|
+
<Form.Label>{t("Design:to")}</Form.Label>
|
|
150
|
+
<Form.Control
|
|
151
|
+
type="datetime-local"
|
|
152
|
+
data-testid="date-to-input"
|
|
153
|
+
isInvalid={!!errors.dateTo}
|
|
154
|
+
{...register("dateTo", {
|
|
155
|
+
required: {
|
|
156
|
+
value: true,
|
|
157
|
+
message: `${t("Validation:fieldRequired", {
|
|
158
|
+
attribute: t("Design:to"),
|
|
159
|
+
})}`,
|
|
160
|
+
},
|
|
161
|
+
})}
|
|
162
|
+
/>
|
|
163
|
+
<Form.Control.Feedback type="invalid">
|
|
164
|
+
{errors.dateTo?.message}
|
|
165
|
+
</Form.Control.Feedback>
|
|
166
|
+
</Form.Group>
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
<div className="controls">
|
|
170
|
+
<Button data-testid="download-button" onClick={onDownload}>
|
|
171
|
+
{t("generateDownload")}
|
|
172
|
+
</Button>
|
|
173
|
+
|
|
174
|
+
<Button data-testid="view-button" onClick={onViewOnline}>
|
|
175
|
+
{t("generateView")}
|
|
176
|
+
</Button>
|
|
177
|
+
</div>
|
|
178
|
+
</form>
|
|
179
|
+
</div>
|
|
180
|
+
)}
|
|
181
|
+
</Modal>
|
|
182
|
+
);
|
|
183
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ReportRunnerModal";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { reportTypes } from "@licklist/core/dist/DataMapper/Report";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Row, Col, Form, OverlayTrigger, Popover } from "react-bootstrap";
|
|
4
|
+
import { useFormContext } from "react-hook-form";
|
|
5
|
+
import { useTranslation } from "react-i18next";
|
|
6
|
+
import { ReactComponent as InfoIcon } from "../../assets/dashboard/info.svg";
|
|
7
|
+
|
|
8
|
+
export const ReportTypeSelect = () => {
|
|
9
|
+
const { t } = useTranslation(["App", "Design"]);
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
register,
|
|
13
|
+
formState: { errors },
|
|
14
|
+
setValue,
|
|
15
|
+
} = useFormContext();
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Row>
|
|
19
|
+
<Col lg={6} className="mt-4">
|
|
20
|
+
<Form.Group controlId="typeSelect">
|
|
21
|
+
<Form.Label>{t("reportType")}</Form.Label>
|
|
22
|
+
|
|
23
|
+
<Form.Control
|
|
24
|
+
as="select"
|
|
25
|
+
data-testid="report-type-select"
|
|
26
|
+
isInvalid={!!errors.type}
|
|
27
|
+
{...register("type", {
|
|
28
|
+
required: {
|
|
29
|
+
value: true,
|
|
30
|
+
message: `${t("Validation:fieldRequired", {
|
|
31
|
+
attribute: t("reportType"),
|
|
32
|
+
})}`,
|
|
33
|
+
},
|
|
34
|
+
})}
|
|
35
|
+
onChange={(event) => {
|
|
36
|
+
register("type").onChange(event);
|
|
37
|
+
setValue("reportFieldValues", []);
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
{reportTypes.map((reportType) => (
|
|
41
|
+
<option key={reportType} value={reportType}>
|
|
42
|
+
{reportType}
|
|
43
|
+
</option>
|
|
44
|
+
))}
|
|
45
|
+
</Form.Control>
|
|
46
|
+
|
|
47
|
+
<Form.Control.Feedback type="invalid">
|
|
48
|
+
{errors.type?.message}
|
|
49
|
+
</Form.Control.Feedback>
|
|
50
|
+
|
|
51
|
+
<OverlayTrigger
|
|
52
|
+
trigger="hover"
|
|
53
|
+
overlay={
|
|
54
|
+
<Popover id="report-type-popover">
|
|
55
|
+
<Popover.Content className="reports-popover">
|
|
56
|
+
{t("reportTypeSelectInfo")}
|
|
57
|
+
</Popover.Content>
|
|
58
|
+
</Popover>
|
|
59
|
+
}
|
|
60
|
+
>
|
|
61
|
+
<InfoIcon className="info-icon" />
|
|
62
|
+
</OverlayTrigger>
|
|
63
|
+
</Form.Group>
|
|
64
|
+
</Col>
|
|
65
|
+
</Row>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ReportTypeSelect";
|
package/src/report/index.ts
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useRef, useState } from "react";
|
|
2
|
+
import { Meta, Story } from "@storybook/react";
|
|
3
|
+
import { NumberInputHorizontal } from "./NumberInputHorizontal";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Manual Booking/NumberInputHorizontal",
|
|
7
|
+
} as Meta;
|
|
8
|
+
|
|
9
|
+
export const Default: Story<any> = (args) => {
|
|
10
|
+
const ref = useRef(null);
|
|
11
|
+
const [value, setValue] = useState(0);
|
|
12
|
+
const [isDisabled, setDisabled] = useState(true);
|
|
13
|
+
|
|
14
|
+
const onPriceClick = (e) => {
|
|
15
|
+
if (!isDisabled) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
console.log("click");
|
|
19
|
+
setDisabled(false);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div
|
|
24
|
+
role="button"
|
|
25
|
+
tabIndex={0}
|
|
26
|
+
onClick={onPriceClick}
|
|
27
|
+
onKeyDown={onPriceClick}
|
|
28
|
+
style={{ height: "250px", width: "370px" }}
|
|
29
|
+
>
|
|
30
|
+
<NumberInputHorizontal
|
|
31
|
+
ref={ref}
|
|
32
|
+
hasCurrency
|
|
33
|
+
onSelect={onPriceClick}
|
|
34
|
+
onChange={(val) => {
|
|
35
|
+
setValue(val);
|
|
36
|
+
}}
|
|
37
|
+
onMinusClick={() => {
|
|
38
|
+
setValue(value - 1 || 0);
|
|
39
|
+
}}
|
|
40
|
+
onPlusClick={() => {
|
|
41
|
+
setValue((value ?? 0) + 1);
|
|
42
|
+
}}
|
|
43
|
+
value={value}
|
|
44
|
+
disabled={isDisabled}
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import clsx from "clsx";
|
|
2
|
-
import React, { forwardRef } from "react";
|
|
2
|
+
import React, { SyntheticEvent, forwardRef } from "react";
|
|
3
3
|
import { FormControl } from "react-bootstrap";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
5
|
import { Icon } from "../../../static";
|
|
@@ -13,6 +13,8 @@ interface NumberInputHorizontalProps {
|
|
|
13
13
|
onChange: (value: number) => void;
|
|
14
14
|
onPlusClick: (value: number) => void;
|
|
15
15
|
onMinusClick: (value: number) => void;
|
|
16
|
+
onSelect?: (e: SyntheticEvent) => void;
|
|
17
|
+
step?: number;
|
|
16
18
|
min?: number;
|
|
17
19
|
max?: number;
|
|
18
20
|
size?: Sizes;
|
|
@@ -30,11 +32,13 @@ export const NumberInputHorizontal = forwardRef<
|
|
|
30
32
|
disabled = false,
|
|
31
33
|
className = "",
|
|
32
34
|
value,
|
|
35
|
+
step,
|
|
33
36
|
size = "small",
|
|
34
37
|
hasCurrency,
|
|
35
38
|
onChange,
|
|
36
39
|
onPlusClick,
|
|
37
40
|
onMinusClick,
|
|
41
|
+
onSelect,
|
|
38
42
|
min,
|
|
39
43
|
max,
|
|
40
44
|
defaultValue,
|
|
@@ -54,7 +58,12 @@ export const NumberInputHorizontal = forwardRef<
|
|
|
54
58
|
}
|
|
55
59
|
};
|
|
56
60
|
|
|
57
|
-
const onClick = (e) =>
|
|
61
|
+
const onClick = (e) => {
|
|
62
|
+
if (onSelect) {
|
|
63
|
+
onSelect(e);
|
|
64
|
+
}
|
|
65
|
+
e.target.select();
|
|
66
|
+
};
|
|
58
67
|
|
|
59
68
|
const handleArrowDownClick = () => {
|
|
60
69
|
if (min !== undefined && value > min) {
|
|
@@ -98,13 +107,17 @@ export const NumberInputHorizontal = forwardRef<
|
|
|
98
107
|
ref={ref}
|
|
99
108
|
onClick={onClick}
|
|
100
109
|
type={disabled && hasBigSize ? "text" : "number"}
|
|
101
|
-
className={
|
|
110
|
+
className={clsx(
|
|
111
|
+
hasBigSize ? "big-sizes-input" : "small-sizes-input",
|
|
112
|
+
disabled && "border-0"
|
|
113
|
+
)}
|
|
102
114
|
onChange={(e) => onChange(Number(e.target.value))}
|
|
103
115
|
value={disabled && hasBigSize && !isLoading ? soldOut : value}
|
|
104
116
|
min={min}
|
|
105
117
|
max={max}
|
|
118
|
+
step={step}
|
|
106
119
|
defaultValue={defaultValue}
|
|
107
|
-
disabled={disabled}
|
|
120
|
+
disabled={disabled && !onSelect}
|
|
108
121
|
/>
|
|
109
122
|
</div>
|
|
110
123
|
<button
|
|
@@ -131,6 +131,12 @@
|
|
|
131
131
|
font-weight: 500;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
.categories {
|
|
135
|
+
&:not(:last-child) {
|
|
136
|
+
border-bottom: 2px solid $separator-color;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
134
140
|
.products {
|
|
135
141
|
margin-top: 0.5rem;
|
|
136
142
|
|
|
@@ -144,10 +150,6 @@
|
|
|
144
150
|
margin-bottom: 0.5rem;
|
|
145
151
|
}
|
|
146
152
|
}
|
|
147
|
-
|
|
148
|
-
&:not(:last-child) {
|
|
149
|
-
border-bottom: 2px solid $separator-color;
|
|
150
|
-
}
|
|
151
153
|
}
|
|
152
154
|
|
|
153
155
|
&:not(:last-child) {
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
.report-builder {
|
|
2
|
+
.modal-dialog {
|
|
3
|
+
@include media-breakpoint-up(sm) {
|
|
4
|
+
max-width: 45rem;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.modal-content {
|
|
9
|
+
max-width: 45rem;
|
|
10
|
+
margin: 0 auto;
|
|
11
|
+
padding: 1.25rem 1.5rem;
|
|
12
|
+
|
|
13
|
+
header {
|
|
14
|
+
display: flex;
|
|
15
|
+
justify-content: space-between;
|
|
16
|
+
align-items: center;
|
|
17
|
+
margin-bottom: 1rem;
|
|
18
|
+
border-bottom: 2px solid #dcdcdc;
|
|
19
|
+
|
|
20
|
+
h5 {
|
|
21
|
+
margin-bottom: 0;
|
|
22
|
+
font-size: 1.125rem;
|
|
23
|
+
font-weight: 500;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
button {
|
|
27
|
+
padding-top: 0.5rem;
|
|
28
|
+
padding-bottom: 0.5rem;
|
|
29
|
+
font-size: 0.875rem;
|
|
30
|
+
font-weight: 600;
|
|
31
|
+
color: #0e8ce2;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.data-fields {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-wrap: wrap;
|
|
38
|
+
|
|
39
|
+
span {
|
|
40
|
+
position: relative;
|
|
41
|
+
font-size: 0.875rem;
|
|
42
|
+
font-weight: 500;
|
|
43
|
+
|
|
44
|
+
&:after {
|
|
45
|
+
content: "|";
|
|
46
|
+
margin: 0 0.25rem;
|
|
47
|
+
color: #dcdcdc;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&:last-child:after {
|
|
51
|
+
display: none;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.edit-button {
|
|
57
|
+
padding: 0;
|
|
58
|
+
font-size: 0.875rem;
|
|
59
|
+
font-weight: 600;
|
|
60
|
+
color: #0e8ce2;
|
|
61
|
+
text-decoration: underline;
|
|
62
|
+
|
|
63
|
+
&:focus {
|
|
64
|
+
box-shadow: none;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
input {
|
|
69
|
+
border-radius: 0.5rem;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
form {
|
|
73
|
+
margin-top: 1.25rem;
|
|
74
|
+
|
|
75
|
+
.controls {
|
|
76
|
+
display: flex;
|
|
77
|
+
gap: 2rem;
|
|
78
|
+
align-items: flex-start;
|
|
79
|
+
flex-wrap: wrap;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.form-group {
|
|
83
|
+
flex: 1;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
button[type="submit"] {
|
|
87
|
+
white-space: nowrap;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.loader {
|
|
92
|
+
height: 10rem;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
button[type="submit"] {
|
|
96
|
+
margin-top: 1.5rem;
|
|
97
|
+
}
|
|
98
|
+
}
|