@evenicanpm/admin-integrate 1.1.0 → 1.2.2
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/documents/Process/fragments.ts +13 -0
- package/documents/Process/list.ts +27 -0
- package/documents/ProcessSchedule/fragments.ts +24 -0
- package/documents/ProcessSchedule/read.ts +12 -0
- package/documents/ProcessScheduleGroup/fragments.ts +29 -0
- package/documents/ProcessScheduleGroup/read.ts +12 -0
- package/documents/ScheduledProcess/fragments.ts +24 -0
- package/documents/ScheduledProcess/list.ts +27 -0
- package/package.json +21 -17
- package/src/api/Integrations/queries/get-process.query.ts +48 -0
- package/src/api/Integrations/queries/get-process.server.ts +9 -0
- package/src/api/Integrations/queries/index.ts +1 -0
- package/src/api/dashboard/queries/get-process-executions.query.ts +33 -36
- package/src/api/dashboard/queries/get-process-executions.server.ts +4 -4
- package/src/api/scheduler/queries/get-process-schedule-group-details.query.ts +45 -0
- package/src/api/scheduler/queries/get-process-schedule-group-details.server.ts +14 -0
- package/src/api/scheduler/queries/get-process-schedule.query.ts +45 -0
- package/src/api/scheduler/queries/get-process-schedule.server.ts +14 -0
- package/src/api/scheduler/queries/get-scheduled-processes.query.ts +45 -0
- package/src/api/scheduler/queries/get-scheduled-processes.server.ts +11 -0
- package/src/api/scheduler/queries/index.ts +3 -0
- package/src/components/breadcrumbs/breadcrumbs.tsx +23 -26
- package/src/components/breadcrumbs/index.ts +1 -1
- package/src/components/breadcrumbs/types.tsx +4 -0
- package/src/components/button/outlined-icon-button.tsx +26 -38
- package/src/components/core/date-time-popover.tsx +32 -0
- package/src/components/core/edited-typography.tsx +20 -0
- package/src/components/core/index.ts +3 -0
- package/src/components/core/loading.tsx +6 -6
- package/src/components/core/title-edit.tsx +122 -0
- package/src/components/dashboard-list/dashboard-list-row.tsx +114 -115
- package/src/components/dashboard-list/dashboard-list.tsx +119 -119
- package/src/components/data-table/table-header.tsx +85 -81
- package/src/components/data-table/table-pagination.tsx +27 -27
- package/src/components/data-table/table-row.tsx +14 -14
- package/src/components/data-table/table-skeleton.tsx +34 -34
- package/src/components/execution/execution-filter.ts +22 -22
- package/src/components/execution/execution-status-icon.tsx +16 -17
- package/src/components/execution/execution-tag.tsx +81 -80
- package/src/components/footer/footer.tsx +34 -34
- package/src/components/header/dashboard-list-header.tsx +64 -63
- package/src/components/header/execution-details-header.tsx +102 -129
- package/src/components/header/header.tsx +27 -27
- package/src/components/header/index.ts +1 -0
- package/src/components/header/integration-details-header.tsx +99 -0
- package/src/components/icons/up-down.tsx +15 -15
- package/src/components/integration-list/index.ts +2 -0
- package/src/components/integration-list/integration-filter.ts +21 -0
- package/src/components/integration-list/integration-status-icon.tsx +33 -0
- package/src/components/integration-list/integration-tag.tsx +77 -0
- package/src/components/integration-view/edges/default-edge.tsx +18 -17
- package/src/components/integration-view/elk-layout-options.ts +26 -26
- package/src/components/integration-view/elk-types.ts +16 -12
- package/src/components/integration-view/flow-types.tsx +5 -5
- package/src/components/integration-view/integration-view.tsx +132 -130
- package/src/components/integration-view/nodes/base-node.tsx +50 -0
- package/src/components/integration-view/nodes/connection-node.tsx +8 -8
- package/src/components/integration-view/nodes/entry-node.tsx +8 -8
- package/src/components/integration-view/nodes/group-node.tsx +47 -6
- package/src/components/integration-view/nodes/task-node.tsx +58 -13
- package/src/components/integration-view/temp-data/initialElements.tsx +224 -0
- package/src/components/integration-view/types.ts +6 -6
- package/src/components/layouts/main-layout.tsx +13 -13
- package/src/components/layouts/root-container.tsx +25 -25
- package/src/components/link-cards/link-card.tsx +23 -23
- package/src/components/link-cards/styles.ts +15 -15
- package/src/components/list-filter/date-filter.tsx +41 -45
- package/src/components/list-filter/date-range-filter.tsx +78 -77
- package/src/components/list-filter/list-filter-types.ts +38 -38
- package/src/components/list-filter/list-filter.tsx +363 -354
- package/src/components/list-filter/multi-select-filter.tsx +94 -95
- package/src/components/list-filter/select-filter.tsx +67 -64
- package/src/components/scheduler/day-selector.tsx +174 -0
- package/src/components/scheduler/day-tag.tsx +73 -0
- package/src/components/scheduler/index.ts +4 -0
- package/src/components/scheduler/schedule-filter.ts +25 -0
- package/src/components/scheduler/schedule-icon.tsx +87 -0
- package/src/components/scheduler/scheduler-types.ts +40 -0
- package/src/hooks/use-breadcrumbs.ts +31 -31
- package/src/hooks/use-recurrence.tsx +13 -0
- package/src/hooks/use-timestamp.tsx +21 -21
- package/src/pages/dashboard/dashboard-link-cards.tsx +99 -99
- package/src/pages/dashboard/dashboard-list-sections.tsx +130 -125
- package/src/pages/dashboard/dashboard.tsx +6 -6
- package/src/pages/execution-details/execution-details.tsx +23 -29
- package/src/pages/executions/executions-list/executions-list-row.tsx +101 -104
- package/src/pages/executions/executions-list/executions-list-table.tsx +45 -53
- package/src/pages/executions/executions-list/executions-list.tsx +219 -212
- package/src/pages/executions/executions.tsx +67 -72
- package/src/pages/integrations/integration-list/index.ts +1 -0
- package/src/pages/integrations/integration-list/integration-list-row.tsx +147 -0
- package/src/pages/integrations/integration-list/integration-list-table.tsx +78 -0
- package/src/pages/integrations/integration-list/integration-list.tsx +262 -0
- package/src/pages/integrations/integrations.tsx +83 -28
- package/src/pages/scheduler/schedule-drawer/edited/edited-types.ts +17 -0
- package/src/pages/scheduler/schedule-drawer/edited/index.ts +1 -0
- package/src/pages/scheduler/schedule-drawer/index.ts +1 -0
- package/src/pages/scheduler/schedule-drawer/schedule-details-integrations.tsx +227 -0
- package/src/pages/scheduler/schedule-drawer/schedule-details-main.tsx +292 -0
- package/src/pages/scheduler/schedule-drawer/schedule-details-name.tsx +77 -0
- package/src/pages/scheduler/schedule-drawer/schedule-details-skeleton.tsx +64 -0
- package/src/pages/scheduler/schedule-drawer/schedule-details.tsx +42 -0
- package/src/pages/scheduler/schedule-drawer/schedule-drawer-buttons.tsx +72 -0
- package/src/pages/scheduler/schedule-drawer/schedule-drawer-group.tsx +103 -0
- package/src/pages/scheduler/schedule-drawer/schedule-drawer-legacy.tsx +94 -0
- package/src/pages/scheduler/schedule-drawer/schedule-drawer.tsx +101 -0
- package/src/pages/scheduler/schedule-drawer/sortable-integration-row.tsx +93 -0
- package/src/pages/scheduler/scheduler.tsx +106 -30
- package/src/pages/scheduler/schedules-list/index.ts +1 -0
- package/src/pages/scheduler/schedules-list/schedules-list-row.tsx +235 -0
- package/src/pages/scheduler/schedules-list/schedules-list-table.tsx +74 -0
- package/src/pages/scheduler/schedules-list/schedules-list.tsx +280 -0
- package/tsconfig.json +29 -26
- package/src/components/integration-view/temp-data/initialElements.ts +0 -238
|
@@ -1,117 +1,116 @@
|
|
|
1
1
|
import { useTranslations } from "next-intl";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
Box,
|
|
4
|
+
Typography,
|
|
5
|
+
IconButton,
|
|
6
|
+
InputAdornment,
|
|
7
|
+
Select,
|
|
8
|
+
MenuItem,
|
|
9
|
+
Theme,
|
|
10
|
+
useTheme,
|
|
11
|
+
FormControl,
|
|
12
|
+
Chip,
|
|
13
13
|
} from "@mui/material";
|
|
14
14
|
import { CloseOutlined } from "@mui/icons-material";
|
|
15
15
|
import React, { useState } from "react";
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
FilterOption,
|
|
18
|
+
MultiSelectFilter,
|
|
19
|
+
FilterProps,
|
|
20
20
|
} from "./list-filter-types";
|
|
21
21
|
|
|
22
22
|
const MultiSelectFilterComponent: React.FC<FilterProps<MultiSelectFilter>> = ({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
current,
|
|
23
|
+
filter,
|
|
24
|
+
onSet,
|
|
25
|
+
current,
|
|
27
26
|
}) => {
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const theme = useTheme();
|
|
28
|
+
const styles = getStyles(theme);
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
const t = useTranslations("Integrate");
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
const mappedOptionDictionary = filter.options.reduce(
|
|
33
|
+
(dictionary, option) => ({
|
|
34
|
+
...dictionary,
|
|
35
|
+
[option.id]: {
|
|
36
|
+
id: option.id,
|
|
37
|
+
value: t(option.value),
|
|
38
|
+
},
|
|
39
|
+
}),
|
|
40
|
+
{},
|
|
41
|
+
) as { [id: string | number]: FilterOption };
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
const [value, setValue] = useState(current);
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
const updateValue = (optionIds: (string | number)[] | null) => {
|
|
46
|
+
const newValue = optionIds?.map((id) => mappedOptionDictionary[id]) || null;
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
setValue(newValue);
|
|
49
|
+
onSet(newValue);
|
|
50
|
+
};
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
52
|
+
return (
|
|
53
|
+
<FormControl>
|
|
54
|
+
<Typography>{t(filter.label)}</Typography>
|
|
55
|
+
<Select
|
|
56
|
+
sx={styles.select}
|
|
57
|
+
multiple
|
|
58
|
+
value={(value || []).map(({ id }) => id)}
|
|
59
|
+
onChange={(e) => updateValue(e.target.value as (string | number)[])}
|
|
60
|
+
renderValue={(selected) => (
|
|
61
|
+
<Box sx={styles.chipSelect}>
|
|
62
|
+
{selected.map((id) => (
|
|
63
|
+
<Chip
|
|
64
|
+
key={id}
|
|
65
|
+
label={mappedOptionDictionary[id].value}
|
|
66
|
+
size="small"
|
|
67
|
+
/>
|
|
68
|
+
))}
|
|
69
|
+
</Box>
|
|
70
|
+
)}
|
|
71
|
+
endAdornment={
|
|
72
|
+
value ? (
|
|
73
|
+
<InputAdornment sx={styles.inputClearButton} position="end">
|
|
74
|
+
<IconButton
|
|
75
|
+
onClick={() => {
|
|
76
|
+
updateValue(null);
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
<CloseOutlined></CloseOutlined>
|
|
80
|
+
</IconButton>
|
|
81
|
+
</InputAdornment>
|
|
82
|
+
) : (
|
|
83
|
+
""
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
>
|
|
87
|
+
{filter.options.map((option) => (
|
|
88
|
+
<MenuItem key={option.id} value={option.id}>
|
|
89
|
+
{t(option.value)}
|
|
90
|
+
</MenuItem>
|
|
91
|
+
))}
|
|
92
|
+
</Select>
|
|
93
|
+
</FormControl>
|
|
94
|
+
);
|
|
96
95
|
};
|
|
97
96
|
|
|
98
97
|
const getStyles = (theme: Theme) => ({
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
98
|
+
inputClearButton: {
|
|
99
|
+
position: "absolute",
|
|
100
|
+
right: theme.spacing(3),
|
|
101
|
+
},
|
|
102
|
+
chipSelect: {
|
|
103
|
+
display: "flex",
|
|
104
|
+
flexWrap: "wrap",
|
|
105
|
+
gap: theme.spacing(1),
|
|
106
|
+
marginRight: theme.spacing(1),
|
|
107
|
+
},
|
|
108
|
+
select: {
|
|
109
|
+
"& .MuiSelect-select": {
|
|
110
|
+
padding: theme.spacing(1),
|
|
111
|
+
minHeight: theme.spacing(3),
|
|
112
|
+
},
|
|
113
|
+
},
|
|
115
114
|
});
|
|
116
115
|
|
|
117
116
|
export default MultiSelectFilterComponent;
|
|
@@ -1,82 +1,85 @@
|
|
|
1
|
+
import { useTranslations } from "next-intl";
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
Typography,
|
|
4
|
+
IconButton,
|
|
5
|
+
InputAdornment,
|
|
6
|
+
Select,
|
|
7
|
+
MenuItem,
|
|
8
|
+
Theme,
|
|
9
|
+
useTheme,
|
|
10
|
+
FormControl,
|
|
10
11
|
} from "@mui/material";
|
|
11
12
|
import { CloseOutlined } from "@mui/icons-material";
|
|
12
13
|
import React, { useState } from "react";
|
|
13
14
|
import { FilterOption, SelectFilter, FilterProps } from "./list-filter-types";
|
|
14
15
|
|
|
15
16
|
const SelectFilterComponent: React.FC<FilterProps<SelectFilter>> = ({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
current,
|
|
17
|
+
filter,
|
|
18
|
+
onSet,
|
|
19
|
+
current,
|
|
20
20
|
}) => {
|
|
21
|
-
|
|
22
|
-
const styles = getStyles(theme);
|
|
21
|
+
const t = useTranslations("Integrate");
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
const styles = getStyles(theme);
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
(dictionary, option) => ({
|
|
28
|
-
...dictionary,
|
|
29
|
-
[option.id]: option,
|
|
30
|
-
}),
|
|
31
|
-
{},
|
|
32
|
-
) as { [id: string | number]: FilterOption };
|
|
26
|
+
const [value, setValue] = useState(current);
|
|
33
27
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
const mappedOptionDictionary = filter.options.reduce(
|
|
29
|
+
(dictionary, option) => ({
|
|
30
|
+
...dictionary,
|
|
31
|
+
[option.id]: option,
|
|
32
|
+
}),
|
|
33
|
+
{},
|
|
34
|
+
) as { [id: string | number]: FilterOption };
|
|
39
35
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
36
|
+
const updateValue = (optionId: string | number | null) => {
|
|
37
|
+
const newValue =
|
|
38
|
+
optionId !== null ? mappedOptionDictionary[optionId] : null;
|
|
39
|
+
setValue(newValue && [newValue]);
|
|
40
|
+
onSet(newValue && [newValue]);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<FormControl>
|
|
45
|
+
<Typography>{t(filter.label)}</Typography>
|
|
46
|
+
<Select
|
|
47
|
+
value={value?.[0]?.id || ""}
|
|
48
|
+
onChange={(e) => updateValue(e.target.value)}
|
|
49
|
+
endAdornment={
|
|
50
|
+
value ? (
|
|
51
|
+
<InputAdornment sx={styles.inputClearButton} position="end">
|
|
52
|
+
<IconButton
|
|
53
|
+
onClick={() => {
|
|
54
|
+
updateValue(null);
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
<CloseOutlined></CloseOutlined>
|
|
58
|
+
</IconButton>
|
|
59
|
+
</InputAdornment>
|
|
60
|
+
) : (
|
|
61
|
+
""
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
renderValue={(selected) =>
|
|
65
|
+
selected && mappedOptionDictionary[selected]?.value
|
|
66
|
+
}
|
|
67
|
+
>
|
|
68
|
+
{filter.options.map((option) => (
|
|
69
|
+
<MenuItem key={option.id} value={option.id}>
|
|
70
|
+
{option.value}
|
|
71
|
+
</MenuItem>
|
|
72
|
+
))}
|
|
73
|
+
</Select>
|
|
74
|
+
</FormControl>
|
|
75
|
+
);
|
|
73
76
|
};
|
|
74
77
|
|
|
75
78
|
const getStyles = (theme: Theme) => ({
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
inputClearButton: {
|
|
80
|
+
position: "absolute",
|
|
81
|
+
right: theme.spacing(3),
|
|
82
|
+
},
|
|
80
83
|
});
|
|
81
84
|
|
|
82
85
|
export default SelectFilterComponent;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { useTranslations } from "next-intl";
|
|
2
|
+
// MUI
|
|
3
|
+
import { Theme, useTheme } from "@mui/material";
|
|
4
|
+
import { Typography, Box, Stack, ButtonBase } from "@mui/material";
|
|
5
|
+
|
|
6
|
+
// Types
|
|
7
|
+
import { IsDay } from "./scheduler-types";
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
days: IsDay;
|
|
11
|
+
setDays: (newDays: IsDay) => void;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const DaySelector: React.FC<Props> = (props: Props) => {
|
|
16
|
+
const t = useTranslations("Integrate.Scheduler.DaySelector");
|
|
17
|
+
|
|
18
|
+
const theme = useTheme();
|
|
19
|
+
const styles = getStyles(theme);
|
|
20
|
+
|
|
21
|
+
const handleClick = (field: keyof IsDay) => {
|
|
22
|
+
if (!props.disabled) {
|
|
23
|
+
const newDays = { ...props.days };
|
|
24
|
+
newDays[field] = !newDays[field];
|
|
25
|
+
props.setDays(newDays);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Stack spacing={1} direction="row" sx={styles.days}>
|
|
31
|
+
<ButtonBase
|
|
32
|
+
centerRipple
|
|
33
|
+
onClick={() => handleClick("isMonday")}
|
|
34
|
+
disableRipple={props.disabled}
|
|
35
|
+
>
|
|
36
|
+
<Box
|
|
37
|
+
sx={getDayStyle(styles, props.days.isMonday)}
|
|
38
|
+
alignContent="center"
|
|
39
|
+
textAlign="center"
|
|
40
|
+
>
|
|
41
|
+
<Typography variant="body1" sx={styles.dayInitial}>
|
|
42
|
+
{t("mondaySelector")}
|
|
43
|
+
</Typography>
|
|
44
|
+
</Box>
|
|
45
|
+
</ButtonBase>
|
|
46
|
+
<ButtonBase
|
|
47
|
+
centerRipple
|
|
48
|
+
onClick={() => handleClick("isTuesday")}
|
|
49
|
+
disableRipple={props.disabled}
|
|
50
|
+
>
|
|
51
|
+
<Box
|
|
52
|
+
sx={getDayStyle(styles, props.days.isTuesday)}
|
|
53
|
+
alignContent="center"
|
|
54
|
+
textAlign="center"
|
|
55
|
+
>
|
|
56
|
+
<Typography variant="body1" sx={styles.dayInitial}>
|
|
57
|
+
{t("tuesdaySelector")}
|
|
58
|
+
</Typography>
|
|
59
|
+
</Box>
|
|
60
|
+
</ButtonBase>
|
|
61
|
+
<ButtonBase
|
|
62
|
+
centerRipple
|
|
63
|
+
onClick={() => handleClick("isWednesday")}
|
|
64
|
+
disableRipple={props.disabled}
|
|
65
|
+
>
|
|
66
|
+
<Box
|
|
67
|
+
sx={getDayStyle(styles, props.days.isWednesday)}
|
|
68
|
+
alignContent="center"
|
|
69
|
+
textAlign="center"
|
|
70
|
+
>
|
|
71
|
+
<Typography variant="body1" sx={styles.dayInitial}>
|
|
72
|
+
{t("wednesdaySelector")}
|
|
73
|
+
</Typography>
|
|
74
|
+
</Box>
|
|
75
|
+
</ButtonBase>
|
|
76
|
+
<ButtonBase
|
|
77
|
+
centerRipple
|
|
78
|
+
onClick={() => handleClick("isThursday")}
|
|
79
|
+
disableRipple={props.disabled}
|
|
80
|
+
>
|
|
81
|
+
<Box
|
|
82
|
+
sx={getDayStyle(styles, props.days.isThursday)}
|
|
83
|
+
alignContent="center"
|
|
84
|
+
textAlign="center"
|
|
85
|
+
>
|
|
86
|
+
<Typography variant="body1" sx={styles.dayInitial}>
|
|
87
|
+
{t("thursdaySelector")}
|
|
88
|
+
</Typography>
|
|
89
|
+
</Box>
|
|
90
|
+
</ButtonBase>
|
|
91
|
+
<ButtonBase
|
|
92
|
+
centerRipple
|
|
93
|
+
onClick={() => handleClick("isFriday")}
|
|
94
|
+
disableRipple={props.disabled}
|
|
95
|
+
>
|
|
96
|
+
<Box
|
|
97
|
+
sx={getDayStyle(styles, props.days.isFriday)}
|
|
98
|
+
alignContent="center"
|
|
99
|
+
textAlign="center"
|
|
100
|
+
>
|
|
101
|
+
<Typography variant="body1" sx={styles.dayInitial}>
|
|
102
|
+
{t("fridaySelector")}
|
|
103
|
+
</Typography>
|
|
104
|
+
</Box>
|
|
105
|
+
</ButtonBase>
|
|
106
|
+
<ButtonBase
|
|
107
|
+
centerRipple
|
|
108
|
+
onClick={() => handleClick("isSaturday")}
|
|
109
|
+
disableRipple={props.disabled}
|
|
110
|
+
>
|
|
111
|
+
<Box
|
|
112
|
+
sx={getDayStyle(styles, props.days.isSaturday)}
|
|
113
|
+
alignContent="center"
|
|
114
|
+
textAlign="center"
|
|
115
|
+
>
|
|
116
|
+
<Typography variant="body1" sx={styles.dayInitial}>
|
|
117
|
+
{t("saturdaySelector")}
|
|
118
|
+
</Typography>
|
|
119
|
+
</Box>
|
|
120
|
+
</ButtonBase>
|
|
121
|
+
<ButtonBase
|
|
122
|
+
centerRipple
|
|
123
|
+
onClick={() => handleClick("isSunday")}
|
|
124
|
+
disableRipple={props.disabled}
|
|
125
|
+
>
|
|
126
|
+
<Box
|
|
127
|
+
sx={getDayStyle(styles, props.days.isSunday)}
|
|
128
|
+
alignContent="center"
|
|
129
|
+
textAlign="center"
|
|
130
|
+
>
|
|
131
|
+
<Typography variant="body1" sx={styles.dayInitial}>
|
|
132
|
+
{t("sundaySelector")}
|
|
133
|
+
</Typography>
|
|
134
|
+
</Box>
|
|
135
|
+
</ButtonBase>
|
|
136
|
+
</Stack>
|
|
137
|
+
);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const getStyles = (theme: Theme) => {
|
|
141
|
+
return {
|
|
142
|
+
days: {
|
|
143
|
+
marginTop: theme.spacing(0),
|
|
144
|
+
},
|
|
145
|
+
dayOfWeek: {
|
|
146
|
+
color: "grey.700",
|
|
147
|
+
border: "solid " + theme.palette.grey[500] + " " + theme.spacing(0.5),
|
|
148
|
+
backgroundColor: theme.palette.grey[50],
|
|
149
|
+
borderRadius: "50%",
|
|
150
|
+
width: theme.spacing(5),
|
|
151
|
+
height: theme.spacing(5),
|
|
152
|
+
"&:hover": {
|
|
153
|
+
cursor: "pointer",
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
dayOfWeekSelected: {
|
|
157
|
+
borderColor: "info.main",
|
|
158
|
+
color: "info.main",
|
|
159
|
+
backgroundColor: "info.100",
|
|
160
|
+
},
|
|
161
|
+
dayInitial: {
|
|
162
|
+
fontWeight: "bold",
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const getDayStyle = (styles: any, selected: boolean) => {
|
|
168
|
+
if (selected) {
|
|
169
|
+
return { ...styles.dayOfWeek, ...styles.dayOfWeekSelected };
|
|
170
|
+
}
|
|
171
|
+
return styles.dayOfWeek;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export default DaySelector;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useTranslations } from "next-intl";
|
|
3
|
+
|
|
4
|
+
import { styled } from "@mui/material/styles";
|
|
5
|
+
import { Box, Typography, SxProps } from "@mui/material";
|
|
6
|
+
|
|
7
|
+
import { DayString } from "./scheduler-types";
|
|
8
|
+
|
|
9
|
+
// Styled components
|
|
10
|
+
const StyledTagBox = styled(Box)(({ theme }) => ({
|
|
11
|
+
padding: theme.spacing(0, 1.5),
|
|
12
|
+
border: "solid 1px",
|
|
13
|
+
borderRadius: 4,
|
|
14
|
+
alignContent: "center",
|
|
15
|
+
maxWidth: "fit-content",
|
|
16
|
+
}));
|
|
17
|
+
const StyledTag = styled(Typography)(() => ({
|
|
18
|
+
fontWeight: "bold",
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
interface Props {
|
|
22
|
+
day: DayString;
|
|
23
|
+
sx?: SxProps;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const DayTag: React.FC<Props> = (props: Props) => {
|
|
27
|
+
const t = useTranslations("Integrate");
|
|
28
|
+
|
|
29
|
+
if (props.day === "disabled") {
|
|
30
|
+
return (
|
|
31
|
+
<StyledTagBox
|
|
32
|
+
sx={{
|
|
33
|
+
backgroundColor: "grey.300",
|
|
34
|
+
borderColor: "grey.600",
|
|
35
|
+
color: "grey.600",
|
|
36
|
+
...props.sx,
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
<StyledTag color="grey" variant="caption">
|
|
40
|
+
{t("Scheduler.disabled")}
|
|
41
|
+
</StyledTag>
|
|
42
|
+
</StyledTagBox>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return props.day === "everyday" ? (
|
|
47
|
+
<StyledTagBox
|
|
48
|
+
sx={{
|
|
49
|
+
backgroundColor: "success.100",
|
|
50
|
+
borderColor: "success.main",
|
|
51
|
+
...props.sx,
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
<StyledTag color="success" variant="caption">
|
|
55
|
+
{t("Scheduler.everyday")}
|
|
56
|
+
</StyledTag>
|
|
57
|
+
</StyledTagBox>
|
|
58
|
+
) : (
|
|
59
|
+
<StyledTagBox
|
|
60
|
+
sx={{
|
|
61
|
+
backgroundColor: "info.100",
|
|
62
|
+
borderColor: "info.main",
|
|
63
|
+
...props.sx,
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
<StyledTag color="info" variant="caption">
|
|
67
|
+
{t(`Scheduler.${props.day}Short`)}
|
|
68
|
+
</StyledTag>
|
|
69
|
+
</StyledTagBox>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default DayTag;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Filters,
|
|
3
|
+
MultiSelectFilter,
|
|
4
|
+
} from "@evenicanpm/admin-integrate/components/list-filter/list-filter-types";
|
|
5
|
+
|
|
6
|
+
export interface SchedulesListFilters extends Filters {
|
|
7
|
+
multiSelectFilter: MultiSelectFilter;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const schedulesListFilters: SchedulesListFilters = {
|
|
11
|
+
multiSelectFilter: {
|
|
12
|
+
type: "multiSelect",
|
|
13
|
+
label: "Scheduler.daysOfTheWeek",
|
|
14
|
+
value: null,
|
|
15
|
+
options: [
|
|
16
|
+
{ id: "monday", value: "Scheduler.monday" },
|
|
17
|
+
{ id: "tuesday", value: "Scheduler.tuesday" },
|
|
18
|
+
{ id: "wednesday", value: "Scheduler.wednesday" },
|
|
19
|
+
{ id: "thursday", value: "Scheduler.thursday" },
|
|
20
|
+
{ id: "friday", value: "Scheduler.friday" },
|
|
21
|
+
{ id: "saturday", value: "Scheduler.saturday" },
|
|
22
|
+
{ id: "sunday", value: "Scheduler.sunday" },
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
};
|