@hedhog/admin 0.48.5 → 0.48.7
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 +2 -0
- package/dist/admin.module.js.map +1 -1
- package/dist/auth/consts/body.d.ts.map +1 -1
- package/dist/dashboard/dashboard/dashboard.controller.d.ts +22 -0
- package/dist/dashboard/dashboard/dashboard.controller.d.ts.map +1 -0
- package/dist/dashboard/dashboard/dashboard.controller.js +88 -0
- package/dist/dashboard/dashboard/dashboard.controller.js.map +1 -0
- package/dist/dashboard/dashboard/dashboard.module.d.ts +3 -0
- package/dist/dashboard/dashboard/dashboard.module.d.ts.map +1 -0
- package/dist/dashboard/dashboard/dashboard.module.js +26 -0
- package/dist/dashboard/dashboard/dashboard.module.js.map +1 -0
- package/dist/dashboard/dashboard/dashboard.service.d.ts +30 -0
- package/dist/dashboard/dashboard/dashboard.service.d.ts.map +1 -0
- package/dist/dashboard/dashboard/dashboard.service.js +61 -0
- package/dist/dashboard/dashboard/dashboard.service.js.map +1 -0
- package/dist/dashboard/dashboard/dto/create.dto.d.ts +5 -0
- package/dist/dashboard/dashboard/dto/create.dto.d.ts.map +1 -0
- package/dist/dashboard/dashboard/dto/create.dto.js +23 -0
- package/dist/dashboard/dashboard/dto/create.dto.js.map +1 -0
- package/dist/dashboard/dashboard/dto/update.dto.d.ts +6 -0
- package/dist/dashboard/dashboard/dto/update.dto.d.ts.map +1 -0
- package/dist/dashboard/dashboard/dto/update.dto.js +9 -0
- package/dist/dashboard/dashboard/dto/update.dto.js.map +1 -0
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts +22 -0
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts.map +1 -0
- package/dist/dashboard/dashboard-component/dashboard-component.controller.js +90 -0
- package/dist/dashboard/dashboard-component/dashboard-component.controller.js.map +1 -0
- package/dist/dashboard/dashboard-component/dashboard-component.module.d.ts +3 -0
- package/dist/dashboard/dashboard-component/dashboard-component.module.d.ts.map +1 -0
- package/dist/dashboard/dashboard-component/dashboard-component.module.js +26 -0
- package/dist/dashboard/dashboard-component/dashboard-component.module.js.map +1 -0
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts +30 -0
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts.map +1 -0
- package/dist/dashboard/dashboard-component/dashboard-component.service.js +59 -0
- package/dist/dashboard/dashboard-component/dashboard-component.service.js.map +1 -0
- package/dist/dashboard/dashboard-component/dto/create.dto.d.ts +13 -0
- package/dist/dashboard/dashboard-component/dto/create.dto.d.ts.map +1 -0
- package/dist/dashboard/dashboard-component/dto/create.dto.js +59 -0
- package/dist/dashboard/dashboard-component/dto/create.dto.js.map +1 -0
- package/dist/dashboard/dashboard-component/dto/update.dto.d.ts +6 -0
- package/dist/dashboard/dashboard-component/dto/update.dto.d.ts.map +1 -0
- package/dist/dashboard/dashboard-component/dto/update.dto.js +9 -0
- package/dist/dashboard/dashboard-component/dto/update.dto.js.map +1 -0
- package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts +52 -0
- package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts.map +1 -0
- package/dist/dashboard/dashboard-item/dashboard-item.controller.js +88 -0
- package/dist/dashboard/dashboard-item/dashboard-item.controller.js.map +1 -0
- package/dist/dashboard/dashboard-item/dashboard-item.module.d.ts +3 -0
- package/dist/dashboard/dashboard-item/dashboard-item.module.d.ts.map +1 -0
- package/dist/dashboard/dashboard-item/dashboard-item.module.js +26 -0
- package/dist/dashboard/dashboard-item/dashboard-item.module.js.map +1 -0
- package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts +57 -0
- package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts.map +1 -0
- package/dist/dashboard/dashboard-item/dashboard-item.service.js +77 -0
- package/dist/dashboard/dashboard-item/dashboard-item.service.js.map +1 -0
- package/dist/dashboard/dashboard-item/dto/create.dto.d.ts +9 -0
- package/dist/dashboard/dashboard-item/dto/create.dto.d.ts.map +1 -0
- package/dist/dashboard/dashboard-item/dto/create.dto.js +41 -0
- package/dist/dashboard/dashboard-item/dto/create.dto.js.map +1 -0
- package/dist/dashboard/dashboard-item/dto/update.dto.d.ts +6 -0
- package/dist/dashboard/dashboard-item/dto/update.dto.d.ts.map +1 -0
- package/dist/dashboard/dashboard-item/dto/update.dto.js +9 -0
- package/dist/dashboard/dashboard-item/dto/update.dto.js.map +1 -0
- package/dist/dashboard/dashboard-user/dashboard-user.controller.d.ts +52 -0
- package/dist/dashboard/dashboard-user/dashboard-user.controller.d.ts.map +1 -0
- package/dist/dashboard/dashboard-user/dashboard-user.controller.js +88 -0
- package/dist/dashboard/dashboard-user/dashboard-user.controller.js.map +1 -0
- package/dist/dashboard/dashboard-user/dashboard-user.module.d.ts +3 -0
- package/dist/dashboard/dashboard-user/dashboard-user.module.d.ts.map +1 -0
- package/dist/dashboard/dashboard-user/dashboard-user.module.js +26 -0
- package/dist/dashboard/dashboard-user/dashboard-user.module.js.map +1 -0
- package/dist/dashboard/dashboard-user/dashboard-user.service.d.ts +59 -0
- package/dist/dashboard/dashboard-user/dashboard-user.service.d.ts.map +1 -0
- package/dist/dashboard/dashboard-user/dashboard-user.service.js +83 -0
- package/dist/dashboard/dashboard-user/dashboard-user.service.js.map +1 -0
- package/dist/dashboard/dashboard-user/dto/create.dto.d.ts +10 -0
- package/dist/dashboard/dashboard-user/dto/create.dto.d.ts.map +1 -0
- package/dist/dashboard/dashboard-user/dto/create.dto.js +42 -0
- package/dist/dashboard/dashboard-user/dto/create.dto.js.map +1 -0
- package/dist/dashboard/dashboard-user/dto/update.dto.d.ts +6 -0
- package/dist/dashboard/dashboard-user/dto/update.dto.d.ts.map +1 -0
- package/dist/dashboard/dashboard-user/dto/update.dto.js +9 -0
- package/dist/dashboard/dashboard-user/dto/update.dto.js.map +1 -0
- package/dist/dashboard/dashboard.module.d.ts +3 -0
- package/dist/dashboard/dashboard.module.d.ts.map +1 -0
- package/dist/dashboard/dashboard.module.js +35 -0
- package/dist/dashboard/dashboard.module.js.map +1 -0
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.d.ts.map +1 -0
- package/dist/dashboard/index.js +18 -0
- package/dist/dashboard/index.js.map +1 -0
- package/dist/emails/lib.d.ts.map +1 -1
- package/frontend/dashboard/components/create-panel.tsx.ejs +63 -0
- package/frontend/dashboard/components/dashboard.screen.tsx.ejs +116 -0
- package/frontend/dashboard/components/update-panel.tsx.ejs +80 -0
- package/frontend/dashboard/locales/en/dashboard.dashboard.json +11 -0
- package/frontend/dashboard/locales/pt/dashboard.dashboard.json +11 -0
- package/frontend/dashboard/react-query/handlers.ts.ejs +28 -0
- package/frontend/dashboard/react-query/requests.ts.ejs +56 -0
- package/frontend/dashboard-component/components/create-panel.tsx.ejs +130 -0
- package/frontend/dashboard-component/components/dashboard-component.screen.tsx.ejs +135 -0
- package/frontend/dashboard-component/components/update-panel.tsx.ejs +164 -0
- package/frontend/dashboard-component/locales/en/dashboard.dashboard-component.json +11 -0
- package/frontend/dashboard-component/locales/pt/dashboard.dashboard-component.json +11 -0
- package/frontend/dashboard-component/react-query/handlers.ts.ejs +28 -0
- package/frontend/dashboard-component/react-query/requests.ts.ejs +61 -0
- package/frontend/dashboard-item/components/create-panel.tsx.ejs +108 -0
- package/frontend/dashboard-item/components/dashboard-item.screen.tsx.ejs +133 -0
- package/frontend/dashboard-item/components/update-panel.tsx.ejs +141 -0
- package/frontend/dashboard-item/locales/en/dashboard.dashboard-item.json +11 -0
- package/frontend/dashboard-item/locales/pt/dashboard.dashboard-item.json +11 -0
- package/frontend/dashboard-item/react-query/handlers.ts.ejs +28 -0
- package/frontend/dashboard-item/react-query/requests.ts.ejs +58 -0
- package/frontend/dashboard-user/components/create-panel.tsx.ejs +108 -0
- package/frontend/dashboard-user/components/dashboard-user.screen.tsx.ejs +131 -0
- package/frontend/dashboard-user/components/update-panel.tsx.ejs +138 -0
- package/frontend/dashboard-user/locales/en/dashboard.dashboard-user.json +11 -0
- package/frontend/dashboard-user/locales/pt/dashboard.dashboard-user.json +11 -0
- package/frontend/dashboard-user/react-query/handlers.ts.ejs +28 -0
- package/frontend/dashboard-user/react-query/requests.ts.ejs +58 -0
- package/frontend/translation/fields/en.json +23 -1
- package/frontend/translation/fields/pt.json +27 -1
- package/frontend/translation/modules/en.json +6 -1
- package/frontend/translation/modules/pt.json +6 -1
- package/hedhog.yaml +439 -0
- package/package.json +2 -4
- package/src/admin.module.ts +2 -0
- package/src/dashboard/dashboard/dashboard.controller.ts +49 -0
- package/src/dashboard/dashboard/dashboard.module.ts +13 -0
- package/src/dashboard/dashboard/dashboard.service.ts +71 -0
- package/src/dashboard/dashboard/dto/create.dto.ts +8 -0
- package/src/dashboard/dashboard/dto/update.dto.ts +4 -0
- package/src/dashboard/dashboard-component/dashboard-component.controller.ts +55 -0
- package/src/dashboard/dashboard-component/dashboard-component.module.ts +14 -0
- package/src/dashboard/dashboard-component/dashboard-component.service.ts +70 -0
- package/src/dashboard/dashboard-component/dto/create.dto.ts +36 -0
- package/src/dashboard/dashboard-component/dto/update.dto.ts +4 -0
- package/src/dashboard/dashboard-item/dashboard-item.controller.ts +55 -0
- package/src/dashboard/dashboard-item/dashboard-item.module.ts +13 -0
- package/src/dashboard/dashboard-item/dashboard-item.service.ts +82 -0
- package/src/dashboard/dashboard-item/dto/create.dto.ts +22 -0
- package/src/dashboard/dashboard-item/dto/update.dto.ts +4 -0
- package/src/dashboard/dashboard-user/dashboard-user.controller.ts +55 -0
- package/src/dashboard/dashboard-user/dashboard-user.module.ts +13 -0
- package/src/dashboard/dashboard-user/dashboard-user.service.ts +89 -0
- package/src/dashboard/dashboard-user/dto/create.dto.ts +22 -0
- package/src/dashboard/dashboard-user/dto/update.dto.ts +4 -0
- package/src/dashboard/dashboard.module.ts +22 -0
- package/src/dashboard/index.ts +1 -0
- package/frontend/menu-locale/locales/en/admin.menu-locale.json +0 -11
- package/frontend/menu-locale/locales/pt/admin.menu-locale.json +0 -11
- package/frontend/menu-screen/locales/en/admin.menu-screen.json +0 -11
- package/frontend/menu-screen/locales/pt/admin.menu-screen.json +0 -11
- package/frontend/multifactor-locale/locales/en/admin.multifactor-locale.json +0 -11
- package/frontend/multifactor-locale/locales/pt/admin.multifactor-locale.json +0 -11
- package/frontend/screen-locale/locales/en/admin.screen-locale.json +0 -11
- package/frontend/screen-locale/locales/pt/admin.screen-locale.json +0 -11
- package/frontend/translation/components/create-panel.tsx.ejs +0 -52
- package/frontend/translation/components/update-panel.tsx.ejs +0 -67
- package/frontend/translation/locales/en/admin.translation.json +0 -11
- package/frontend/translation/locales/pt/admin.translation.json +0 -11
- package/frontend/translation/react-query/handlers.ts.ejs +0 -28
- package/frontend/translation/react-query/requests.ts.ejs +0 -58
- package/frontend/translation-namespace/components/create-panel.tsx.ejs +0 -53
- package/frontend/translation-namespace/components/update-panel.tsx.ejs +0 -70
- package/frontend/translation-namespace/locales/en/admin.translation-namespace.json +0 -11
- package/frontend/translation-namespace/locales/pt/admin.translation-namespace.json +0 -11
- package/frontend/translation-namespace/react-query/handlers.ts.ejs +0 -28
- package/frontend/translation-namespace/react-query/requests.ts.ejs +0 -60
@@ -0,0 +1,131 @@
|
|
1
|
+
import { PageTitle } from '@/components/custom/page-title'
|
2
|
+
import DataPanel from '@/components/panels/data-panel'
|
3
|
+
import { useDashboardUserDelete } from '@/features/dashboard/dashboard-user'
|
4
|
+
import { useApp } from '@/hooks/use-app'
|
5
|
+
import { isPlural } from '@/lib/utils'
|
6
|
+
import { DashboardUser } from '@/types/models'
|
7
|
+
import { IconEdit, IconPlus, IconTrash } from '@tabler/icons-react'
|
8
|
+
import { useState } from 'react'
|
9
|
+
import { useTranslation } from 'react-i18next'
|
10
|
+
import DashboardUserCreatePanel from './components/dashboard-user-create-panel'
|
11
|
+
import DashboardUserUpdatePanel from './components/dashboard-user-update-panel'
|
12
|
+
import DashboardUserCard from '@/components/cards/dashboard-user-card'
|
13
|
+
|
14
|
+
export default function Page() {
|
15
|
+
const [selectedItems, setSelectedItems] = useState<DashboardUser[]>([])
|
16
|
+
const { mutate: deleteDashboardUser } = useDashboardUserDelete()
|
17
|
+
const { openSheet, confirm, closeSheet } = useApp()
|
18
|
+
const { t } = useTranslation([
|
19
|
+
'dashboard.dashboard-user',
|
20
|
+
'modules',
|
21
|
+
'actions',
|
22
|
+
'fields',
|
23
|
+
])
|
24
|
+
|
25
|
+
const openCreate = () => {
|
26
|
+
const id = openSheet({
|
27
|
+
title: t('create', { ns: 'dashboard.dashboard-user' }),
|
28
|
+
description: t('createText', {
|
29
|
+
ns: 'dashboard.dashboard-user',
|
30
|
+
}),
|
31
|
+
children: () => (
|
32
|
+
<DashboardUserCreatePanel onCreated={() => closeSheet(id)} />
|
33
|
+
),
|
34
|
+
})
|
35
|
+
|
36
|
+
return id
|
37
|
+
}
|
38
|
+
|
39
|
+
const openDelete = (items: DashboardUser[]) => {
|
40
|
+
return confirm({
|
41
|
+
title: `${t('delete', { ns: 'dashboard.dashboard-user' })} ${items.length} ${isPlural(items.length) ? t('items', { ns: 'actions' }) : t('item', { ns: 'actions' })}`,
|
42
|
+
description: t('deleteText', {
|
43
|
+
ns: 'dashboard.dashboard-user',
|
44
|
+
}),
|
45
|
+
})
|
46
|
+
.then(() =>
|
47
|
+
deleteDashboardUser(
|
48
|
+
items
|
49
|
+
.map((item) => (item as any).component_id)
|
50
|
+
.filter((id) => id !== undefined)
|
51
|
+
)
|
52
|
+
)
|
53
|
+
.catch(() => setSelectedItems(items))
|
54
|
+
}
|
55
|
+
|
56
|
+
const openUpdate = (item: DashboardUser) => {
|
57
|
+
const id = openSheet({
|
58
|
+
children: () => (
|
59
|
+
<DashboardUserUpdatePanel
|
60
|
+
data={item}
|
61
|
+
onUpdated={() => closeSheet(id)}
|
62
|
+
/>
|
63
|
+
),
|
64
|
+
title: t('edit', { ns: 'dashboard.dashboard-user' }),
|
65
|
+
description: t('editText', {
|
66
|
+
ns: 'dashboard.dashboard-user',
|
67
|
+
}),
|
68
|
+
})
|
69
|
+
|
70
|
+
return id
|
71
|
+
}
|
72
|
+
|
73
|
+
return (
|
74
|
+
<>
|
75
|
+
<PageTitle title={t('dashboard_user', { ns: 'modules' })} />
|
76
|
+
<DataPanel
|
77
|
+
url='/dashboard-user'
|
78
|
+
layout='grid'
|
79
|
+
id='dashboard-user'
|
80
|
+
selectable
|
81
|
+
render={(item: DashboardUser) => <DashboardUserCard item={item} />}
|
82
|
+
responsiveColumns={{
|
83
|
+
default: 1,
|
84
|
+
sm: 2,
|
85
|
+
md: 1,
|
86
|
+
lg: 2,
|
87
|
+
xl: 3,
|
88
|
+
}}
|
89
|
+
selected={selectedItems as DashboardUser[]}
|
90
|
+
multiple
|
91
|
+
hasSearch
|
92
|
+
onItemDoubleClick={(item) => openUpdate(item)}
|
93
|
+
menuActions={[
|
94
|
+
{
|
95
|
+
icon: <IconEdit className='mr-1 w-8 cursor-pointer' />,
|
96
|
+
label: t('edit', { ns: 'actions' }),
|
97
|
+
tooltip: t('editTooltip', { ns: 'dashboard.dashboard-user' }),
|
98
|
+
handler: (items: DashboardUser[]) => {
|
99
|
+
if (items.length === 1) openUpdate(items[0])
|
100
|
+
},
|
101
|
+
show: 'once',
|
102
|
+
},
|
103
|
+
{
|
104
|
+
icon: <IconTrash className='mr-1 w-8 cursor-pointer' />,
|
105
|
+
label: t('delete', { ns: 'actions' }),
|
106
|
+
tooltip: t('deleteTooltip', {
|
107
|
+
ns: 'dashboard.dashboard-user',
|
108
|
+
}),
|
109
|
+
variant: 'destructive',
|
110
|
+
handler: (items: DashboardUser[]) => {
|
111
|
+
openDelete(items)
|
112
|
+
},
|
113
|
+
show: 'some',
|
114
|
+
},
|
115
|
+
{
|
116
|
+
icon: <IconPlus className='mr-1 w-8 cursor-pointer' />,
|
117
|
+
label: t('create', { ns: 'actions' }),
|
118
|
+
tooltip: t('createTooltip', {
|
119
|
+
ns: 'dashboard.dashboard-user',
|
120
|
+
}),
|
121
|
+
variant: 'default',
|
122
|
+
handler: () => {
|
123
|
+
openCreate()
|
124
|
+
},
|
125
|
+
show: 'none',
|
126
|
+
},
|
127
|
+
]}
|
128
|
+
/>
|
129
|
+
</>
|
130
|
+
)
|
131
|
+
}
|
@@ -0,0 +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/dashboard/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
|
+
export default DashboardUserUpdatePanel;
|
@@ -0,0 +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
|
+
}
|
@@ -0,0 +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
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { useDefaultMutation } from "@/hooks/use-default-mutation";
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
3
|
+
import { requests } from "./requests";
|
4
|
+
|
5
|
+
const scope = "dashboard-user";
|
6
|
+
|
7
|
+
export function useDashboardUserCreate() {
|
8
|
+
const { dashboardUserCreate } = requests();
|
9
|
+
return useDefaultMutation(scope, "create", dashboardUserCreate);
|
10
|
+
}
|
11
|
+
|
12
|
+
export function useDashboardUserDelete() {
|
13
|
+
const { dashboardUserDelete } = requests();
|
14
|
+
return useDefaultMutation(scope, "delete", dashboardUserDelete);
|
15
|
+
}
|
16
|
+
|
17
|
+
export function useDashboardUserUpdate() {
|
18
|
+
const { dashboardUserUpdate } = requests();
|
19
|
+
return useDefaultMutation(scope, "update", dashboardUserUpdate);
|
20
|
+
}
|
21
|
+
|
22
|
+
export function useDashboardUserGet(id: number) {
|
23
|
+
const { dashboardUserGet } = requests();
|
24
|
+
return useQuery({
|
25
|
+
queryKey: [scope, "get"],
|
26
|
+
queryFn: () => dashboardUserGet(id),
|
27
|
+
});
|
28
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import { useApp } from "@/hooks/use-app";
|
2
|
+
import { Delete, PaginationParams, PaginationResult } from "@/types";
|
3
|
+
import { DashboardUser } from "@/types/models";
|
4
|
+
import { HttpMethod } from "@/types/http-method";
|
5
|
+
|
6
|
+
export function requests() {
|
7
|
+
const { request } = useApp();
|
8
|
+
|
9
|
+
const dashboardUserList = async (params: PaginationParams) => {
|
10
|
+
return request<PaginationResult<DashboardUser>>({
|
11
|
+
url: "/dashboard-user",
|
12
|
+
params,
|
13
|
+
}).then((res) => res.data);
|
14
|
+
};
|
15
|
+
|
16
|
+
const dashboardUserGet = async (id: number) => {
|
17
|
+
return request<DashboardUser>({
|
18
|
+
url: `/dashboard-user/${id}`,
|
19
|
+
}).then((res) => res.data);
|
20
|
+
};
|
21
|
+
|
22
|
+
const dashboardUserCreate = async (params: { data: DashboardUser }) => {
|
23
|
+
const { data } = params;
|
24
|
+
return request<DashboardUser>({
|
25
|
+
url: "/dashboard-user",
|
26
|
+
method: HttpMethod.POST,
|
27
|
+
data: data,
|
28
|
+
}).then((res) => res.data);
|
29
|
+
};
|
30
|
+
|
31
|
+
const dashboardUserDelete = async (ids: number[]) => {
|
32
|
+
return request<Delete>({
|
33
|
+
url: "/dashboard-user",
|
34
|
+
data: { ids },
|
35
|
+
method: HttpMethod.DELETE,
|
36
|
+
}).then((res) => res.data);
|
37
|
+
};
|
38
|
+
|
39
|
+
const dashboardUserUpdate = async (params: {
|
40
|
+
id: number;
|
41
|
+
data: DashboardUser;
|
42
|
+
}) => {
|
43
|
+
const { id, data } = params;
|
44
|
+
return request<DashboardUser>({
|
45
|
+
url: `/dashboard-user/${id}`,
|
46
|
+
method: HttpMethod.PATCH,
|
47
|
+
data: data,
|
48
|
+
}).then((res) => res.data);
|
49
|
+
};
|
50
|
+
|
51
|
+
return {
|
52
|
+
dashboardUserCreate,
|
53
|
+
dashboardUserUpdate,
|
54
|
+
dashboardUserDelete,
|
55
|
+
dashboardUserList,
|
56
|
+
dashboardUserGet,
|
57
|
+
};
|
58
|
+
}
|
@@ -1 +1,23 @@
|
|
1
|
-
{
|
1
|
+
{
|
2
|
+
"dashboard.slug": "Slug",
|
3
|
+
"dashboard.path": "Path",
|
4
|
+
"dashboard.name": "Name",
|
5
|
+
"dashboard_locale.name": "Name",
|
6
|
+
"dashboard-user.item_id": "Item",
|
7
|
+
"dashboard-user.user_id": "User",
|
8
|
+
"dashboard-user.width": "Width",
|
9
|
+
"dashboard-user.height": "Height",
|
10
|
+
"dashboard-user.x_axis": "X Axis",
|
11
|
+
"dashboard-user.y_axis": "Y Axis",
|
12
|
+
"dashboard-item.component_id": "Component",
|
13
|
+
"dashboard-item.dashboard_id": "Dashboard",
|
14
|
+
"dashboard-component.slug": "Slug",
|
15
|
+
"dashboard-component.path": "Path",
|
16
|
+
"dashboard-component.width": "Width",
|
17
|
+
"dashboard-component.min_width": "Min Width",
|
18
|
+
"dashboard-component.max_width": "Max Width",
|
19
|
+
"dashboard-component.height": "Height",
|
20
|
+
"dashboard-component.min_height": "Min Height",
|
21
|
+
"dashboard-component.max_height": "Max Height",
|
22
|
+
"dashboard-component.is_resizable": "Resizable"
|
23
|
+
}
|
@@ -1 +1,27 @@
|
|
1
|
-
{
|
1
|
+
{
|
2
|
+
"dashboard_component.slug": "Slug",
|
3
|
+
"dashboard_component.path": "Caminho",
|
4
|
+
"dashboard_component.name": "Nome",
|
5
|
+
"dashboard_component_locale.name": "Nome",
|
6
|
+
"dashboard.slug": "Slug",
|
7
|
+
"dashboard.path": "Caminho",
|
8
|
+
"dashboard.name": "Nome",
|
9
|
+
"dashboard_locale.name": "Nome",
|
10
|
+
"dashboard-user.item_id": "Item",
|
11
|
+
"dashboard-user.user_id": "Usuário",
|
12
|
+
"dashboard-user.width": "Largura",
|
13
|
+
"dashboard-user.height": "Altura",
|
14
|
+
"dashboard-user.x_axis": "Eixo X",
|
15
|
+
"dashboard-user.y_axis": "Eixo Y",
|
16
|
+
"dashboard-item.component_id": "Componente",
|
17
|
+
"dashboard-item.dashboard_id": "Dashboard",
|
18
|
+
"dashboard-component.slug": "Slug",
|
19
|
+
"dashboard-component.path": "Caminho",
|
20
|
+
"dashboard-component.width": "Largura",
|
21
|
+
"dashboard-component.min_width": "Largura Mínima",
|
22
|
+
"dashboard-component.max_width": "Largura Máxima",
|
23
|
+
"dashboard-component.height": "Altura",
|
24
|
+
"dashboard-component.min_height": "Altura Mínima",
|
25
|
+
"dashboard-component.max_height": "Altura Máxima",
|
26
|
+
"dashboard-component.is_resizable": "Redimensionável"
|
27
|
+
}
|