@hedhog/admin 0.48.10 → 0.48.12
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/admin.module.d.ts.map +1 -1
- package/dist/admin.module.js +4 -1
- package/dist/admin.module.js.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +29 -0
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts.map +1 -0
- package/dist/dashboard/dashboard-core/dashboard-core.controller.js +38 -0
- package/dist/dashboard/dashboard-core/dashboard-core.controller.js.map +1 -0
- package/dist/dashboard/dashboard-core/dashboard-core.module.d.ts +3 -0
- package/dist/dashboard/dashboard-core/dashboard-core.module.d.ts.map +1 -0
- package/dist/dashboard/dashboard-core/dashboard-core.module.js +26 -0
- package/dist/dashboard/dashboard-core/dashboard-core.module.js.map +1 -0
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +29 -0
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts.map +1 -0
- package/dist/dashboard/dashboard-core/dashboard-core.service.js +33 -0
- package/dist/dashboard/dashboard-core/dashboard-core.service.js.map +1 -0
- package/dist/dashboard/dashboard.module.d.ts.map +1 -1
- package/dist/dashboard/dashboard.module.js +5 -3
- package/dist/dashboard/dashboard.module.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/setting/dto/create.dto.d.ts +9 -0
- package/dist/setting/dto/create.dto.d.ts.map +1 -0
- package/dist/setting/dto/create.dto.js +40 -0
- package/dist/setting/dto/create.dto.js.map +1 -0
- package/dist/setting/dto/delete.dto.d.ts +4 -0
- package/dist/setting/dto/delete.dto.d.ts.map +1 -0
- package/dist/setting/dto/delete.dto.js +23 -0
- package/dist/setting/dto/delete.dto.js.map +1 -0
- package/dist/setting/dto/setting-user.dto.d.ts +4 -0
- package/dist/setting/dto/setting-user.dto.d.ts.map +1 -0
- package/dist/setting/dto/setting-user.dto.js +21 -0
- package/dist/setting/dto/setting-user.dto.js.map +1 -0
- package/dist/setting/dto/setting.dto.d.ts +9 -0
- package/dist/setting/dto/setting.dto.d.ts.map +1 -0
- package/dist/setting/dto/setting.dto.js +34 -0
- package/dist/setting/dto/setting.dto.js.map +1 -0
- package/dist/setting/dto/update.dto.d.ts +6 -0
- package/dist/setting/dto/update.dto.d.ts.map +1 -0
- package/dist/setting/dto/update.dto.js +9 -0
- package/dist/setting/dto/update.dto.js.map +1 -0
- package/dist/setting/setting.controller.d.ts +102 -0
- package/dist/setting/setting.controller.d.ts.map +1 -0
- package/dist/setting/setting.controller.js +160 -0
- package/dist/setting/setting.controller.js.map +1 -0
- package/dist/setting/setting.module.d.ts +3 -0
- package/dist/setting/setting.module.d.ts.map +1 -0
- package/dist/setting/setting.module.js +31 -0
- package/dist/setting/setting.module.js.map +1 -0
- package/dist/setting/setting.service.d.ts +103 -0
- package/dist/setting/setting.service.d.ts.map +1 -0
- package/dist/setting/setting.service.js +333 -0
- package/dist/setting/setting.service.js.map +1 -0
- package/frontend/dashboard/components/create-panel.tsx.ejs +63 -63
- package/frontend/dashboard/components/dashboard.screen.tsx.ejs +116 -116
- package/frontend/dashboard/components/update-panel.tsx.ejs +80 -80
- package/frontend/dashboard/locales/en/dashboard.dashboard.json +11 -11
- package/frontend/dashboard/locales/pt/dashboard.dashboard.json +11 -11
- package/frontend/dashboard/react-query/handlers.ts.ejs +28 -28
- package/frontend/dashboard/react-query/requests.ts.ejs +56 -56
- package/frontend/dashboard-component/components/create-panel.tsx.ejs +130 -130
- package/frontend/dashboard-component/components/update-panel.tsx.ejs +164 -164
- package/frontend/dashboard-component/locales/en/dashboard.dashboard-component.json +11 -11
- package/frontend/dashboard-component/locales/pt/dashboard.dashboard-component.json +11 -11
- package/frontend/dashboard-component/react-query/handlers.ts.ejs +28 -28
- package/frontend/dashboard-component/react-query/requests.ts.ejs +61 -61
- package/frontend/dashboard-item/components/create-panel.tsx.ejs +108 -108
- package/frontend/dashboard-item/components/update-panel.tsx.ejs +141 -141
- package/frontend/dashboard-item/locales/en/dashboard.dashboard-item.json +11 -11
- package/frontend/dashboard-item/locales/pt/dashboard.dashboard-item.json +11 -11
- package/frontend/dashboard-item/react-query/handlers.ts.ejs +28 -28
- package/frontend/dashboard-item/react-query/requests.ts.ejs +58 -58
- package/frontend/dashboard-user/components/create-panel.tsx.ejs +108 -108
- package/frontend/dashboard-user/components/update-panel.tsx.ejs +137 -137
- package/frontend/dashboard-user/locales/en/dashboard.dashboard-user.json +11 -11
- package/frontend/dashboard-user/locales/pt/dashboard.dashboard-user.json +11 -11
- package/frontend/dashboard-user/react-query/handlers.ts.ejs +28 -28
- package/frontend/dashboard-user/react-query/requests.ts.ejs +58 -58
- package/hedhog/tables/dashboard.yaml +9 -0
- package/hedhog/tables/dashboard_component.yaml +34 -0
- package/hedhog/tables/dashboard_component_locale.yaml +24 -0
- package/hedhog/tables/dashboard_item.yaml +25 -0
- package/hedhog/tables/dashboard_locale.yaml +24 -0
- package/hedhog/tables/dashboard_user.yaml +25 -0
- package/hedhog/tables/menu.yaml +18 -0
- package/hedhog/tables/menu_locale.yaml +19 -0
- package/hedhog/tables/menu_screen.yaml +16 -0
- package/hedhog/tables/multifactor.yaml +6 -0
- package/hedhog/tables/multifactor_locale.yaml +19 -0
- package/hedhog/tables/role.yaml +6 -0
- package/hedhog/tables/role_locale.yaml +20 -0
- package/hedhog/tables/role_menu.yaml +18 -0
- package/hedhog/tables/role_route.yaml +18 -0
- package/hedhog/tables/role_screen.yaml +18 -0
- package/hedhog/tables/role_user.yaml +18 -0
- package/hedhog/tables/route.yaml +23 -0
- package/hedhog/tables/route_screen.yaml +18 -0
- package/hedhog/tables/screen.yaml +8 -0
- package/hedhog/tables/screen_locale.yaml +20 -0
- package/hedhog/tables/setting.yaml +27 -0
- package/hedhog/tables/setting_group.yaml +8 -0
- package/hedhog/tables/setting_group_locale.yaml +23 -0
- package/hedhog/tables/setting_locale.yaml +24 -0
- package/hedhog/tables/setting_user.yaml +21 -0
- package/hedhog/tables/translation.yaml +25 -0
- package/hedhog/tables/translation_namespace.yaml +6 -0
- package/hedhog/tables/user.yaml +18 -0
- package/hedhog/tables/user_activity.yaml +14 -0
- package/hedhog.yaml +142 -473
- package/isabelli.json +0 -0
- package/isabelli.xml +0 -0
- package/isabelli.yaml +0 -0
- package/package.json +1 -1
- package/src/admin.module.ts +4 -1
- package/src/dashboard/dashboard-component/dashboard-component.controller.ts +55 -55
- package/src/dashboard/dashboard-component/dto/create.dto.ts +36 -36
- package/src/dashboard/dashboard-component/dto/update.dto.ts +4 -4
- package/src/dashboard/dashboard-core/dashboard-core.controller.ts +12 -0
- package/src/dashboard/dashboard-core/dashboard-core.module.ts +14 -0
- package/src/dashboard/dashboard-core/dashboard-core.service.ts +16 -0
- package/src/dashboard/dashboard-item/dto/update.dto.ts +4 -4
- package/src/dashboard/dashboard-user/dto/update.dto.ts +4 -4
- package/src/dashboard/dashboard.module.ts +5 -3
- package/src/dashboard/index.ts +1 -1
- package/src/index.ts +2 -0
- package/src/setting/dto/create.dto.ts +21 -0
- package/src/setting/dto/delete.dto.ts +8 -0
- package/src/setting/dto/setting-user.dto.ts +6 -0
- package/src/setting/dto/setting.dto.ts +17 -0
- package/src/setting/dto/update.dto.ts +4 -0
- package/src/setting/setting.controller.ts +105 -0
- package/src/setting/setting.module.ts +18 -0
- package/src/setting/setting.service.ts +400 -0
@@ -1,58 +1,58 @@
|
|
1
|
-
import { useApp } from "@/hooks/use-app";
|
2
|
-
import { Delete, PaginationParams, PaginationResult } from "@/types";
|
3
|
-
import { DashboardItem } from "@/types/models";
|
4
|
-
import { HttpMethod } from "@/types/http-method";
|
5
|
-
|
6
|
-
export function requests() {
|
7
|
-
const { request } = useApp();
|
8
|
-
|
9
|
-
const dashboardItemList = async (params: PaginationParams) => {
|
10
|
-
return request<PaginationResult<DashboardItem>>({
|
11
|
-
url: "/dashboard-item",
|
12
|
-
params,
|
13
|
-
}).then((res) => res.data);
|
14
|
-
};
|
15
|
-
|
16
|
-
const dashboardItemGet = async (id: number) => {
|
17
|
-
return request<DashboardItem>({
|
18
|
-
url: `/dashboard-item/${id}`,
|
19
|
-
}).then((res) => res.data);
|
20
|
-
};
|
21
|
-
|
22
|
-
const dashboardItemCreate = async (params: { data: DashboardItem }) => {
|
23
|
-
const { data } = params;
|
24
|
-
return request<DashboardItem>({
|
25
|
-
url: "/dashboard-item",
|
26
|
-
method: HttpMethod.POST,
|
27
|
-
data: data,
|
28
|
-
}).then((res) => res.data);
|
29
|
-
};
|
30
|
-
|
31
|
-
const dashboardItemDelete = async (ids: number[]) => {
|
32
|
-
return request<Delete>({
|
33
|
-
url: "/dashboard-item",
|
34
|
-
data: { ids },
|
35
|
-
method: HttpMethod.DELETE,
|
36
|
-
}).then((res) => res.data);
|
37
|
-
};
|
38
|
-
|
39
|
-
const dashboardItemUpdate = async (params: {
|
40
|
-
id: number;
|
41
|
-
data: DashboardItem;
|
42
|
-
}) => {
|
43
|
-
const { id, data } = params;
|
44
|
-
return request<DashboardItem>({
|
45
|
-
url: `/dashboard-item/${id}`,
|
46
|
-
method: HttpMethod.PATCH,
|
47
|
-
data: data,
|
48
|
-
}).then((res) => res.data);
|
49
|
-
};
|
50
|
-
|
51
|
-
return {
|
52
|
-
dashboardItemCreate,
|
53
|
-
dashboardItemUpdate,
|
54
|
-
dashboardItemDelete,
|
55
|
-
dashboardItemList,
|
56
|
-
dashboardItemGet,
|
57
|
-
};
|
58
|
-
}
|
1
|
+
import { useApp } from "@/hooks/use-app";
|
2
|
+
import { Delete, PaginationParams, PaginationResult } from "@/types";
|
3
|
+
import { DashboardItem } from "@/types/models";
|
4
|
+
import { HttpMethod } from "@/types/http-method";
|
5
|
+
|
6
|
+
export function requests() {
|
7
|
+
const { request } = useApp();
|
8
|
+
|
9
|
+
const dashboardItemList = async (params: PaginationParams) => {
|
10
|
+
return request<PaginationResult<DashboardItem>>({
|
11
|
+
url: "/dashboard-item",
|
12
|
+
params,
|
13
|
+
}).then((res) => res.data);
|
14
|
+
};
|
15
|
+
|
16
|
+
const dashboardItemGet = async (id: number) => {
|
17
|
+
return request<DashboardItem>({
|
18
|
+
url: `/dashboard-item/${id}`,
|
19
|
+
}).then((res) => res.data);
|
20
|
+
};
|
21
|
+
|
22
|
+
const dashboardItemCreate = async (params: { data: DashboardItem }) => {
|
23
|
+
const { data } = params;
|
24
|
+
return request<DashboardItem>({
|
25
|
+
url: "/dashboard-item",
|
26
|
+
method: HttpMethod.POST,
|
27
|
+
data: data,
|
28
|
+
}).then((res) => res.data);
|
29
|
+
};
|
30
|
+
|
31
|
+
const dashboardItemDelete = async (ids: number[]) => {
|
32
|
+
return request<Delete>({
|
33
|
+
url: "/dashboard-item",
|
34
|
+
data: { ids },
|
35
|
+
method: HttpMethod.DELETE,
|
36
|
+
}).then((res) => res.data);
|
37
|
+
};
|
38
|
+
|
39
|
+
const dashboardItemUpdate = async (params: {
|
40
|
+
id: number;
|
41
|
+
data: DashboardItem;
|
42
|
+
}) => {
|
43
|
+
const { id, data } = params;
|
44
|
+
return request<DashboardItem>({
|
45
|
+
url: `/dashboard-item/${id}`,
|
46
|
+
method: HttpMethod.PATCH,
|
47
|
+
data: data,
|
48
|
+
}).then((res) => res.data);
|
49
|
+
};
|
50
|
+
|
51
|
+
return {
|
52
|
+
dashboardItemCreate,
|
53
|
+
dashboardItemUpdate,
|
54
|
+
dashboardItemDelete,
|
55
|
+
dashboardItemList,
|
56
|
+
dashboardItemGet,
|
57
|
+
};
|
58
|
+
}
|
@@ -1,108 +1,108 @@
|
|
1
|
-
import FormPanel, { FormPanelRef } from '@/components/panels/form-panel'
|
2
|
-
import { EnumFieldType } from '@/enums/EnumFieldType'
|
3
|
-
import { useDashboardUserCreate } from '@/features/admin/dashboard-user'
|
4
|
-
import { DashboardUser } from '@/types/models'
|
5
|
-
import { forwardRef, useImperativeHandle, useRef } from 'react'
|
6
|
-
import { useTranslation } from 'react-i18next'
|
7
|
-
|
8
|
-
export type DashboardUserCreatePanelRef = {
|
9
|
-
submit: () => void
|
10
|
-
}
|
11
|
-
|
12
|
-
export type DashboardUserCreatePanelProps = {
|
13
|
-
onCreated?: (data: DashboardUser) => void
|
14
|
-
}
|
15
|
-
|
16
|
-
const DashboardUserCreatePanel = forwardRef(
|
17
|
-
({ onCreated }: DashboardUserCreatePanelProps, ref) => {
|
18
|
-
const formRef = useRef<FormPanelRef>(null)
|
19
|
-
const { t } = useTranslation(['actions', 'fields', 'translations'])
|
20
|
-
const { mutateAsync: createDashboardUser } = useDashboardUserCreate()
|
21
|
-
|
22
|
-
useImperativeHandle(
|
23
|
-
ref,
|
24
|
-
() => ({
|
25
|
-
submit: () => {
|
26
|
-
formRef.current?.submit()
|
27
|
-
},
|
28
|
-
}),
|
29
|
-
[formRef]
|
30
|
-
)
|
31
|
-
|
32
|
-
return (
|
33
|
-
<FormPanel
|
34
|
-
ref={formRef}
|
35
|
-
fields={[
|
36
|
-
{
|
37
|
-
name: 'item_id',
|
38
|
-
label: { text: t('dashboard-user.item_id', { ns: 'fields' }) },
|
39
|
-
type: EnumFieldType.COMBOBOX,
|
40
|
-
required: true,
|
41
|
-
url: '/dashboard-item',
|
42
|
-
displayName: 'item',
|
43
|
-
valueName: 'id',
|
44
|
-
},
|
45
|
-
|
46
|
-
{
|
47
|
-
name: 'user_id',
|
48
|
-
label: { text: t('dashboard-user.user_id', { ns: 'fields' }) },
|
49
|
-
type: EnumFieldType.COMBOBOX,
|
50
|
-
required: true,
|
51
|
-
url: '/user',
|
52
|
-
displayName: 'user',
|
53
|
-
valueName: 'id',
|
54
|
-
},
|
55
|
-
|
56
|
-
{
|
57
|
-
name: 'width',
|
58
|
-
label: { text: t('dashboard-user.width', { ns: 'fields' }) },
|
59
|
-
type: EnumFieldType.NUMBER,
|
60
|
-
required: true,
|
61
|
-
},
|
62
|
-
|
63
|
-
{
|
64
|
-
name: 'height',
|
65
|
-
label: { text: t('dashboard-user.height', { ns: 'fields' }) },
|
66
|
-
type: EnumFieldType.NUMBER,
|
67
|
-
required: true,
|
68
|
-
},
|
69
|
-
|
70
|
-
{
|
71
|
-
name: 'x_axis',
|
72
|
-
label: { text: t('dashboard-user.x_axis', { ns: 'fields' }) },
|
73
|
-
type: EnumFieldType.NUMBER,
|
74
|
-
required: true,
|
75
|
-
},
|
76
|
-
|
77
|
-
{
|
78
|
-
name: 'y_axis',
|
79
|
-
label: { text: t('dashboard-user.y_axis', { ns: 'fields' }) },
|
80
|
-
type: EnumFieldType.NUMBER,
|
81
|
-
required: true,
|
82
|
-
},
|
83
|
-
]}
|
84
|
-
button={{ text: t('create', { ns: 'actions' }) }}
|
85
|
-
onSubmit={async (data) => {
|
86
|
-
const createdData = await createDashboardUser({
|
87
|
-
data: {
|
88
|
-
...data,
|
89
|
-
item_id: Number(data.item_id),
|
90
|
-
user_id: Number(data.user_id),
|
91
|
-
width: Number(data.width),
|
92
|
-
height: Number(data.height),
|
93
|
-
x_axis: Number(data.x_axis),
|
94
|
-
y_axis: Number(data.y_axis),
|
95
|
-
},
|
96
|
-
})
|
97
|
-
if (typeof onCreated === 'function') {
|
98
|
-
onCreated(createdData as any)
|
99
|
-
}
|
100
|
-
}}
|
101
|
-
/>
|
102
|
-
)
|
103
|
-
}
|
104
|
-
)
|
105
|
-
|
106
|
-
DashboardUserCreatePanel.displayName = 'DashboardUserCreatePanel'
|
107
|
-
|
108
|
-
export default DashboardUserCreatePanel
|
1
|
+
import FormPanel, { FormPanelRef } from '@/components/panels/form-panel'
|
2
|
+
import { EnumFieldType } from '@/enums/EnumFieldType'
|
3
|
+
import { useDashboardUserCreate } from '@/features/admin/dashboard-user'
|
4
|
+
import { DashboardUser } from '@/types/models'
|
5
|
+
import { forwardRef, useImperativeHandle, useRef } from 'react'
|
6
|
+
import { useTranslation } from 'react-i18next'
|
7
|
+
|
8
|
+
export type DashboardUserCreatePanelRef = {
|
9
|
+
submit: () => void
|
10
|
+
}
|
11
|
+
|
12
|
+
export type DashboardUserCreatePanelProps = {
|
13
|
+
onCreated?: (data: DashboardUser) => void
|
14
|
+
}
|
15
|
+
|
16
|
+
const DashboardUserCreatePanel = forwardRef(
|
17
|
+
({ onCreated }: DashboardUserCreatePanelProps, ref) => {
|
18
|
+
const formRef = useRef<FormPanelRef>(null)
|
19
|
+
const { t } = useTranslation(['actions', 'fields', 'translations'])
|
20
|
+
const { mutateAsync: createDashboardUser } = useDashboardUserCreate()
|
21
|
+
|
22
|
+
useImperativeHandle(
|
23
|
+
ref,
|
24
|
+
() => ({
|
25
|
+
submit: () => {
|
26
|
+
formRef.current?.submit()
|
27
|
+
},
|
28
|
+
}),
|
29
|
+
[formRef]
|
30
|
+
)
|
31
|
+
|
32
|
+
return (
|
33
|
+
<FormPanel
|
34
|
+
ref={formRef}
|
35
|
+
fields={[
|
36
|
+
{
|
37
|
+
name: 'item_id',
|
38
|
+
label: { text: t('dashboard-user.item_id', { ns: 'fields' }) },
|
39
|
+
type: EnumFieldType.COMBOBOX,
|
40
|
+
required: true,
|
41
|
+
url: '/dashboard-item',
|
42
|
+
displayName: 'item',
|
43
|
+
valueName: 'id',
|
44
|
+
},
|
45
|
+
|
46
|
+
{
|
47
|
+
name: 'user_id',
|
48
|
+
label: { text: t('dashboard-user.user_id', { ns: 'fields' }) },
|
49
|
+
type: EnumFieldType.COMBOBOX,
|
50
|
+
required: true,
|
51
|
+
url: '/user',
|
52
|
+
displayName: 'user',
|
53
|
+
valueName: 'id',
|
54
|
+
},
|
55
|
+
|
56
|
+
{
|
57
|
+
name: 'width',
|
58
|
+
label: { text: t('dashboard-user.width', { ns: 'fields' }) },
|
59
|
+
type: EnumFieldType.NUMBER,
|
60
|
+
required: true,
|
61
|
+
},
|
62
|
+
|
63
|
+
{
|
64
|
+
name: 'height',
|
65
|
+
label: { text: t('dashboard-user.height', { ns: 'fields' }) },
|
66
|
+
type: EnumFieldType.NUMBER,
|
67
|
+
required: true,
|
68
|
+
},
|
69
|
+
|
70
|
+
{
|
71
|
+
name: 'x_axis',
|
72
|
+
label: { text: t('dashboard-user.x_axis', { ns: 'fields' }) },
|
73
|
+
type: EnumFieldType.NUMBER,
|
74
|
+
required: true,
|
75
|
+
},
|
76
|
+
|
77
|
+
{
|
78
|
+
name: 'y_axis',
|
79
|
+
label: { text: t('dashboard-user.y_axis', { ns: 'fields' }) },
|
80
|
+
type: EnumFieldType.NUMBER,
|
81
|
+
required: true,
|
82
|
+
},
|
83
|
+
]}
|
84
|
+
button={{ text: t('create', { ns: 'actions' }) }}
|
85
|
+
onSubmit={async (data) => {
|
86
|
+
const createdData = await createDashboardUser({
|
87
|
+
data: {
|
88
|
+
...data,
|
89
|
+
item_id: Number(data.item_id),
|
90
|
+
user_id: Number(data.user_id),
|
91
|
+
width: Number(data.width),
|
92
|
+
height: Number(data.height),
|
93
|
+
x_axis: Number(data.x_axis),
|
94
|
+
y_axis: Number(data.y_axis),
|
95
|
+
},
|
96
|
+
})
|
97
|
+
if (typeof onCreated === 'function') {
|
98
|
+
onCreated(createdData as any)
|
99
|
+
}
|
100
|
+
}}
|
101
|
+
/>
|
102
|
+
)
|
103
|
+
}
|
104
|
+
)
|
105
|
+
|
106
|
+
DashboardUserCreatePanel.displayName = 'DashboardUserCreatePanel'
|
107
|
+
|
108
|
+
export default DashboardUserCreatePanel
|
@@ -1,138 +1,138 @@
|
|
1
|
-
import FormPanel, { FormPanelRef } from '@/components/panels/form-panel'
|
2
|
-
import { Overlay } from '@/components/custom/overlay'
|
3
|
-
import { TabPanel } from '@/components/panels/tab-panel'
|
4
|
-
import {
|
5
|
-
useDashboardUserGet,
|
6
|
-
useDashboardUserUpdate,
|
7
|
-
} from '@/features/admin/dashboard-user'
|
8
|
-
import useEffectAfterFirstUpdate from '@/hooks/use-effect-after-first-update'
|
9
|
-
import { DashboardUser } from '@/types/models'
|
10
|
-
import { forwardRef, useImperativeHandle, useRef } from 'react'
|
11
|
-
import { useTranslation } from 'react-i18next'
|
12
|
-
import { EnumFieldType } from '@/enums/EnumFieldType'
|
13
|
-
|
14
|
-
export type DashboardUserUpdatePanelProps = {
|
15
|
-
data: DashboardUser
|
16
|
-
onUpdated?: (data: DashboardUser) => void
|
17
|
-
}
|
18
|
-
|
19
|
-
const DashboardUserUpdatePanel = forwardRef(
|
20
|
-
({ data, onUpdated }: DashboardUserUpdatePanelProps, ref) => {
|
21
|
-
const { t } = useTranslation(['actions', 'fields', 'translations'])
|
22
|
-
const { data: item, isLoading } = useDashboardUserGet(
|
23
|
-
(data as any).id as number
|
24
|
-
)
|
25
|
-
|
26
|
-
const { mutate: dashboardUserUpdate } = useDashboardUserUpdate()
|
27
|
-
const formRef = useRef<FormPanelRef>(null)
|
28
|
-
|
29
|
-
useEffectAfterFirstUpdate(() => {
|
30
|
-
if (item && formRef.current) {
|
31
|
-
formRef.current.setValuesFromItem(item)
|
32
|
-
}
|
33
|
-
}, [item])
|
34
|
-
|
35
|
-
useImperativeHandle(ref, () => ({}))
|
36
|
-
|
37
|
-
return (
|
38
|
-
<TabPanel
|
39
|
-
activeTabIndex={0}
|
40
|
-
tabs={[
|
41
|
-
{
|
42
|
-
title: t('details', { ns: 'actions' }),
|
43
|
-
children: (
|
44
|
-
<Overlay loading={isLoading}>
|
45
|
-
<FormPanel
|
46
|
-
ref={formRef}
|
47
|
-
fields={[
|
48
|
-
{
|
49
|
-
name: 'item_id',
|
50
|
-
label: {
|
51
|
-
text: t('dashboard-user.item_id', { ns: 'fields' }),
|
52
|
-
},
|
53
|
-
type: EnumFieldType.COMBOBOX,
|
54
|
-
required: true,
|
55
|
-
url: '/dashboard-item',
|
56
|
-
displayName: 'item',
|
57
|
-
valueName: 'id',
|
58
|
-
},
|
59
|
-
|
60
|
-
{
|
61
|
-
name: 'user_id',
|
62
|
-
label: {
|
63
|
-
text: t('dashboard-user.user_id', { ns: 'fields' }),
|
64
|
-
},
|
65
|
-
type: EnumFieldType.COMBOBOX,
|
66
|
-
required: true,
|
67
|
-
url: '/user',
|
68
|
-
displayName: 'user',
|
69
|
-
valueName: 'id',
|
70
|
-
},
|
71
|
-
|
72
|
-
{
|
73
|
-
name: 'width',
|
74
|
-
label: {
|
75
|
-
text: t('dashboard-user.width', { ns: 'fields' }),
|
76
|
-
},
|
77
|
-
type: EnumFieldType.NUMBER,
|
78
|
-
required: true,
|
79
|
-
},
|
80
|
-
|
81
|
-
{
|
82
|
-
name: 'height',
|
83
|
-
label: {
|
84
|
-
text: t('dashboard-user.height', { ns: 'fields' }),
|
85
|
-
},
|
86
|
-
type: EnumFieldType.NUMBER,
|
87
|
-
required: true,
|
88
|
-
},
|
89
|
-
|
90
|
-
{
|
91
|
-
name: 'x_axis',
|
92
|
-
label: {
|
93
|
-
text: t('dashboard-user.x_axis', { ns: 'fields' }),
|
94
|
-
},
|
95
|
-
type: EnumFieldType.NUMBER,
|
96
|
-
required: true,
|
97
|
-
},
|
98
|
-
|
99
|
-
{
|
100
|
-
name: 'y_axis',
|
101
|
-
label: {
|
102
|
-
text: t('dashboard-user.y_axis', { ns: 'fields' }),
|
103
|
-
},
|
104
|
-
type: EnumFieldType.NUMBER,
|
105
|
-
required: true,
|
106
|
-
},
|
107
|
-
]}
|
108
|
-
button={{ text: t('save', { ns: 'actions' }) }}
|
109
|
-
onSubmit={(data) => {
|
110
|
-
dashboardUserUpdate({
|
111
|
-
id: data.id,
|
112
|
-
data: {
|
113
|
-
...data,
|
114
|
-
item_id: Number(data.item_id),
|
115
|
-
user_id: Number(data.user_id),
|
116
|
-
width: Number(data.width),
|
117
|
-
height: Number(data.height),
|
118
|
-
x_axis: Number(data.x_axis),
|
119
|
-
y_axis: Number(data.y_axis),
|
120
|
-
},
|
121
|
-
})
|
122
|
-
if (typeof onUpdated === 'function') {
|
123
|
-
onUpdated(data)
|
124
|
-
}
|
125
|
-
}}
|
126
|
-
/>
|
127
|
-
</Overlay>
|
128
|
-
),
|
129
|
-
},
|
130
|
-
]}
|
131
|
-
/>
|
132
|
-
)
|
133
|
-
}
|
134
|
-
)
|
135
|
-
|
136
|
-
DashboardUserUpdatePanel.displayName = 'DashboardUserUpdatePanel'
|
137
|
-
|
1
|
+
import FormPanel, { FormPanelRef } from '@/components/panels/form-panel'
|
2
|
+
import { Overlay } from '@/components/custom/overlay'
|
3
|
+
import { TabPanel } from '@/components/panels/tab-panel'
|
4
|
+
import {
|
5
|
+
useDashboardUserGet,
|
6
|
+
useDashboardUserUpdate,
|
7
|
+
} from '@/features/admin/dashboard-user'
|
8
|
+
import useEffectAfterFirstUpdate from '@/hooks/use-effect-after-first-update'
|
9
|
+
import { DashboardUser } from '@/types/models'
|
10
|
+
import { forwardRef, useImperativeHandle, useRef } from 'react'
|
11
|
+
import { useTranslation } from 'react-i18next'
|
12
|
+
import { EnumFieldType } from '@/enums/EnumFieldType'
|
13
|
+
|
14
|
+
export type DashboardUserUpdatePanelProps = {
|
15
|
+
data: DashboardUser
|
16
|
+
onUpdated?: (data: DashboardUser) => void
|
17
|
+
}
|
18
|
+
|
19
|
+
const DashboardUserUpdatePanel = forwardRef(
|
20
|
+
({ data, onUpdated }: DashboardUserUpdatePanelProps, ref) => {
|
21
|
+
const { t } = useTranslation(['actions', 'fields', 'translations'])
|
22
|
+
const { data: item, isLoading } = useDashboardUserGet(
|
23
|
+
(data as any).id as number
|
24
|
+
)
|
25
|
+
|
26
|
+
const { mutate: dashboardUserUpdate } = useDashboardUserUpdate()
|
27
|
+
const formRef = useRef<FormPanelRef>(null)
|
28
|
+
|
29
|
+
useEffectAfterFirstUpdate(() => {
|
30
|
+
if (item && formRef.current) {
|
31
|
+
formRef.current.setValuesFromItem(item)
|
32
|
+
}
|
33
|
+
}, [item])
|
34
|
+
|
35
|
+
useImperativeHandle(ref, () => ({}))
|
36
|
+
|
37
|
+
return (
|
38
|
+
<TabPanel
|
39
|
+
activeTabIndex={0}
|
40
|
+
tabs={[
|
41
|
+
{
|
42
|
+
title: t('details', { ns: 'actions' }),
|
43
|
+
children: (
|
44
|
+
<Overlay loading={isLoading}>
|
45
|
+
<FormPanel
|
46
|
+
ref={formRef}
|
47
|
+
fields={[
|
48
|
+
{
|
49
|
+
name: 'item_id',
|
50
|
+
label: {
|
51
|
+
text: t('dashboard-user.item_id', { ns: 'fields' }),
|
52
|
+
},
|
53
|
+
type: EnumFieldType.COMBOBOX,
|
54
|
+
required: true,
|
55
|
+
url: '/dashboard-item',
|
56
|
+
displayName: 'item',
|
57
|
+
valueName: 'id',
|
58
|
+
},
|
59
|
+
|
60
|
+
{
|
61
|
+
name: 'user_id',
|
62
|
+
label: {
|
63
|
+
text: t('dashboard-user.user_id', { ns: 'fields' }),
|
64
|
+
},
|
65
|
+
type: EnumFieldType.COMBOBOX,
|
66
|
+
required: true,
|
67
|
+
url: '/user',
|
68
|
+
displayName: 'user',
|
69
|
+
valueName: 'id',
|
70
|
+
},
|
71
|
+
|
72
|
+
{
|
73
|
+
name: 'width',
|
74
|
+
label: {
|
75
|
+
text: t('dashboard-user.width', { ns: 'fields' }),
|
76
|
+
},
|
77
|
+
type: EnumFieldType.NUMBER,
|
78
|
+
required: true,
|
79
|
+
},
|
80
|
+
|
81
|
+
{
|
82
|
+
name: 'height',
|
83
|
+
label: {
|
84
|
+
text: t('dashboard-user.height', { ns: 'fields' }),
|
85
|
+
},
|
86
|
+
type: EnumFieldType.NUMBER,
|
87
|
+
required: true,
|
88
|
+
},
|
89
|
+
|
90
|
+
{
|
91
|
+
name: 'x_axis',
|
92
|
+
label: {
|
93
|
+
text: t('dashboard-user.x_axis', { ns: 'fields' }),
|
94
|
+
},
|
95
|
+
type: EnumFieldType.NUMBER,
|
96
|
+
required: true,
|
97
|
+
},
|
98
|
+
|
99
|
+
{
|
100
|
+
name: 'y_axis',
|
101
|
+
label: {
|
102
|
+
text: t('dashboard-user.y_axis', { ns: 'fields' }),
|
103
|
+
},
|
104
|
+
type: EnumFieldType.NUMBER,
|
105
|
+
required: true,
|
106
|
+
},
|
107
|
+
]}
|
108
|
+
button={{ text: t('save', { ns: 'actions' }) }}
|
109
|
+
onSubmit={(data) => {
|
110
|
+
dashboardUserUpdate({
|
111
|
+
id: data.id,
|
112
|
+
data: {
|
113
|
+
...data,
|
114
|
+
item_id: Number(data.item_id),
|
115
|
+
user_id: Number(data.user_id),
|
116
|
+
width: Number(data.width),
|
117
|
+
height: Number(data.height),
|
118
|
+
x_axis: Number(data.x_axis),
|
119
|
+
y_axis: Number(data.y_axis),
|
120
|
+
},
|
121
|
+
})
|
122
|
+
if (typeof onUpdated === 'function') {
|
123
|
+
onUpdated(data)
|
124
|
+
}
|
125
|
+
}}
|
126
|
+
/>
|
127
|
+
</Overlay>
|
128
|
+
),
|
129
|
+
},
|
130
|
+
]}
|
131
|
+
/>
|
132
|
+
)
|
133
|
+
}
|
134
|
+
)
|
135
|
+
|
136
|
+
DashboardUserUpdatePanel.displayName = 'DashboardUserUpdatePanel'
|
137
|
+
|
138
138
|
export default DashboardUserUpdatePanel;
|
@@ -1,11 +1,11 @@
|
|
1
|
-
{
|
2
|
-
"create": "Create dashboard user",
|
3
|
-
"createText": "Fill the dashboard user informations.",
|
4
|
-
"createTooltip": "Create new dashboard user",
|
5
|
-
"delete": "Delete dashboard user",
|
6
|
-
"deleteText": "Are you sure to delete these dashboard user?",
|
7
|
-
"deleteTooltip": "Delete the selected dashboard user",
|
8
|
-
"edit": "Edit dashboard user",
|
9
|
-
"editText": "View and edit dashboard user information.",
|
10
|
-
"editTooltip": "Edit the selected dashboard user"
|
11
|
-
}
|
1
|
+
{
|
2
|
+
"create": "Create dashboard user",
|
3
|
+
"createText": "Fill the dashboard user informations.",
|
4
|
+
"createTooltip": "Create new dashboard user",
|
5
|
+
"delete": "Delete dashboard user",
|
6
|
+
"deleteText": "Are you sure to delete these dashboard user?",
|
7
|
+
"deleteTooltip": "Delete the selected dashboard user",
|
8
|
+
"edit": "Edit dashboard user",
|
9
|
+
"editText": "View and edit dashboard user information.",
|
10
|
+
"editTooltip": "Edit the selected dashboard user"
|
11
|
+
}
|
@@ -1,11 +1,11 @@
|
|
1
|
-
{
|
2
|
-
"create": "Criar dashboard user",
|
3
|
-
"createText": "Preencha as informações do dashboard user.",
|
4
|
-
"createTooltip": "Criar novo dashboard user",
|
5
|
-
"delete": "Deletar dashboard user",
|
6
|
-
"deleteText": "Você tem certeza que deseja deletar esses dashboard user?",
|
7
|
-
"deleteTooltip": "Deletar o dashboard user selecionado",
|
8
|
-
"edit": "Editar dashboard user",
|
9
|
-
"editText": "Visualizar e editar informações do dashboard user.",
|
10
|
-
"editTooltip": "Editar o dashboard user selecionado"
|
11
|
-
}
|
1
|
+
{
|
2
|
+
"create": "Criar dashboard user",
|
3
|
+
"createText": "Preencha as informações do dashboard user.",
|
4
|
+
"createTooltip": "Criar novo dashboard user",
|
5
|
+
"delete": "Deletar dashboard user",
|
6
|
+
"deleteText": "Você tem certeza que deseja deletar esses dashboard user?",
|
7
|
+
"deleteTooltip": "Deletar o dashboard user selecionado",
|
8
|
+
"edit": "Editar dashboard user",
|
9
|
+
"editText": "Visualizar e editar informações do dashboard user.",
|
10
|
+
"editTooltip": "Editar o dashboard user selecionado"
|
11
|
+
}
|