@selfcommunity/react-ui 0.11.0-mui7.24 → 0.11.0-mui7.27
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/lib/cjs/components/Composer/Layer/ScheduledLayer/ScheduledLayer.js +1 -1
- package/lib/cjs/components/EventForm/EventAddress.js +3 -3
- package/lib/cjs/components/EventForm/EventForm.js +75 -56
- package/lib/cjs/components/EventLocationWidget/EventLocationWidget.js +4 -9
- package/lib/cjs/components/EventLocationWidget/EventMap.d.ts +8 -0
- package/lib/cjs/components/EventLocationWidget/EventMap.js +22 -0
- package/lib/cjs/components/LessonReleaseMenu/LessonReleaseMenu.js +13 -14
- package/lib/cjs/components/LocationAutocomplete/LocationAutocomplete.js +10 -9
- package/lib/cjs/components/PaymentOrders/PaymentOrders.js +27 -25
- package/lib/cjs/components/UserProfileEdit/Section/PublicInfo.js +5 -15
- package/lib/cjs/shared/Media/File/DocComponent.d.ts +2 -0
- package/lib/cjs/shared/Media/File/DocComponent.js +3 -2
- package/lib/cjs/shared/Media/File/PreviewComponent.js +4 -3
- package/lib/esm/components/Composer/Layer/ScheduledLayer/ScheduledLayer.js +1 -1
- package/lib/esm/components/EventForm/EventAddress.js +3 -3
- package/lib/esm/components/EventForm/EventForm.js +76 -57
- package/lib/esm/components/EventLocationWidget/EventLocationWidget.js +5 -10
- package/lib/esm/components/EventLocationWidget/EventMap.d.ts +8 -0
- package/lib/esm/components/EventLocationWidget/EventMap.js +19 -0
- package/lib/esm/components/LessonReleaseMenu/LessonReleaseMenu.js +13 -14
- package/lib/esm/components/LocationAutocomplete/LocationAutocomplete.js +2 -1
- package/lib/esm/components/PaymentOrders/PaymentOrders.js +27 -25
- package/lib/esm/components/UserProfileEdit/Section/PublicInfo.js +8 -18
- package/lib/esm/shared/Media/File/DocComponent.d.ts +2 -0
- package/lib/esm/shared/Media/File/DocComponent.js +3 -2
- package/lib/esm/shared/Media/File/PreviewComponent.js +4 -3
- package/lib/umd/484.js +1 -1
- package/lib/umd/484.js.LICENSE.txt +1 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +11 -11
- package/lib/cjs/shared/UpScalingTierBadge/UpScalingTierBadge.d.ts +0 -5
- package/lib/cjs/shared/UpScalingTierBadge/UpScalingTierBadge.js +0 -14
- package/lib/esm/shared/UpScalingTierBadge/UpScalingTierBadge.d.ts +0 -5
- package/lib/esm/shared/UpScalingTierBadge/UpScalingTierBadge.js +0 -10
|
@@ -7,6 +7,7 @@ const constants_1 = require("./constants");
|
|
|
7
7
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
8
8
|
const types_1 = require("@selfcommunity/types");
|
|
9
9
|
const react_1 = require("react");
|
|
10
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
10
11
|
const txt_1 = tslib_1.__importDefault(require("../../../assets/composer/txt"));
|
|
11
12
|
const pdf_1 = tslib_1.__importDefault(require("../../../assets/composer/pdf"));
|
|
12
13
|
const doc_1 = tslib_1.__importDefault(require("../../../assets/composer/doc"));
|
|
@@ -36,7 +37,7 @@ function formatBytes(bytes, decimals = 2) {
|
|
|
36
37
|
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
37
38
|
}
|
|
38
39
|
function DocComponent(props) {
|
|
39
|
-
const { document, index, onDelete, handleDownload, onMediaClick } = props;
|
|
40
|
+
const { document, index, onDelete, handleDownload, onMediaClick, className } = props;
|
|
40
41
|
const getImage = (0, react_1.useCallback)(() => {
|
|
41
42
|
switch (document.mimetype) {
|
|
42
43
|
case types_1.SCMimeTypes.PLAIN_TEXT:
|
|
@@ -71,6 +72,6 @@ function DocComponent(props) {
|
|
|
71
72
|
return fallback_1.default;
|
|
72
73
|
}
|
|
73
74
|
}, [document.mimetype]);
|
|
74
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.docRoot }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { component: "img", alt: document.title, src: getImage() }), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.textWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.title }, { children: document.title })), document.size && (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.subtitle }, { children: formatBytes(document.size) }))] })), (handleDownload || onDelete) && ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.actionWrapper }, { children: [onDelete && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, onClick: () => onDelete(document.id) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "delete" }) }))), handleDownload && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [document.mimetype === types_1.SCMimeTypes.PDF && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, component: react_core_1.Link, to: document.url, target: "_blank", onClick: () => onMediaClick === null || onMediaClick === void 0 ? void 0 : onMediaClick(document) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility" }) }))), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, onClick: () => handleDownload(index) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "download" }) }))] }))] })))] })));
|
|
75
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.docRoot, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { component: "img", alt: document.title, src: getImage() }), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.textWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.title }, { children: document.title })), document.size && (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.subtitle }, { children: formatBytes(document.size) }))] })), (handleDownload || onDelete) && ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.actionWrapper }, { children: [onDelete && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, onClick: () => onDelete(document.id) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "delete" }) }))), handleDownload && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [document.mimetype === types_1.SCMimeTypes.PDF && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, component: react_core_1.Link, to: document.url, target: "_blank", onClick: () => onMediaClick === null || onMediaClick === void 0 ? void 0 : onMediaClick(document) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility" }) }))), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, onClick: () => handleDownload(index) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "download" }) }))] }))] })))] })));
|
|
75
76
|
}
|
|
76
77
|
exports.default = DocComponent;
|
|
@@ -14,7 +14,8 @@ const classes = {
|
|
|
14
14
|
media: `${constants_1.PREFIX}-media`,
|
|
15
15
|
delete: `${constants_1.PREFIX}-delete`,
|
|
16
16
|
title: `${constants_1.PREFIX}-title`,
|
|
17
|
-
docsWrapper: `${constants_1.PREFIX}-docs-wrapper
|
|
17
|
+
docsWrapper: `${constants_1.PREFIX}-docs-wrapper`,
|
|
18
|
+
doc: `${constants_1.PREFIX}-doc`
|
|
18
19
|
};
|
|
19
20
|
const Root = (0, material_1.styled)(material_1.Box, {
|
|
20
21
|
name: constants_1.PREFIX,
|
|
@@ -43,7 +44,7 @@ const PreviewComponent = (0, react_1.forwardRef)((props, ref) => {
|
|
|
43
44
|
const handleDelete = (0, react_1.useCallback)((id) => onChange && onChange(value.filter((media) => media.id !== id)), [onChange, value]);
|
|
44
45
|
// RENDER
|
|
45
46
|
const imageElements = (0, react_1.useMemo)(() => images.map((media) => ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.media, sx: { backgroundImage: `url(${(media === null || media === void 0 ? void 0 : media.image_thumbnail) ? media.image_thumbnail.url : media.image})` } }, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.delete, onClick: () => handleDelete(media.id), size: "small" }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "delete" }) })), media.title && (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.title }, { children: media.title }))] }), media.id))), [images]);
|
|
46
|
-
const docElements = (0, react_1.useMemo)(() => docs.map((doc) => (0, jsx_runtime_1.jsx)(DocComponent_1.default, { document: doc, onDelete: handleDelete }, doc.id)), [docs]);
|
|
47
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ ref: ref, className: (0, classnames_1.default)(
|
|
47
|
+
const docElements = (0, react_1.useMemo)(() => docs.map((doc) => (0, jsx_runtime_1.jsx)(DocComponent_1.default, { document: doc, onDelete: handleDelete, className: classes.doc }, doc.id)), [docs]);
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ ref: ref, className: (0, classnames_1.default)(classes.previewRoot, className) }, rest, { children: mediasLength > 0 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_sortablejs_1.ReactSortable, Object.assign({ list: images, setList: handleSort, scroll: true, animation: 200, scrollSensitivity: 50 }, { children: imageElements })), (0, jsx_runtime_1.jsx)(react_sortablejs_1.ReactSortable, Object.assign({ list: docs, setList: handleSort, animation: 200, direction: "vertical", className: classes.docsWrapper }, { children: docElements }))] })) })));
|
|
48
49
|
});
|
|
49
50
|
exports.default = PreviewComponent;
|
|
@@ -46,7 +46,7 @@ const ScheduledLayer = React.forwardRef((props, ref) => {
|
|
|
46
46
|
const restOfDate = format(value, 'd MMMM yyyy • HH:mm', { locale });
|
|
47
47
|
return _jsx(Typography, Object.assign({ variant: "h4" }, { children: `${dayName} ${restOfDate}` }));
|
|
48
48
|
};
|
|
49
|
-
return (_jsxs(Root, Object.assign({ ref: ref, className: classNames(className, classes.root) }, rest, { children: [_jsxs(DialogTitle, Object.assign({ className: classes.title }, { children: [_jsx(IconButton, Object.assign({ onClick: onClose }, { children: _jsx(Icon, { children: "arrow_back" }) })), _jsx(Typography, { children: _jsx(FormattedMessage, { id: "ui.composer.layer.scheduled.title", defaultMessage: "Programma la Pubblicazione" }) }), _jsx(Button, Object.assign({ size: "small", color: "secondary", variant: "contained", onClick: () => onSave(scheduledAt), disabled: !scheduledAt }, { children: _jsx(FormattedMessage, { id: "ui.composer.layer.scheduled.submit", defaultMessage: "Attiva Programmazione" }) }))] })), _jsxs(DialogContent, Object.assign({ className: classes.content }, { children: [_jsx(Typography, Object.assign({ className: classes.message }, { children: _jsx(FormattedMessage, { id: "ui.composer.layer.scheduled.message", defaultMessage: "ui.composer.audience.scheduled.message" }) })), _jsx(LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns, adapterLocale: locale }, { children: _jsx(StaticDateTimePicker, { className: classes.picker, disablePast: true, value: scheduledAt, onChange:
|
|
49
|
+
return (_jsxs(Root, Object.assign({ ref: ref, className: classNames(className, classes.root) }, rest, { children: [_jsxs(DialogTitle, Object.assign({ className: classes.title }, { children: [_jsx(IconButton, Object.assign({ onClick: onClose }, { children: _jsx(Icon, { children: "arrow_back" }) })), _jsx(Typography, { children: _jsx(FormattedMessage, { id: "ui.composer.layer.scheduled.title", defaultMessage: "Programma la Pubblicazione" }) }), _jsx(Button, Object.assign({ size: "small", color: "secondary", variant: "contained", onClick: () => onSave(scheduledAt), disabled: !scheduledAt }, { children: _jsx(FormattedMessage, { id: "ui.composer.layer.scheduled.submit", defaultMessage: "Attiva Programmazione" }) }))] })), _jsxs(DialogContent, Object.assign({ className: classes.content }, { children: [_jsx(Typography, Object.assign({ className: classes.message }, { children: _jsx(FormattedMessage, { id: "ui.composer.layer.scheduled.message", defaultMessage: "ui.composer.audience.scheduled.message" }) })), _jsx(LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns, adapterLocale: locale }, { children: _jsx(StaticDateTimePicker, { className: classes.picker, disablePast: true, value: scheduledAt, onChange: setScheduledAt, onAccept: handleUpdate, slots: {
|
|
50
50
|
toolbar: CustomToolbar,
|
|
51
51
|
tabs: (props) => _jsx(DateTimePickerTabs, Object.assign({}, props)),
|
|
52
52
|
actionBar: () => null
|
|
@@ -84,7 +84,7 @@ export default function EventAddress(inProps) {
|
|
|
84
84
|
(event.live_stream && event.live_stream.created_at);
|
|
85
85
|
}, [liveStreamEnabled, (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission, event]);
|
|
86
86
|
// HOOKS
|
|
87
|
-
const { isLoaded, geocodingApiKey } = useSCGoogleApiLoader();
|
|
87
|
+
const { isLoaded, geocodingApiKey, placesLibrary } = useSCGoogleApiLoader();
|
|
88
88
|
// HANDLERS
|
|
89
89
|
const handleChange = (_event, newValue) => {
|
|
90
90
|
setLocation(newValue);
|
|
@@ -132,9 +132,9 @@ export default function EventAddress(inProps) {
|
|
|
132
132
|
}
|
|
133
133
|
if (inputValue.length >= 3) {
|
|
134
134
|
const newTimeoutId = setTimeout(() => {
|
|
135
|
-
const autocompleteService = new
|
|
135
|
+
const autocompleteService = new placesLibrary.AutocompleteService(); // TODO - deprecated, to fix when possibile
|
|
136
136
|
autocompleteService.getPlacePredictions({ input: inputValue }, (predictions, status) => {
|
|
137
|
-
if (status ===
|
|
137
|
+
if (status === placesLibrary.PlacesServiceStatus.OK && predictions) {
|
|
138
138
|
setSuggestions(predictions.map((prediction) => ({
|
|
139
139
|
description: prediction.description,
|
|
140
140
|
id: prediction.place_id
|
|
@@ -5,7 +5,7 @@ import { useThemeProps } from '@mui/system';
|
|
|
5
5
|
import { LocalizationProvider, MobileDatePicker, MobileTimePicker } from '@mui/x-date-pickers';
|
|
6
6
|
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
7
7
|
import { EventService, formatHttpErrorCode } from '@selfcommunity/api-services';
|
|
8
|
-
import { SCPreferences, UserUtils, useSCContext, useSCPaymentsEnabled, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
8
|
+
import { SCPreferences, UserUtils, useSCContext, useSCGoogleApiLoader, useSCPaymentsEnabled, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
9
9
|
import { SCContentType, SCEventLocationType, SCEventPrivacyType, SCEventRecurrenceType, SCFeatureName } from '@selfcommunity/types';
|
|
10
10
|
import { Logger } from '@selfcommunity/utils';
|
|
11
11
|
import classNames from 'classnames';
|
|
@@ -25,7 +25,16 @@ import { LIVESTREAM_DEFAULT_SETTINGS } from '../LiveStreamForm/constants';
|
|
|
25
25
|
import CoverPlaceholder from '../../assets/deafultCover';
|
|
26
26
|
import PaywallsConfigurator from '../PaywallsConfigurator';
|
|
27
27
|
import { ContentAccessType } from '../PaywallsConfigurator/constants';
|
|
28
|
+
import { APIProvider } from '@vis.gl/react-google-maps';
|
|
28
29
|
const messages = defineMessages({
|
|
30
|
+
titleDate: {
|
|
31
|
+
id: 'ui.eventForm.date.title',
|
|
32
|
+
defaultMessage: 'ui.eventForm.date.title'
|
|
33
|
+
},
|
|
34
|
+
titleTime: {
|
|
35
|
+
id: 'ui.eventForm.time.title',
|
|
36
|
+
defaultMessage: 'ui.eventForm.time.title'
|
|
37
|
+
},
|
|
29
38
|
name: {
|
|
30
39
|
id: 'ui.eventForm.name.placeholder',
|
|
31
40
|
defaultMessage: 'ui.eventForm.name.placeholder'
|
|
@@ -170,6 +179,8 @@ export default function EventForm(inProps) {
|
|
|
170
179
|
const [field, setField] = useState(initialFieldState);
|
|
171
180
|
const [error, setError] = useState({});
|
|
172
181
|
const [genericError, setGenericError] = useState(null);
|
|
182
|
+
// HOOKS
|
|
183
|
+
const { geocodingApiKey, libraries } = useSCGoogleApiLoader();
|
|
173
184
|
// PREFERENCES
|
|
174
185
|
const scPreferences = useSCPreferences();
|
|
175
186
|
const liveStreamEnabled = useMemo(() => scPreferences.preferences &&
|
|
@@ -374,89 +385,97 @@ export default function EventForm(inProps) {
|
|
|
374
385
|
endAdornment: _jsx(Typography, Object.assign({ variant: "body2" }, { children: EVENT_TITLE_MAX_LENGTH - field.name.length }))
|
|
375
386
|
}
|
|
376
387
|
}, error: Boolean(field.name.length > EVENT_TITLE_MAX_LENGTH) || Boolean(error['nameError']), helperText: field.name.length > EVENT_TITLE_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.eventForm.name.error.maxLength", defaultMessage: "ui.eventForm.name.error.maxLength" })) : error['nameError'] ? (error['nameError']) : null }), _jsx(Box, Object.assign({ className: classes.dateTime }, { children: _jsxs(LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? it : enUS, localeText: {
|
|
377
|
-
cancelButtonLabel:
|
|
378
|
-
} }, { children: [_jsx(MobileDatePicker, { className: classes.picker, disablePast: !event, minDate: minStartDate, label: field.startDate && _jsx(FormattedMessage, { id: "ui.eventForm.date.placeholder", defaultMessage: "ui.eventForm.date.placeholder" }), value: field.startDate, enableAccessibleFieldDOMStructure: false,
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
input: Object.assign(Object.assign({}, (_a = params.slotProps) === null || _a === void 0 ? void 0 : _a.input), { placeholder: `${intl.formatMessage(messages.startDate)}`, startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "CalendarIcon" }) }) }))) })
|
|
383
|
-
} })));
|
|
384
|
-
}
|
|
388
|
+
cancelButtonLabel: intl.formatMessage(messages.pickerCancelAction)
|
|
389
|
+
} }, { children: [_jsx(MobileDatePicker, { className: classes.picker, disablePast: !event, minDate: minStartDate, label: field.startDate && _jsx(FormattedMessage, { id: "ui.eventForm.date.placeholder", defaultMessage: "ui.eventForm.date.placeholder" }), value: field.startDate, enableAccessibleFieldDOMStructure: false, localeText: {
|
|
390
|
+
toolbarTitle: intl.formatMessage(messages.titleDate)
|
|
391
|
+
}, slots: {
|
|
392
|
+
openPickerButton: (params) => (_jsx(IconButton, Object.assign({}, params, { sx: { marginLeft: 0 } }, { children: _jsx(Icon, { children: "CalendarIcon" }) })))
|
|
385
393
|
}, slotProps: {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
394
|
+
field: {
|
|
395
|
+
openPickerButtonPosition: 'start'
|
|
396
|
+
},
|
|
397
|
+
textField: {
|
|
398
|
+
slotProps: {
|
|
399
|
+
input: {
|
|
400
|
+
placeholder: intl.formatMessage(messages.startDate)
|
|
401
|
+
}
|
|
402
|
+
}
|
|
390
403
|
}
|
|
391
404
|
}, onChange: (value) => {
|
|
392
405
|
handleChangeDateTime(value, 'startDate');
|
|
393
406
|
handleChangeDateTime(value, 'startTime');
|
|
394
|
-
} }), _jsx(MobileTimePicker, { className: classes.picker, disablePast: disablePastStartTime, minTime: minStartTime, label: field.startTime && _jsx(FormattedMessage, { id: "ui.eventForm.time.placeholder", defaultMessage: "ui.eventForm.time.placeholder" }), value: field.startTime, enableAccessibleFieldDOMStructure: false,
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
input: Object.assign(Object.assign({}, (_a = params.slotProps) === null || _a === void 0 ? void 0 : _a.input), { placeholder: `${intl.formatMessage(messages.startTime)}`, startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "access_time" }) }) }))) })
|
|
399
|
-
} })));
|
|
400
|
-
}
|
|
407
|
+
} }), _jsx(MobileTimePicker, { className: classes.picker, disablePast: disablePastStartTime, minTime: minStartTime, label: field.startTime && _jsx(FormattedMessage, { id: "ui.eventForm.time.placeholder", defaultMessage: "ui.eventForm.time.placeholder" }), value: field.startTime, enableAccessibleFieldDOMStructure: false, localeText: {
|
|
408
|
+
toolbarTitle: intl.formatMessage(messages.titleTime)
|
|
409
|
+
}, slots: {
|
|
410
|
+
openPickerButton: (params) => (_jsx(IconButton, Object.assign({}, params, { sx: { marginLeft: 0 } }, { children: _jsx(Icon, { children: "access_time" }) })))
|
|
401
411
|
}, slotProps: {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
412
|
+
field: {
|
|
413
|
+
openPickerButtonPosition: 'start'
|
|
414
|
+
},
|
|
415
|
+
textField: {
|
|
416
|
+
slotProps: {
|
|
417
|
+
input: {
|
|
418
|
+
placeholder: intl.formatMessage(messages.startTime)
|
|
419
|
+
}
|
|
420
|
+
}
|
|
406
421
|
}
|
|
407
422
|
}, onChange: (value) => {
|
|
408
423
|
handleChangeDateTime(value, 'startDate');
|
|
409
424
|
handleChangeDateTime(value, 'startTime');
|
|
410
|
-
} })] })) })), _jsxs(FormControl, Object.assign({ className: classes.frequency }, { children: [field.recurring !== SCEventRecurrenceType.NEVER && _jsx(InputLabel, Object.assign({ id: "recurring" }, { children:
|
|
425
|
+
} })] })) })), _jsxs(FormControl, Object.assign({ className: classes.frequency }, { children: [field.recurring !== SCEventRecurrenceType.NEVER && _jsx(InputLabel, Object.assign({ id: "recurring" }, { children: intl.formatMessage(messages.frequency) })), _jsx(Select, Object.assign({ name: "recurring", label: field.recurring !== SCEventRecurrenceType.NEVER && intl.formatMessage(messages.frequency), labelId: "recurring", value: field.recurring, onChange: handleChange, displayEmpty: true, renderValue: (selected) => {
|
|
411
426
|
if (!selected) {
|
|
412
|
-
return _jsx("em", { children:
|
|
427
|
+
return _jsx("em", { children: intl.formatMessage(messages.frequencyPlaceholder) });
|
|
413
428
|
}
|
|
414
429
|
return (_jsx(FormattedMessage, { id: `ui.eventForm.frequency.${selected}.placeholder`, defaultMessage: `ui.eventForm.frequency.${selected}.placeholder` }));
|
|
415
430
|
}, startAdornment: _jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "frequency" }) }) })) }, { children: Object.values(SCEventRecurrenceType).map((f) => (_jsx(MenuItem, Object.assign({ value: f }, { children: _jsx(FormattedMessage, { id: `ui.eventForm.frequency.${f}.placeholder`, defaultMessage: `ui.eventForm.frequency.${f}.placeholder` }) }), f))) }))] })), _jsx(Box, Object.assign({ className: classes.dateTime }, { children: _jsxs(LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? it : enUS, localeText: {
|
|
416
|
-
cancelButtonLabel:
|
|
417
|
-
} }, { children: [_jsx(MobileDatePicker, { className: classes.picker, minDate: field.startDate, label: _jsx(FormattedMessage, { id: "ui.eventForm.date.end.placeholder", defaultMessage: "ui.eventForm.date.end.placeholder" }), value: field.endDate, enableAccessibleFieldDOMStructure: false,
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
input: Object.assign(Object.assign({}, (_a = params.slotProps) === null || _a === void 0 ? void 0 : _a.input), { placeholder: `${intl.formatMessage(messages.endDate)}`, startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "calendar_off" }) }) }))) })
|
|
422
|
-
} })));
|
|
423
|
-
}
|
|
431
|
+
cancelButtonLabel: intl.formatMessage(messages.pickerCancelAction)
|
|
432
|
+
} }, { children: [_jsx(MobileDatePicker, { className: classes.picker, minDate: field.startDate, label: _jsx(FormattedMessage, { id: "ui.eventForm.date.end.placeholder", defaultMessage: "ui.eventForm.date.end.placeholder" }), value: field.endDate, enableAccessibleFieldDOMStructure: false, localeText: {
|
|
433
|
+
toolbarTitle: intl.formatMessage(messages.titleDate)
|
|
434
|
+
}, slots: {
|
|
435
|
+
openPickerButton: (params) => (_jsx(IconButton, Object.assign({}, params, { sx: { marginLeft: 0 } }, { children: _jsx(Icon, { children: "calendar_off" }) })))
|
|
424
436
|
}, slotProps: {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
437
|
+
field: {
|
|
438
|
+
openPickerButtonPosition: 'start'
|
|
439
|
+
},
|
|
440
|
+
textField: {
|
|
441
|
+
slotProps: {
|
|
442
|
+
input: {
|
|
443
|
+
placeholder: intl.formatMessage(messages.endDate)
|
|
444
|
+
}
|
|
445
|
+
}
|
|
429
446
|
}
|
|
430
447
|
}, onChange: (value) => {
|
|
431
448
|
handleChangeDateTime(value, 'endDate');
|
|
432
449
|
handleChangeDateTime(value, 'endTime');
|
|
433
|
-
}, shouldDisableDate: shouldDisableDate }), _jsx(MobileTimePicker, { className: classes.picker, disablePast: disablePastEndTime, label: field.endTime && _jsx(FormattedMessage, { id: "ui.eventForm.time.end.placeholder", defaultMessage: "ui.eventForm.time.end.placeholder" }), value: field.endTime, enableAccessibleFieldDOMStructure: false,
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
input: Object.assign(Object.assign({}, (_a = params.slotProps) === null || _a === void 0 ? void 0 : _a.input), { placeholder: `${intl.formatMessage(messages.endTime)}`, startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "access_time" }) }) }))) })
|
|
438
|
-
} })));
|
|
439
|
-
}
|
|
450
|
+
}, shouldDisableDate: shouldDisableDate }), _jsx(MobileTimePicker, { className: classes.picker, disablePast: disablePastEndTime, label: field.endTime && _jsx(FormattedMessage, { id: "ui.eventForm.time.end.placeholder", defaultMessage: "ui.eventForm.time.end.placeholder" }), value: field.endTime, enableAccessibleFieldDOMStructure: false, localeText: {
|
|
451
|
+
toolbarTitle: intl.formatMessage(messages.titleTime)
|
|
452
|
+
}, slots: {
|
|
453
|
+
openPickerButton: (params) => (_jsx(IconButton, Object.assign({}, params, { sx: { marginLeft: 0 } }, { children: _jsx(Icon, { children: "access_time" }) })))
|
|
440
454
|
}, slotProps: {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
455
|
+
field: {
|
|
456
|
+
openPickerButtonPosition: 'start'
|
|
457
|
+
},
|
|
458
|
+
textField: {
|
|
459
|
+
slotProps: {
|
|
460
|
+
input: {
|
|
461
|
+
placeholder: intl.formatMessage(messages.endTime)
|
|
462
|
+
}
|
|
463
|
+
}
|
|
445
464
|
}
|
|
446
465
|
}, onChange: (value) => {
|
|
447
466
|
handleChangeDateTime(value, 'endDate');
|
|
448
467
|
handleChangeDateTime(value, 'endTime');
|
|
449
|
-
}, shouldDisableTime: shouldDisableTime })] })) })), _jsx(EventAddress, Object.assign({ forwardGeolocationData: handleGeoData, forwardLivestreamSettingsData: handleLiveStreamSettingsData, event: Object.assign(Object.assign({}, event), {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
468
|
+
}, shouldDisableTime: shouldDisableTime })] })) })), _jsx(APIProvider, Object.assign({ apiKey: geocodingApiKey, libraries: libraries }, { children: _jsx(EventAddress, Object.assign({ forwardGeolocationData: handleGeoData, forwardLivestreamSettingsData: handleLiveStreamSettingsData, event: Object.assign(Object.assign({}, event), {
|
|
469
|
+
name: field.name,
|
|
470
|
+
start_date: field.startDate,
|
|
471
|
+
location: field.location,
|
|
472
|
+
geolocation: field.geolocation,
|
|
473
|
+
live_stream: Object.assign(Object.assign({ title: field.name || intl.formatMessage(messages.name) }, (event && ((_e = event.live_stream) === null || _e === void 0 ? void 0 : _e.created_at) && { created_at: field.startDate })), { settings: field.liveStreamSettings })
|
|
474
|
+
}) }, EventAddressComponentProps)) })), privateEnabled && (_jsxs(Box, Object.assign({ className: classes.privacySection }, { children: [_jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center", justifyContent: "center" }, { children: [_jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: !field.isPublic }) }, { children: [_jsx(Icon, { children: "private" }), _jsx(FormattedMessage, { id: "ui.eventForm.privacy.private", defaultMessage: "ui.eventForm.privacy.private" })] })), _jsx(Switch, { className: classes.switch, checked: field.isPublic, onChange: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isPublic']: !field.isPublic }))), disabled: (event === null || event === void 0 ? void 0 : event.privacy) === SCEventPrivacyType.PRIVATE }), _jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: field.isPublic }) }, { children: [_jsx(Icon, { children: "public" }), _jsx(FormattedMessage, { id: "ui.eventForm.privacy.public", defaultMessage: "ui.eventForm.privacy.public" })] }))] })), _jsx(Typography, Object.assign({ variant: "body2", textAlign: "center", className: classes.privacySectionInfo }, { children: field.isPublic ? (_jsx(FormattedMessage, { id: "ui.eventForm.privacy.public.info", defaultMessage: "ui.eventForm.privacy.public.info", values: {
|
|
456
475
|
b: (chunks) => _jsx("strong", { children: chunks }, "ui.eventForm.privacy.public.info.b")
|
|
457
476
|
} })) : (_jsx(FormattedMessage, { id: "ui.eventForm.privacy.private.info", defaultMessage: "ui.eventForm.private.public.info", values: {
|
|
458
477
|
b: (chunks) => _jsx("strong", { children: chunks }, "ui.eventForm.privacy.private.info.b")
|
|
459
|
-
} })) }))] }))), _jsx(TextField, { multiline: true, className: classes.description, placeholder:
|
|
478
|
+
} })) }))] }))), _jsx(TextField, { multiline: true, className: classes.description, placeholder: intl.formatMessage(messages.description), margin: "normal", value: field.description, name: "description", onChange: handleChange, slotProps: {
|
|
460
479
|
input: {
|
|
461
480
|
endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_f = field.description) === null || _f === void 0 ? void 0 : _f.length) ? EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : EVENT_DESCRIPTION_MAX_LENGTH })))
|
|
462
481
|
}
|
|
@@ -2,7 +2,7 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Box, CardContent, Typography, styled } from '@mui/material';
|
|
4
4
|
import { useThemeProps } from '@mui/system';
|
|
5
|
-
import { APIProvider
|
|
5
|
+
import { APIProvider } from '@vis.gl/react-google-maps';
|
|
6
6
|
import { useSCGoogleApiLoader, useSCFetchEvent } from '@selfcommunity/react-core';
|
|
7
7
|
import { SCEventLocationType } from '@selfcommunity/types';
|
|
8
8
|
import classNames from 'classnames';
|
|
@@ -12,6 +12,7 @@ import { formatEventLocationGeolocation } from '../../utils/string';
|
|
|
12
12
|
import Widget from '../Widget';
|
|
13
13
|
import { PREFIX } from './constants';
|
|
14
14
|
import EventLocationWidgetSkeleton from './Skeleton';
|
|
15
|
+
import EventMap from './EventMap';
|
|
15
16
|
const classes = {
|
|
16
17
|
root: `${PREFIX}-root`,
|
|
17
18
|
title: `${PREFIX}-title`,
|
|
@@ -64,24 +65,18 @@ export default function EventLocationWidget(inProps) {
|
|
|
64
65
|
// STATE
|
|
65
66
|
const { scEvent } = useSCFetchEvent({ id: eventId, event });
|
|
66
67
|
// HOOKS
|
|
67
|
-
const {
|
|
68
|
+
const { geocodingApiKey, libraries } = useSCGoogleApiLoader();
|
|
68
69
|
if (!geocodingApiKey || (scEvent === null || scEvent === void 0 ? void 0 : scEvent.location) === SCEventLocationType.ONLINE) {
|
|
69
70
|
return _jsx(HiddenPlaceholder, {});
|
|
70
71
|
}
|
|
71
72
|
/**
|
|
72
73
|
* Loading event
|
|
73
74
|
*/
|
|
74
|
-
if (!
|
|
75
|
+
if (!scEvent) {
|
|
75
76
|
return _jsx(EventLocationWidgetSkeleton, {});
|
|
76
77
|
}
|
|
77
78
|
/**
|
|
78
79
|
* Renders root object
|
|
79
80
|
*/
|
|
80
|
-
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsxs(CardContent, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title, gutterBottom: true }, { children: _jsx(FormattedMessage, { id: "ui.eventLocationWidget.title", defaultMessage: "ui.eventLocationWidget.title" }) })), _jsx(Box, Object.assign({ className: classes.map }, { children: _jsx(APIProvider, Object.assign({ apiKey: geocodingApiKey }, { children: _jsx(
|
|
81
|
-
lat: scEvent.geolocation_lat,
|
|
82
|
-
lng: scEvent.geolocation_lng
|
|
83
|
-
}, zoom: 15, fullscreenControl: false, mapTypeControl: false, streetViewControl: false, zoomControl: false }, { children: _jsx(Marker, { position: {
|
|
84
|
-
lat: scEvent.geolocation_lat,
|
|
85
|
-
lng: scEvent.geolocation_lng
|
|
86
|
-
} }) })) })) })), _jsx(Typography, Object.assign({ variant: "h4", className: classes.locationTitle }, { children: formatEventLocationGeolocation(scEvent.geolocation, true) })), _jsx(Typography, Object.assign({ variant: "body1", className: classes.address }, { children: formatEventLocationGeolocation(scEvent.geolocation) }))] }) })));
|
|
81
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsxs(CardContent, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title, gutterBottom: true }, { children: _jsx(FormattedMessage, { id: "ui.eventLocationWidget.title", defaultMessage: "ui.eventLocationWidget.title" }) })), _jsx(Box, Object.assign({ className: classes.map }, { children: _jsx(APIProvider, Object.assign({ apiKey: geocodingApiKey, libraries: libraries }, { children: _jsx(EventMap, { event: scEvent, className: classes.map }) })) })), _jsx(Typography, Object.assign({ variant: "h4", className: classes.locationTitle }, { children: formatEventLocationGeolocation(scEvent.geolocation, true) })), _jsx(Typography, Object.assign({ variant: "body1", className: classes.address }, { children: formatEventLocationGeolocation(scEvent.geolocation) }))] }) })));
|
|
87
82
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SCEventType } from '@selfcommunity/types';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
interface EventMapProps {
|
|
4
|
+
event: SCEventType;
|
|
5
|
+
className?: HTMLAttributes<HTMLDivElement>['className'];
|
|
6
|
+
}
|
|
7
|
+
export default function EventMap(props: EventMapProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useSCGoogleApiLoader } from '@selfcommunity/react-core';
|
|
3
|
+
import { Map, Marker } from '@vis.gl/react-google-maps';
|
|
4
|
+
export default function EventMap(props) {
|
|
5
|
+
// PROPS
|
|
6
|
+
const { event, className } = props;
|
|
7
|
+
// HOOKS
|
|
8
|
+
const { isLoaded } = useSCGoogleApiLoader();
|
|
9
|
+
if (!isLoaded) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return (_jsx(Map, Object.assign({ className: className, center: {
|
|
13
|
+
lat: event.geolocation_lat,
|
|
14
|
+
lng: event.geolocation_lng
|
|
15
|
+
}, zoom: 15, fullscreenControl: false, mapTypeControl: false, streetViewControl: false, zoomControl: false }, { children: _jsx(Marker, { position: {
|
|
16
|
+
lat: event.geolocation_lat,
|
|
17
|
+
lng: event.geolocation_lng
|
|
18
|
+
} }) })));
|
|
19
|
+
}
|
|
@@ -137,28 +137,27 @@ export default function LessonReleaseMenu(inProps) {
|
|
|
137
137
|
okButtonLabel: `${intl.formatMessage(messages.pickerOkMessage)}`,
|
|
138
138
|
cancelButtonLabel: `${intl.formatMessage(messages.pickerCancelMessage)}`,
|
|
139
139
|
clearButtonLabel: `${intl.formatMessage(messages.pickerClearMessage)}`
|
|
140
|
-
} }, { children: _jsx(MobileDateTimePicker, { className: classes.picker, disablePast: true, label: drippedAt && (_jsx(FormattedMessage, { id: "ui.lessonReleaseMenu.scheduled.picker.placeholder", defaultMessage: "ui.lessonReleaseMenu.scheduled.picker.placeholder" })), value: drippedAt, enableAccessibleFieldDOMStructure: false,
|
|
141
|
-
|
|
140
|
+
} }, { children: _jsx(MobileDateTimePicker, { className: classes.picker, disablePast: true, label: drippedAt && (_jsx(FormattedMessage, { id: "ui.lessonReleaseMenu.scheduled.picker.placeholder", defaultMessage: "ui.lessonReleaseMenu.scheduled.picker.placeholder" })), value: drippedAt, enableAccessibleFieldDOMStructure: false, localeText: {
|
|
141
|
+
toolbarTitle: intl.formatMessage(messages.pickerPlaceholder)
|
|
142
|
+
}, slots: {
|
|
142
143
|
tabs: (props) => _jsx(DateTimePickerTabs, Object.assign({}, props)),
|
|
143
|
-
|
|
144
|
-
var _a;
|
|
145
|
-
return (_jsx(TextField, Object.assign({}, params, { error: false, slotProps: {
|
|
146
|
-
input: Object.assign(Object.assign({}, (_a = params.slotProps) === null || _a === void 0 ? void 0 : _a.input), { placeholder: `${intl.formatMessage(messages.pickerPlaceholder)}`, endAdornment: (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: _jsx(IconButton, Object.assign({ disabled: isDisabled }, { children: _jsx(Icon, { children: "expand_more" }) })) }))) })
|
|
147
|
-
} })));
|
|
148
|
-
}
|
|
144
|
+
openPickerButton: (params) => (_jsx(IconButton, Object.assign({}, params, { children: _jsx(Icon, { children: "expand_more" }) })))
|
|
149
145
|
}, slotProps: {
|
|
150
146
|
tabs: {
|
|
151
147
|
hidden: false
|
|
152
148
|
},
|
|
153
|
-
toolbar: {
|
|
154
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
|
|
155
|
-
// @ts-ignore
|
|
156
|
-
toolbarTitle: (_jsx(FormattedMessage, { id: "ui.lessonReleaseMenu.scheduled.picker.placeholder", defaultMessage: "ui.lessonReleaseMenu.scheduled.picker.placeholder" }))
|
|
157
|
-
},
|
|
158
149
|
actionBar: {
|
|
159
150
|
actions: ['cancel', 'clear', 'accept']
|
|
151
|
+
},
|
|
152
|
+
textField: {
|
|
153
|
+
error: false,
|
|
154
|
+
slotProps: {
|
|
155
|
+
input: {
|
|
156
|
+
placeholder: intl.formatMessage(messages.pickerPlaceholder)
|
|
157
|
+
}
|
|
158
|
+
}
|
|
160
159
|
}
|
|
161
|
-
}, onChange:
|
|
160
|
+
}, onChange: setDrippedAt, onAccept: handleUpdate, disabled: isDisabled }) }))) : (_jsxs(_Fragment, { children: [_jsx(TextField, { size: "small", value: placeholderStructured, onClick: isDisabled ? undefined : handleClick, slotProps: {
|
|
162
161
|
input: {
|
|
163
162
|
endAdornment: (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: _jsx(IconButton, Object.assign({ onClick: handleClick, disabled: isDisabled }, { children: _jsx(Icon, { children: "expand_more" }) })) })))
|
|
164
163
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
+
import { createElement as _createElement } from "react";
|
|
2
3
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
4
|
import { useEffect, useMemo, useState } from 'react';
|
|
4
5
|
import { FormattedMessage } from 'react-intl';
|
|
@@ -104,6 +105,6 @@ export default function LocationAutocomplete(inProps) {
|
|
|
104
105
|
}, renderOption: (props, option, { inputValue }) => {
|
|
105
106
|
const matches = match(option.full_address, inputValue);
|
|
106
107
|
const parts = parse(option.full_address, matches);
|
|
107
|
-
return (
|
|
108
|
+
return (_createElement("li", Object.assign({}, props, { key: `${option.lat}_${option.lng}`, style: { whiteSpace: 'break-spaces' } }), parts.map((part, index) => part.highlight ? (_jsx("span", Object.assign({ style: { fontWeight: 700 } }, { children: part.text }), index)) : (part.text))));
|
|
108
109
|
} }, rest)));
|
|
109
110
|
}
|
|
@@ -26,6 +26,10 @@ import { enUS } from 'date-fns/locale/en-US';
|
|
|
26
26
|
import Category from '../Category';
|
|
27
27
|
const PREFIX = 'SCPaymentOrders';
|
|
28
28
|
const messages = defineMessages({
|
|
29
|
+
datePicker: {
|
|
30
|
+
id: 'ui.paymentOrders.picker.date',
|
|
31
|
+
defaultMessage: 'ui.paymentOrders.picker.date'
|
|
32
|
+
},
|
|
29
33
|
dateFrom: {
|
|
30
34
|
id: 'ui.paymentOrders.dateFrom',
|
|
31
35
|
defaultMessage: 'ui.paymentOrders.dateFrom'
|
|
@@ -219,41 +223,39 @@ export default function PaymentOrders(inProps) {
|
|
|
219
223
|
}, disabled: isLoading }, { children: _jsx(Icon, { children: "close" }) }))), isMobile ? (_jsx(IconButton, { onClick: () => fetchInvoices(), disabled: isLoading })) : (_jsx(Button, { size: "small", variant: "contained", color: "secondary", onClick: () => fetchInvoices(), endIcon: _jsx(Icon, { children: "search" }), disabled: isLoading }))] })))
|
|
220
224
|
}
|
|
221
225
|
} }) })), _jsx(Grid, Object.assign({ size: { xs: 12, md: 3 } }, { children: _jsx(TextField, Object.assign({ select: true, fullWidth: true, disabled: isLoading, size: "small", label: _jsx(FormattedMessage, { id: "ui.paymentOrders.contentTypeFilter", defaultMessage: "ui.paymentOrders.contentTypeFilter" }), value: contentTypeFilter, onChange: handleContentTypeChange }, { children: options.map((option) => (_jsx(MenuItem, Object.assign({ value: option.value }, { children: option.label }), option.value))) })) })), _jsx(Grid, Object.assign({ size: { xs: 12, sm: 8, md: 4 } }, { children: _jsx(LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? it : enUS, localeText: {
|
|
222
|
-
cancelButtonLabel:
|
|
223
|
-
clearButtonLabel:
|
|
224
|
-
} }, { children: _jsxs(Grid, Object.assign({ container: true, width: "100%", spacing: 2 }, { children: [_jsx(Grid, Object.assign({ size: 6 }, { children: _jsx(MobileDatePicker, { className: classes.picker, label: _jsx(FormattedMessage, { id: "ui.paymentOrders.dateFrom", defaultMessage: "ui.paymentOrders.dateFrom" }), value: startDate, enableAccessibleFieldDOMStructure: false,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
input: Object.assign(Object.assign({}, (_a = params.slotProps) === null || _a === void 0 ? void 0 : _a.input), { placeholder: `${intl.formatMessage(messages.dateFrom)}`, endAdornment: (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "CalendarIcon" }) }) }))) })
|
|
229
|
-
} })));
|
|
230
|
-
}
|
|
226
|
+
cancelButtonLabel: intl.formatMessage(messages.pickerCancelAction),
|
|
227
|
+
clearButtonLabel: intl.formatMessage(messages.pickerClearAction)
|
|
228
|
+
} }, { children: _jsxs(Grid, Object.assign({ container: true, width: "100%", spacing: 2 }, { children: [_jsx(Grid, Object.assign({ size: 6 }, { children: _jsx(MobileDatePicker, { className: classes.picker, label: _jsx(FormattedMessage, { id: "ui.paymentOrders.dateFrom", defaultMessage: "ui.paymentOrders.dateFrom" }), value: startDate, enableAccessibleFieldDOMStructure: false, localeText: {
|
|
229
|
+
toolbarTitle: intl.formatMessage(messages.datePicker)
|
|
230
|
+
}, slots: {
|
|
231
|
+
openPickerButton: (params) => (_jsx(IconButton, Object.assign({}, params, { children: _jsx(Icon, { children: "CalendarIcon" }) })))
|
|
231
232
|
}, slotProps: {
|
|
232
233
|
actionBar: {
|
|
233
234
|
actions: ['cancel', 'clear', 'accept']
|
|
234
235
|
},
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
textField: (params) => {
|
|
242
|
-
var _a;
|
|
243
|
-
return (_jsx(TextField, Object.assign({}, params, { size: "small", slotProps: {
|
|
244
|
-
input: Object.assign(Object.assign({}, (_a = params.slotProps) === null || _a === void 0 ? void 0 : _a.input), { placeholder: `${intl.formatMessage(messages.dateTo)}`, endAdornment: (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "CalendarIcon" }) }) }))) })
|
|
245
|
-
} })));
|
|
236
|
+
textField: {
|
|
237
|
+
slotProps: {
|
|
238
|
+
input: {
|
|
239
|
+
placeholder: intl.formatMessage(messages.dateFrom)
|
|
240
|
+
}
|
|
241
|
+
}
|
|
246
242
|
}
|
|
243
|
+
}, onChange: setStartDate }) })), _jsx(Grid, Object.assign({ size: 6 }, { children: _jsx(MobileDatePicker, { className: classes.picker, label: _jsx(FormattedMessage, { id: "ui.paymentOrders.dateTo", defaultMessage: "ui.paymentOrders.dateTo" }), value: endDate, enableAccessibleFieldDOMStructure: false, localeText: {
|
|
244
|
+
toolbarTitle: intl.formatMessage(messages.datePicker)
|
|
245
|
+
}, slots: {
|
|
246
|
+
openPickerButton: (params) => (_jsx(IconButton, Object.assign({}, params, { children: _jsx(Icon, { children: "CalendarIcon" }) })))
|
|
247
247
|
}, slotProps: {
|
|
248
248
|
actionBar: {
|
|
249
249
|
actions: ['cancel', 'clear', 'accept']
|
|
250
250
|
},
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
251
|
+
textField: {
|
|
252
|
+
slotProps: {
|
|
253
|
+
input: {
|
|
254
|
+
placeholder: intl.formatMessage(messages.dateTo)
|
|
255
|
+
}
|
|
256
|
+
}
|
|
255
257
|
}
|
|
256
|
-
}, onChange:
|
|
258
|
+
}, onChange: setEndDate }) }))] })) })) }))] })), _jsx(Box, Object.assign({ className: classes.content }, { children: !isLoading ? (_jsx(TableContainer, Object.assign({ style: { margin: 'auto', borderRadius: 0 } }, { children: _jsxs(Table, Object.assign({ sx: { minWidth: 650 }, "aria-label": "simple table", stickyHeader: true }, { children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableCell, Object.assign({ width: "5%" }, { children: _jsx(FormattedMessage, { id: "ui.paymentOrders.number", defaultMessage: "ui.paymentOrders.number" }) })), _jsx(TableCell, Object.assign({ width: "7%" }, { children: _jsx(FormattedMessage, { id: "ui.paymentOrders.contentType", defaultMessage: "ui.paymentOrders.contentType" }) })), _jsx(TableCell, Object.assign({ width: "38%" }, { children: _jsx(FormattedMessage, { id: "ui.paymentOrders.content", defaultMessage: "ui.paymentOrders.content" }) })), _jsx(TableCell, Object.assign({ width: "10%" }, { children: _jsx(FormattedMessage, { id: "ui.paymentOrders.price", defaultMessage: "ui.paymentOrders.price" }) })), _jsx(TableCell, Object.assign({ width: "12%" }, { children: _jsx(FormattedMessage, { id: "ui.paymentOrders.createdAt", defaultMessage: "ui.paymentOrders.createdAt" }) })), _jsx(TableCell, Object.assign({ width: "13%" }, { children: _jsx(FormattedMessage, { id: "ui.paymentOrders.expired_at", defaultMessage: "ui.paymentOrders.expired_at" }) })), _jsx(TableCell, Object.assign({ width: "10%" }, { children: _jsx(FormattedMessage, { id: "ui.paymentOrders.status", defaultMessage: "ui.paymentOrders.status" }) })), _jsx(TableCell, { children: _jsx(FormattedMessage, { id: "ui.paymentOrders.actions", defaultMessage: "ui.paymentOrders.actions" }) })] }) }), _jsxs(TableBody, { children: [orders.map((order, index) => (_jsxs(TableRow, { children: [_jsx(TableCell, Object.assign({ scope: "row" }, { children: _jsx("b", { children: order.id }) })), _jsx(TableCell, Object.assign({ scope: "row" }, { children: _jsx(FormattedMessage, { id: `ui.paymentOrders.contentType.${order.content_type}`, defaultMessage: `ui.paymentOrders.contentType.${order.content_type}` }) })), _jsx(TableCell, Object.assign({ scope: "row" }, { children: renderContent(order) })), _jsx(TableCell, Object.assign({ scope: "row" }, { children: getConvertedAmount(order.payment_price) })), _jsx(TableCell, Object.assign({ scope: "row" }, { children: order.created_at &&
|
|
257
259
|
intl.formatDate(new Date(order.created_at), {
|
|
258
260
|
year: 'numeric',
|
|
259
261
|
month: 'numeric',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo, useState } from 'react';
|
|
4
|
-
import { Box, CircularProgress, IconButton, InputAdornment, MenuItem, TextField,
|
|
4
|
+
import { Box, CircularProgress, IconButton, InputAdornment, MenuItem, TextField, Icon, styled, Button } from '@mui/material';
|
|
5
5
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
6
6
|
import { Endpoints, formatHttpErrorCode, http } from '@selfcommunity/api-services';
|
|
7
7
|
import { camelCase, Logger } from '@selfcommunity/utils';
|
|
@@ -15,7 +15,7 @@ import { useDeepCompareEffectNoCheck } from 'use-deep-compare-effect';
|
|
|
15
15
|
import { SCUserProfileFields } from '../../../types';
|
|
16
16
|
import MetadataField from '../../../shared/MetadataField';
|
|
17
17
|
import { SCOPE_SC_UI } from '../../../constants/Errors';
|
|
18
|
-
import { format, isBefore, isValid,
|
|
18
|
+
import { format, isBefore, isValid, startOfHour } from 'date-fns';
|
|
19
19
|
import { it } from 'date-fns/locale/it';
|
|
20
20
|
import { enUS } from 'date-fns/locale/en-US';
|
|
21
21
|
import { useSnackbar } from 'notistack';
|
|
@@ -67,9 +67,7 @@ export default function PublicInfo(props) {
|
|
|
67
67
|
return null;
|
|
68
68
|
}, [scPreferences.preferences]);
|
|
69
69
|
// STATE
|
|
70
|
-
const
|
|
71
|
-
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
72
|
-
const [user, setUser] = useState();
|
|
70
|
+
const [user, setUser] = useState(null);
|
|
73
71
|
const [error, setError] = useState({});
|
|
74
72
|
const [editing, setEditing] = useState([]);
|
|
75
73
|
const [saving, setSaving] = useState([]);
|
|
@@ -159,7 +157,7 @@ export default function PublicInfo(props) {
|
|
|
159
157
|
return (_jsx(LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? it : enUS }, { children: _jsx(DatePicker, { label: intl.formatMessage({
|
|
160
158
|
id: `ui.userInfo.${camelCase(field)}`,
|
|
161
159
|
defaultMessage: `ui.userInfo.${field}`
|
|
162
|
-
}), defaultValue: user[field] ?
|
|
160
|
+
}), defaultValue: user[field] ? new Date(user[field]) : null, minDate: DATEPICKER_MINDATE, onChange: (newValue) => {
|
|
163
161
|
const u = user;
|
|
164
162
|
const field = SCUserProfileFields.DATE_OF_BIRTH;
|
|
165
163
|
const camelField = camelCase(field);
|
|
@@ -181,13 +179,8 @@ export default function PublicInfo(props) {
|
|
|
181
179
|
}
|
|
182
180
|
setUser(u);
|
|
183
181
|
setEditing([...editing, field]);
|
|
184
|
-
}, disableFuture: true, disabled: isSaving, slots: {
|
|
185
|
-
|
|
186
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
|
|
187
|
-
// @ts-ignore
|
|
188
|
-
const _a = params.children.props, { children } = _a, rest = __rest(_a, ["children"]);
|
|
189
|
-
return (_jsxs(InputAdornment, Object.assign({ position: "end" }, { children: [_jsx(IconButton, Object.assign({}, rest, { children: children })), isSaving && _jsx(CircularProgress, { size: 10 })] })));
|
|
190
|
-
}
|
|
182
|
+
}, disableFuture: true, disabled: isSaving, enableAccessibleFieldDOMStructure: false, slots: {
|
|
183
|
+
openPickerButton: (params) => (_jsxs(IconButton, Object.assign({}, params, { children: [_jsx(Icon, { children: "CalendarIcon" }), isSaving && _jsx(CircularProgress, { size: 10 })] })))
|
|
191
184
|
},
|
|
192
185
|
// onAccept={isMobile ? handleSave(SCUserProfileFields.DATE_OF_BIRTH) : null}
|
|
193
186
|
slotProps: {
|
|
@@ -195,10 +188,7 @@ export default function PublicInfo(props) {
|
|
|
195
188
|
className: classes.field,
|
|
196
189
|
fullWidth: true,
|
|
197
190
|
variant: 'outlined',
|
|
198
|
-
helperText: _error || null
|
|
199
|
-
InputProps: {
|
|
200
|
-
endAdornment: isMobile && (_jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ disabled: !isEditing }, { children: _jsx(Icon, { children: "CalendarIcon" }) })), isSaving ? _jsx(CircularProgress, { size: 10 }) : null] }))
|
|
201
|
-
}
|
|
191
|
+
helperText: _error || null
|
|
202
192
|
}
|
|
203
193
|
} }) }), field));
|
|
204
194
|
case SCUserProfileFields.BIO:
|