Compare commits
2 Commits
nico/19-ma
...
nico/21-ma
| Author | SHA1 | Date | |
|---|---|---|---|
| cab86eb02f | |||
| d1e39ae7f9 |
Binary file not shown.
|
After Width: | Height: | Size: 275 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 275 KiB |
93
src/app/admin/(dashboard)/keamanan/_com/keamananEditor.tsx
Normal file
93
src/app/admin/(dashboard)/keamanan/_com/keamananEditor.tsx
Normal file
@@ -0,0 +1,93 @@
|
||||
'use client'
|
||||
import colors from '@/con/colors';
|
||||
import { Button, Stack } from '@mantine/core';
|
||||
import { Link, RichTextEditor } from '@mantine/tiptap';
|
||||
import Highlight from '@tiptap/extension-highlight';
|
||||
import SubScript from '@tiptap/extension-subscript';
|
||||
import Superscript from '@tiptap/extension-superscript';
|
||||
import TextAlign from '@tiptap/extension-text-align';
|
||||
import Underline from '@tiptap/extension-underline';
|
||||
import { useEditor } from '@tiptap/react';
|
||||
import StarterKit from '@tiptap/starter-kit';
|
||||
|
||||
const content =
|
||||
'<h2 style="text-align: center;">Welcome to Mantine rich text editor</h2><p><code>RichTextEditor</code> component focuses on usability and is designed to be as simple as possible to bring a familiar editing experience to regular users. <code>RichTextEditor</code> is based on <a href="https://tiptap.dev/" rel="noopener noreferrer" target="_blank">Tiptap.dev</a> and supports all of its features:</p><ul><li>General text formatting: <strong>bold</strong>, <em>italic</em>, <u>underline</u>, <s>strike-through</s> </li><li>Headings (h1-h6)</li><li>Sub and super scripts (<sup><sup /></sup> and <sub><sub /></sub> tags)</li><li>Ordered and bullet lists</li><li>Text align </li><li>And all <a href="https://tiptap.dev/extensions" target="_blank" rel="noopener noreferrer">other extensions</a></li></ul>';
|
||||
|
||||
export function KeamananEditor({showSubmit = true} : {
|
||||
showSubmit: boolean
|
||||
}) {
|
||||
const editor = useEditor({
|
||||
extensions: [
|
||||
StarterKit,
|
||||
Underline,
|
||||
Link,
|
||||
Superscript,
|
||||
SubScript,
|
||||
Highlight,
|
||||
TextAlign.configure({ types: ['heading', 'paragraph'] }),
|
||||
],
|
||||
immediatelyRender: false,
|
||||
content,
|
||||
});
|
||||
|
||||
return (
|
||||
<Stack>
|
||||
<RichTextEditor editor={editor}>
|
||||
<RichTextEditor.Toolbar sticky stickyOffset={60}>
|
||||
<RichTextEditor.ControlsGroup>
|
||||
<RichTextEditor.Bold />
|
||||
<RichTextEditor.Italic />
|
||||
<RichTextEditor.Underline />
|
||||
<RichTextEditor.Strikethrough />
|
||||
<RichTextEditor.ClearFormatting />
|
||||
<RichTextEditor.Highlight />
|
||||
<RichTextEditor.Code />
|
||||
</RichTextEditor.ControlsGroup>
|
||||
|
||||
<RichTextEditor.ControlsGroup>
|
||||
<RichTextEditor.H1 />
|
||||
<RichTextEditor.H2 />
|
||||
<RichTextEditor.H3 />
|
||||
<RichTextEditor.H4 />
|
||||
</RichTextEditor.ControlsGroup>
|
||||
|
||||
<RichTextEditor.ControlsGroup>
|
||||
<RichTextEditor.Blockquote />
|
||||
<RichTextEditor.Hr />
|
||||
<RichTextEditor.BulletList />
|
||||
<RichTextEditor.OrderedList />
|
||||
<RichTextEditor.Subscript />
|
||||
<RichTextEditor.Superscript />
|
||||
</RichTextEditor.ControlsGroup>
|
||||
|
||||
<RichTextEditor.ControlsGroup>
|
||||
<RichTextEditor.Link />
|
||||
<RichTextEditor.Unlink />
|
||||
</RichTextEditor.ControlsGroup>
|
||||
|
||||
<RichTextEditor.ControlsGroup>
|
||||
<RichTextEditor.AlignLeft />
|
||||
<RichTextEditor.AlignCenter />
|
||||
<RichTextEditor.AlignJustify />
|
||||
<RichTextEditor.AlignRight />
|
||||
</RichTextEditor.ControlsGroup>
|
||||
|
||||
<RichTextEditor.ControlsGroup>
|
||||
<RichTextEditor.Undo />
|
||||
<RichTextEditor.Redo />
|
||||
</RichTextEditor.ControlsGroup>
|
||||
</RichTextEditor.Toolbar>
|
||||
|
||||
<RichTextEditor.Content />
|
||||
</RichTextEditor>
|
||||
{showSubmit && (
|
||||
<Button
|
||||
mt={10}
|
||||
bg={colors['blue-button']}
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
)}
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
'use client'
|
||||
import { Button, Stack } from '@mantine/core';
|
||||
import { Link, RichTextEditor } from '@mantine/tiptap';
|
||||
import Highlight from '@tiptap/extension-highlight';
|
||||
import SubScript from '@tiptap/extension-subscript';
|
||||
import Superscript from '@tiptap/extension-superscript';
|
||||
import TextAlign from '@tiptap/extension-text-align';
|
||||
import Underline from '@tiptap/extension-underline';
|
||||
import { useEditor } from '@tiptap/react';
|
||||
import StarterKit from '@tiptap/starter-kit';
|
||||
|
||||
|
||||
function KeamananEditorText({ onSubmit, onChange, showSubmit = true, initialContent = '', }: {
|
||||
onSubmit?: (val: string) => void,
|
||||
onChange: (val: string) => void,
|
||||
showSubmit?: boolean,
|
||||
initialContent?: string }) {
|
||||
const editor = useEditor({
|
||||
extensions: [
|
||||
StarterKit,
|
||||
Underline,
|
||||
Link,
|
||||
Superscript,
|
||||
SubScript,
|
||||
Highlight,
|
||||
TextAlign.configure({ types: ['heading', 'paragraph'] }),
|
||||
],
|
||||
immediatelyRender: false,
|
||||
content: initialContent,
|
||||
onUpdate : ({editor}) => {
|
||||
onChange(editor.getHTML())
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<Stack>
|
||||
<RichTextEditor editor={editor}>
|
||||
<RichTextEditor.Toolbar sticky stickyOffset={60}>
|
||||
<RichTextEditor.ControlsGroup>
|
||||
<RichTextEditor.Bold />
|
||||
<RichTextEditor.Italic />
|
||||
<RichTextEditor.Underline />
|
||||
<RichTextEditor.Strikethrough />
|
||||
<RichTextEditor.ClearFormatting />
|
||||
<RichTextEditor.Highlight />
|
||||
<RichTextEditor.Code />
|
||||
</RichTextEditor.ControlsGroup>
|
||||
|
||||
<RichTextEditor.ControlsGroup>
|
||||
<RichTextEditor.H1 />
|
||||
<RichTextEditor.H2 />
|
||||
<RichTextEditor.H3 />
|
||||
<RichTextEditor.H4 />
|
||||
</RichTextEditor.ControlsGroup>
|
||||
|
||||
<RichTextEditor.ControlsGroup>
|
||||
<RichTextEditor.Blockquote />
|
||||
<RichTextEditor.Hr />
|
||||
<RichTextEditor.BulletList />
|
||||
<RichTextEditor.OrderedList />
|
||||
<RichTextEditor.Subscript />
|
||||
<RichTextEditor.Superscript />
|
||||
</RichTextEditor.ControlsGroup>
|
||||
|
||||
<RichTextEditor.ControlsGroup>
|
||||
<RichTextEditor.Link />
|
||||
<RichTextEditor.Unlink />
|
||||
</RichTextEditor.ControlsGroup>
|
||||
|
||||
<RichTextEditor.ControlsGroup>
|
||||
<RichTextEditor.AlignLeft />
|
||||
<RichTextEditor.AlignCenter />
|
||||
<RichTextEditor.AlignJustify />
|
||||
<RichTextEditor.AlignRight />
|
||||
</RichTextEditor.ControlsGroup>
|
||||
|
||||
<RichTextEditor.ControlsGroup>
|
||||
<RichTextEditor.Undo />
|
||||
<RichTextEditor.Redo />
|
||||
</RichTextEditor.ControlsGroup>
|
||||
</RichTextEditor.Toolbar>
|
||||
|
||||
<RichTextEditor.Content />
|
||||
</RichTextEditor>
|
||||
{showSubmit && (
|
||||
<Button onClick={() => {
|
||||
if (!editor) return
|
||||
onSubmit?.(editor?.getHTML())
|
||||
}}>Submit</Button>
|
||||
)}
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
export default KeamananEditorText;
|
||||
@@ -1,10 +1,35 @@
|
||||
import colors from '@/con/colors';
|
||||
import { Box, Stack, Tabs, TabsList, TabsPanel, TabsTab, Title } from '@mantine/core';
|
||||
import React from 'react';
|
||||
import CreateKeamananLingkungan from './ui/tambah_keamanan_lingkungan/page';
|
||||
import ListKeamananLingkungan from './ui/list_keamanan_lingkungan/page';
|
||||
|
||||
|
||||
function Page() {
|
||||
return (
|
||||
<div>
|
||||
keamanan-lingkungan-pecalang-patwal
|
||||
</div>
|
||||
<Box>
|
||||
<Stack gap={'xs'}>
|
||||
<Title order={3}>Keamanan Lingkungan </Title>
|
||||
<Tabs defaultValue="create" color={colors['blue-button']} variant='pills'>
|
||||
<TabsList mb={10} bg={colors['BG-trans']} p={'xs'}>
|
||||
<TabsTab value="create" >
|
||||
Tambah Keamanan Lingkungan
|
||||
</TabsTab>
|
||||
<TabsTab value="list" >
|
||||
List Keamanan Lingkungan
|
||||
</TabsTab>
|
||||
</TabsList>
|
||||
|
||||
<TabsPanel value="create">
|
||||
<CreateKeamananLingkungan/>
|
||||
</TabsPanel>
|
||||
|
||||
<TabsPanel value="list">
|
||||
<ListKeamananLingkungan/>
|
||||
</TabsPanel>
|
||||
</Tabs>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { Box, Paper, Stack, Table, TableTbody, TableTh, TableThead, TableTr, Title } from '@mantine/core';
|
||||
import colors from '@/con/colors';
|
||||
import React from 'react';
|
||||
|
||||
function ListKeamananLingkungan() {
|
||||
return (
|
||||
<Box>
|
||||
<Paper bg={colors['white-1']} p={'md'} radius={10}>
|
||||
<Stack gap={'xs'}>
|
||||
<Title order={3}>List Keamanan Lingkungan</Title>
|
||||
<Box>
|
||||
<Table striped withTableBorder withColumnBorders withRowBorders>
|
||||
<TableThead>
|
||||
<TableTr>
|
||||
<TableTh>Image</TableTh>
|
||||
<TableTh>Nama Keamanan Lingkungan</TableTh>
|
||||
<TableTh>Deskripsi Keamanan Lingkungan</TableTh>
|
||||
<TableTh>Aksi</TableTh>
|
||||
<TableTh>Detail</TableTh>
|
||||
</TableTr>
|
||||
</TableThead>
|
||||
<TableTbody>
|
||||
|
||||
</TableTbody>
|
||||
</Table>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default ListKeamananLingkungan;
|
||||
@@ -0,0 +1,46 @@
|
||||
import colors from '@/con/colors';
|
||||
import { Box, Button, Group, Paper, SimpleGrid, Stack, Text, TextInput, Title } from '@mantine/core';
|
||||
import { IconImageInPicture } from '@tabler/icons-react';
|
||||
import React from 'react';
|
||||
import { KeamananEditor } from '../../../_com/keamananEditor';
|
||||
|
||||
|
||||
function KeamananLingkungan() {
|
||||
return (
|
||||
<Box>
|
||||
<Stack gap={'xs'}>
|
||||
<SimpleGrid cols={{ base: 1, md: 2 }}>
|
||||
<Box>
|
||||
<Paper bg={colors['white-1']} p={'md'}>
|
||||
<Stack gap={"xs"}>
|
||||
<Title order={4}>Tambah Keamanan Lingkungan</Title>
|
||||
<Box>
|
||||
<Text fw={"bold"} fz={"sm"}>Masukkan Image</Text>
|
||||
<IconImageInPicture size={50} />
|
||||
</Box>
|
||||
<TextInput
|
||||
label={<Text fw={"bold"} fz={"sm"}>Nama Keamanan Lingkungan</Text>}
|
||||
placeholder='Masukkan nama keamanan lingkungan'
|
||||
/>
|
||||
<Box>
|
||||
<Text fw={"bold"} fz={"sm"}>Deskripsi Keamanan Lingkungan</Text>
|
||||
<KeamananEditor
|
||||
showSubmit={false}
|
||||
/>
|
||||
</Box>
|
||||
<Group>
|
||||
<Button bg={colors['blue-button']}>Submit</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
<Box>
|
||||
|
||||
</Box>
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default KeamananLingkungan;
|
||||
@@ -1,10 +1,35 @@
|
||||
import colors from '@/con/colors';
|
||||
import { Box, Stack, Tabs, TabsList, TabsPanel, TabsTab, Title } from '@mantine/core';
|
||||
import React from 'react';
|
||||
import CreatePolsekTerdekat from './ui/tambah_polsek_terdekat/page';
|
||||
import ListPolsekTerdekat from './ui/list_polsek_terdekat/page';
|
||||
|
||||
|
||||
function Page() {
|
||||
return (
|
||||
<div>
|
||||
polsek-terdekat
|
||||
</div>
|
||||
<Box>
|
||||
<Stack gap={'xs'}>
|
||||
<Title order={3}>Polsek Terdekat</Title>
|
||||
<Tabs defaultValue="create" color={colors['blue-button']} variant='pills'>
|
||||
<TabsList mb={10} bg={colors['BG-trans']} p={'xs'}>
|
||||
<TabsTab value="create" >
|
||||
Tambah Polsek Terdekat
|
||||
</TabsTab>
|
||||
<TabsTab value="list" >
|
||||
List Polsek Terdekat
|
||||
</TabsTab>
|
||||
</TabsList>
|
||||
|
||||
<TabsPanel value="create">
|
||||
<CreatePolsekTerdekat/>
|
||||
</TabsPanel>
|
||||
|
||||
<TabsPanel value="list">
|
||||
<ListPolsekTerdekat/>
|
||||
</TabsPanel>
|
||||
</Tabs>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Box, Paper, Stack, Table, TableTbody, TableTh, TableThead, TableTr, Title } from '@mantine/core';
|
||||
import colors from '@/con/colors';
|
||||
import React from 'react';
|
||||
|
||||
function ListPolsekTerdekat() {
|
||||
return (
|
||||
<Box>
|
||||
<Paper bg={colors['white-1']} p={'md'} radius={10}>
|
||||
<Stack gap={'xs'}>
|
||||
<Title order={3}>List Polsek Terdekat</Title>
|
||||
<Box>
|
||||
<Table striped withTableBorder withColumnBorders withRowBorders>
|
||||
<TableThead>
|
||||
<TableTr>
|
||||
<TableTh>Nama Polsek Terdekat</TableTh>
|
||||
<TableTh>Jarak Polsek Terdekat</TableTh>
|
||||
<TableTh>Alamat Polsek Terdekat</TableTh>
|
||||
<TableTh>Nomor Telepon Polsek Terdekat</TableTh>
|
||||
<TableTh>Jam Aktif</TableTh>
|
||||
<TableTh>Deskripsi Polsek Terdekat</TableTh>
|
||||
<TableTh>Aksi</TableTh>
|
||||
<TableTh>Detail</TableTh>
|
||||
</TableTr>
|
||||
</TableThead>
|
||||
<TableTbody>
|
||||
|
||||
</TableTbody>
|
||||
</Table>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default ListPolsekTerdekat;
|
||||
@@ -0,0 +1,56 @@
|
||||
import colors from '@/con/colors';
|
||||
import { Box, Button, Group, Paper, SimpleGrid, Stack, Text, TextInput, Title } from '@mantine/core';
|
||||
import { KeamananEditor } from '../../../_com/keamananEditor';
|
||||
|
||||
|
||||
function CreatePolsekTerdekat() {
|
||||
return (
|
||||
<Box>
|
||||
<Stack gap={'xs'}>
|
||||
<SimpleGrid cols={{ base: 1, md: 2 }}>
|
||||
<Box>
|
||||
<Paper bg={colors['white-1']} p={'md'}>
|
||||
<Stack gap={"xs"}>
|
||||
<Title order={4}>Tambah Polsek Terdekat</Title>
|
||||
<TextInput
|
||||
label={<Text fw={"bold"} fz={"sm"}>Nama Polsek Terdekat</Text>}
|
||||
placeholder='Masukkan nama polsek terdekat'
|
||||
/>
|
||||
<TextInput
|
||||
label={<Text fw={"bold"} fz={"sm"}>Jarak Polsek Terdekat</Text>}
|
||||
placeholder='Masukkan jarak polsek terdekat'
|
||||
/>
|
||||
<TextInput
|
||||
label={<Text fw={"bold"} fz={"sm"}>Alamat Polsek Terdekat</Text>}
|
||||
placeholder='Masukkan alamat polsek terdekat'
|
||||
/>
|
||||
<TextInput
|
||||
label={<Text fw={"bold"} fz={"sm"}>Nomor Telepon Polsek Terdekat</Text>}
|
||||
placeholder='Masukkan nomor telepon polsek terdekat'
|
||||
/>
|
||||
<TextInput
|
||||
label={<Text fw={"bold"} fz={"sm"}>Jam Aktif</Text>}
|
||||
placeholder='Masukkan jam aktif polsek terdekat'
|
||||
/>
|
||||
<Box>
|
||||
<Text fw={"bold"} fz={"sm"}>Deskripsi Polsek Terdekat</Text>
|
||||
<KeamananEditor
|
||||
showSubmit={false}
|
||||
/>
|
||||
</Box>
|
||||
<Group>
|
||||
<Button bg={colors['blue-button']}>Submit</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
<Box>
|
||||
|
||||
</Box>
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default CreatePolsekTerdekat;
|
||||
@@ -1,10 +1,35 @@
|
||||
import colors from '@/con/colors';
|
||||
import { Box, Stack, Tabs, TabsList, TabsPanel, TabsTab, Title } from '@mantine/core';
|
||||
import React from 'react';
|
||||
import CreateInfoWabahPenyakit from './ui/tambah_wabah_penyakit/page';
|
||||
import ListInfoWabahPenyakit from './ui/list_wabah_penyakit/page';
|
||||
|
||||
|
||||
function Page() {
|
||||
return (
|
||||
<div>
|
||||
Wabah Penyakit
|
||||
</div>
|
||||
<Box>
|
||||
<Stack gap={'xs'}>
|
||||
<Title order={3}>Info Wabah/Penyakit</Title>
|
||||
<Tabs defaultValue="create" color={colors['blue-button']} variant='pills'>
|
||||
<TabsList mb={10} bg={colors['BG-trans']} p={'xs'}>
|
||||
<TabsTab value="create" >
|
||||
Tambah Info Wabah/Penyakit
|
||||
</TabsTab>
|
||||
<TabsTab value="list" >
|
||||
List Info Wabah/Penyakit
|
||||
</TabsTab>
|
||||
</TabsList>
|
||||
|
||||
<TabsPanel value="create">
|
||||
<CreateInfoWabahPenyakit/>
|
||||
</TabsPanel>
|
||||
|
||||
<TabsPanel value="list">
|
||||
<ListInfoWabahPenyakit/>
|
||||
</TabsPanel>
|
||||
</Tabs>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { Box, Paper, Stack, Table, TableTbody, TableTh, TableThead, TableTr, Title } from '@mantine/core';
|
||||
import colors from '@/con/colors';
|
||||
import React from 'react';
|
||||
|
||||
function ListInfoWabahPenyakit() {
|
||||
return (
|
||||
<Box>
|
||||
<Paper bg={colors['white-1']} p={'md'} radius={10}>
|
||||
<Stack gap={'xs'}>
|
||||
<Title order={3}>List Info Wabah/Penyakit</Title>
|
||||
<Box>
|
||||
<Table striped withTableBorder withColumnBorders withRowBorders>
|
||||
<TableThead>
|
||||
<TableTr>
|
||||
<TableTh>Image</TableTh>
|
||||
<TableTh>Nama Info Wabah/Penyakit</TableTh>
|
||||
<TableTh>Deskripsi Info Wabah/Penyakit</TableTh>
|
||||
<TableTh>Aksi</TableTh>
|
||||
<TableTh>Detail</TableTh>
|
||||
</TableTr>
|
||||
</TableThead>
|
||||
<TableTbody>
|
||||
|
||||
</TableTbody>
|
||||
</Table>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default ListInfoWabahPenyakit;
|
||||
@@ -0,0 +1,45 @@
|
||||
import colors from '@/con/colors';
|
||||
import { Box, Button, Group, Paper, SimpleGrid, Stack, Text, TextInput, Title } from '@mantine/core';
|
||||
import { IconImageInPicture } from '@tabler/icons-react';
|
||||
import React from 'react';
|
||||
import { KesehatanEditor } from '../../../_com/kesehatanEditor';
|
||||
|
||||
function CreateInfoWabahPenyakit() {
|
||||
return (
|
||||
<Box>
|
||||
<Stack gap={'xs'}>
|
||||
<SimpleGrid cols={{ base: 1, md: 2 }}>
|
||||
<Box>
|
||||
<Paper bg={colors['white-1']} p={'md'}>
|
||||
<Stack gap={"xs"}>
|
||||
<Title order={4}>Tambah Info Wabah/Penyakit</Title>
|
||||
<Box>
|
||||
<Text fw={"bold"} fz={"sm"}>Masukkan Image</Text>
|
||||
<IconImageInPicture size={50} />
|
||||
</Box>
|
||||
<TextInput
|
||||
label={<Text fw={"bold"} fz={"sm"}>Nama Info Wabah/Penyakit</Text>}
|
||||
placeholder='Masukkan nama info wabah/penyakit'
|
||||
/>
|
||||
<Box>
|
||||
<Text fw={"bold"} fz={"sm"}>Deskripsi Info Wabah/Penyakit</Text>
|
||||
<KesehatanEditor
|
||||
showSubmit={false}
|
||||
/>
|
||||
</Box>
|
||||
<Group>
|
||||
<Button bg={colors['blue-button']}>Submit</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
<Box>
|
||||
|
||||
</Box>
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default CreateInfoWabahPenyakit;
|
||||
@@ -1,10 +1,34 @@
|
||||
import colors from '@/con/colors';
|
||||
import { Box, Stack, Tabs, TabsList, TabsPanel, TabsTab, Title } from '@mantine/core';
|
||||
import React from 'react';
|
||||
import CreateKontakDarurat from './ui/tambah_kontak_darurat/page';
|
||||
import ListKontakDarurat from './ui/list_kontak_darurat/page';
|
||||
|
||||
function Page() {
|
||||
return (
|
||||
<div>
|
||||
Kontak Darurat
|
||||
</div>
|
||||
<Box>
|
||||
<Stack gap={'xs'}>
|
||||
<Title order={3}>Kontak Darurat</Title>
|
||||
<Tabs defaultValue="create" color={colors['blue-button']} variant='pills'>
|
||||
<TabsList mb={10} bg={colors['BG-trans']} p={'xs'}>
|
||||
<TabsTab value="create" >
|
||||
Tambah Kontak Darurat
|
||||
</TabsTab>
|
||||
<TabsTab value="list" >
|
||||
List Kontak Darurat
|
||||
</TabsTab>
|
||||
</TabsList>
|
||||
|
||||
<TabsPanel value="create">
|
||||
<CreateKontakDarurat />
|
||||
</TabsPanel>
|
||||
|
||||
<TabsPanel value="list">
|
||||
<ListKontakDarurat/>
|
||||
</TabsPanel>
|
||||
</Tabs>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { Box, Paper, Stack, Table, TableTbody, TableTh, TableThead, TableTr, Title } from '@mantine/core';
|
||||
import colors from '@/con/colors';
|
||||
import React from 'react';
|
||||
|
||||
function ListKontakDarurat() {
|
||||
return (
|
||||
<Box>
|
||||
<Paper bg={colors['white-1']} p={'md'} radius={10}>
|
||||
<Stack gap={'xs'}>
|
||||
<Title order={3}>List Kontak Darurat</Title>
|
||||
<Box>
|
||||
<Table striped withTableBorder withColumnBorders withRowBorders>
|
||||
<TableThead>
|
||||
<TableTr>
|
||||
<TableTh>Image</TableTh>
|
||||
<TableTh>Nama Kontak Darurat</TableTh>
|
||||
<TableTh>Deskripsi Kontak Darurat</TableTh>
|
||||
<TableTh>Aksi</TableTh>
|
||||
<TableTh>Detail</TableTh>
|
||||
</TableTr>
|
||||
</TableThead>
|
||||
<TableTbody>
|
||||
|
||||
</TableTbody>
|
||||
</Table>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default ListKontakDarurat;
|
||||
@@ -0,0 +1,45 @@
|
||||
import colors from '@/con/colors';
|
||||
import { Box, Button, Group, Paper, SimpleGrid, Stack, Text, TextInput, Title } from '@mantine/core';
|
||||
import { IconImageInPicture } from '@tabler/icons-react';
|
||||
import React from 'react';
|
||||
import { KesehatanEditor } from '../../../_com/kesehatanEditor';
|
||||
|
||||
function CreateKontakDarurat() {
|
||||
return (
|
||||
<Box>
|
||||
<Stack gap={'xs'}>
|
||||
<SimpleGrid cols={{ base: 1, md: 2 }}>
|
||||
<Box>
|
||||
<Paper bg={colors['white-1']} p={'md'}>
|
||||
<Stack gap={"xs"}>
|
||||
<Title order={4}>Tambah Kontak Darurat</Title>
|
||||
<Box>
|
||||
<Text fw={"bold"} fz={"sm"}>Masukkan Image</Text>
|
||||
<IconImageInPicture size={50} />
|
||||
</Box>
|
||||
<TextInput
|
||||
label={<Text fw={"bold"} fz={"sm"}>Nama Kontak Darurat</Text>}
|
||||
placeholder='Masukkan nama kontak darurat'
|
||||
/>
|
||||
<Box>
|
||||
<Text fw={"bold"} fz={"sm"}>Deskripsi Kontak Darurat</Text>
|
||||
<KesehatanEditor
|
||||
showSubmit={false}
|
||||
/>
|
||||
</Box>
|
||||
<Group>
|
||||
<Button bg={colors['blue-button']}>Submit</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
<Box>
|
||||
|
||||
</Box>
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default CreateKontakDarurat;
|
||||
@@ -1,10 +1,34 @@
|
||||
import colors from '@/con/colors';
|
||||
import { Box, Stack, Tabs, TabsList, TabsPanel, TabsTab, Title } from '@mantine/core';
|
||||
import React from 'react';
|
||||
import CreatePenangananDarurat from './ui/tambah_penanganan_darurat/page';
|
||||
import ListPenangananDarurat from './ui/list_penanganan_darurat/page';
|
||||
|
||||
function Page() {
|
||||
return (
|
||||
<div>
|
||||
Penanganan Darurat
|
||||
</div>
|
||||
<Box>
|
||||
<Stack gap={'xs'}>
|
||||
<Title order={3}>Penanganan Darurat</Title>
|
||||
<Tabs defaultValue="create" color={colors['blue-button']} variant='pills'>
|
||||
<TabsList mb={10} bg={colors['BG-trans']} p={'xs'}>
|
||||
<TabsTab value="create" >
|
||||
Tambah Penanganan Darurat
|
||||
</TabsTab>
|
||||
<TabsTab value="list" >
|
||||
List Penanganan Darurat
|
||||
</TabsTab>
|
||||
</TabsList>
|
||||
|
||||
<TabsPanel value="create">
|
||||
<CreatePenangananDarurat/>
|
||||
</TabsPanel>
|
||||
|
||||
<TabsPanel value="list">
|
||||
<ListPenangananDarurat/>
|
||||
</TabsPanel>
|
||||
</Tabs>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { Box, Paper, Stack, Table, TableTbody, TableTh, TableThead, TableTr, Title } from '@mantine/core';
|
||||
import colors from '@/con/colors';
|
||||
import React from 'react';
|
||||
|
||||
function ListPenangananDarurat() {
|
||||
return (
|
||||
<Box>
|
||||
<Paper bg={colors['white-1']} p={'md'} radius={10}>
|
||||
<Stack gap={'xs'}>
|
||||
<Title order={3}>List Penanganan Darurat</Title>
|
||||
<Box>
|
||||
<Table striped withTableBorder withColumnBorders withRowBorders>
|
||||
<TableThead>
|
||||
<TableTr>
|
||||
<TableTh>Image</TableTh>
|
||||
<TableTh>Nama Penanganan Darurat</TableTh>
|
||||
<TableTh>Deskripsi Penanganan Darurat</TableTh>
|
||||
<TableTh>Aksi</TableTh>
|
||||
<TableTh>Detail</TableTh>
|
||||
</TableTr>
|
||||
</TableThead>
|
||||
<TableTbody>
|
||||
|
||||
</TableTbody>
|
||||
</Table>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default ListPenangananDarurat;
|
||||
@@ -0,0 +1,45 @@
|
||||
import colors from '@/con/colors';
|
||||
import { Box, Button, Group, Paper, SimpleGrid, Stack, Text, TextInput, Title } from '@mantine/core';
|
||||
import { IconImageInPicture } from '@tabler/icons-react';
|
||||
import React from 'react';
|
||||
import { KesehatanEditor } from '../../../_com/kesehatanEditor';
|
||||
|
||||
function CreatePenangananDarurat() {
|
||||
return (
|
||||
<Box>
|
||||
<Stack gap={'xs'}>
|
||||
<SimpleGrid cols={{ base: 1, md: 2 }}>
|
||||
<Box>
|
||||
<Paper bg={colors['white-1']} p={'md'}>
|
||||
<Stack gap={"xs"}>
|
||||
<Title order={4}>Tambah Penanganan Darurat</Title>
|
||||
<Box>
|
||||
<Text fw={"bold"} fz={"sm"}>Masukkan Image</Text>
|
||||
<IconImageInPicture size={50} />
|
||||
</Box>
|
||||
<TextInput
|
||||
label={<Text fw={"bold"} fz={"sm"}>Nama Penanganan Darurat</Text>}
|
||||
placeholder='Masukkan nama penanganan darurat'
|
||||
/>
|
||||
<Box>
|
||||
<Text fw={"bold"} fz={"sm"}>Deskripsi Penanganan Darurat</Text>
|
||||
<KesehatanEditor
|
||||
showSubmit={false}
|
||||
/>
|
||||
</Box>
|
||||
<Group>
|
||||
<Button bg={colors['blue-button']}>Submit</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
<Box>
|
||||
|
||||
</Box>
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default CreatePenangananDarurat;
|
||||
@@ -1,10 +1,33 @@
|
||||
import React from 'react';
|
||||
import colors from '@/con/colors';
|
||||
import { Box, Stack, Tabs, TabsList, TabsPanel, TabsTab, Title } from '@mantine/core';
|
||||
import CreateProgramKesehatan from './ui/tambah_program_kesehatan/page';
|
||||
import ListProgramKesehatan from './ui/list_program_kesehatan/page';
|
||||
|
||||
function Page() {
|
||||
return (
|
||||
<div>
|
||||
Program Kesehatan
|
||||
</div>
|
||||
<Box>
|
||||
<Stack gap={'xs'}>
|
||||
<Title order={3}>Program Kesehatan</Title>
|
||||
<Tabs defaultValue="create" color={colors['blue-button']} variant='pills'>
|
||||
<TabsList mb={10} bg={colors['BG-trans']} p={'xs'}>
|
||||
<TabsTab value="create" >
|
||||
Tambah Program Kesehatan
|
||||
</TabsTab>
|
||||
<TabsTab value="list" >
|
||||
List Program Kesehatan
|
||||
</TabsTab>
|
||||
</TabsList>
|
||||
|
||||
<TabsPanel value="create">
|
||||
<CreateProgramKesehatan />
|
||||
</TabsPanel>
|
||||
|
||||
<TabsPanel value="list">
|
||||
<ListProgramKesehatan/>
|
||||
</TabsPanel>
|
||||
</Tabs>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
|
||||
function DetailProgramKesehatan() {
|
||||
return (
|
||||
<div>
|
||||
Page
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default DetailProgramKesehatan;
|
||||
@@ -0,0 +1,33 @@
|
||||
import { Box, Paper, Stack, Table, TableTbody, TableTh, TableThead, TableTr, Title } from '@mantine/core';
|
||||
import colors from '@/con/colors';
|
||||
import React from 'react';
|
||||
|
||||
function ListProgramKesehatan() {
|
||||
return (
|
||||
<Box>
|
||||
<Paper bg={colors['white-1']} p={'md'} radius={10}>
|
||||
<Stack gap={'xs'}>
|
||||
<Title order={3}>List Program Kesehatan</Title>
|
||||
<Box>
|
||||
<Table striped withRowBorders withColumnBorders withTableBorder>
|
||||
<TableThead>
|
||||
<TableTr>
|
||||
<TableTh>Deskripsi Program Kesehatan</TableTh>
|
||||
<TableTh>Nama Konten Program Kesehatan</TableTh>
|
||||
<TableTh>Deskripsi Konten Program Kesehatan</TableTh>
|
||||
<TableTh>Aksi</TableTh>
|
||||
<TableTh>Detail</TableTh>
|
||||
</TableTr>
|
||||
</TableThead>
|
||||
<TableTbody>
|
||||
|
||||
</TableTbody>
|
||||
</Table>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default ListProgramKesehatan;
|
||||
@@ -0,0 +1,62 @@
|
||||
import colors from '@/con/colors';
|
||||
import { Box, Button, Group, Paper, SimpleGrid, Stack, Text, TextInput, Title } from '@mantine/core';
|
||||
import React from 'react';
|
||||
import { KesehatanEditor } from '../../../_com/kesehatanEditor';
|
||||
import { IconImageInPicture } from '@tabler/icons-react';
|
||||
|
||||
function CreateProgramKesehatan() {
|
||||
return (
|
||||
<Box>
|
||||
<Stack gap={'xs'}>
|
||||
<SimpleGrid cols={{ base: 1, md: 2 }}>
|
||||
<Box>
|
||||
<Paper bg={colors['white-1']} p={'md'}>
|
||||
<Stack gap={'xs'}>
|
||||
<Title order={4}>Tambah Program Kesehatan</Title>
|
||||
<Box>
|
||||
<Text fw={"bold"} fz={"sm"}>Deskripsi Program Kesehatan</Text>
|
||||
<KesehatanEditor
|
||||
showSubmit={false}
|
||||
/>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Masukkan Image</Text>
|
||||
<IconImageInPicture size={50} />
|
||||
</Box>
|
||||
<TextInput
|
||||
label={<Text fw={"bold"} fz={"sm"}>Nama Konten Program Kesehatan</Text>}
|
||||
placeholder='Masukkan nama konten program kesehatan'
|
||||
/>
|
||||
<Box>
|
||||
<Text fw={"bold"} fz={"sm"}>Deskripsi Konten Program Kesehatan</Text>
|
||||
<KesehatanEditor
|
||||
showSubmit={false}
|
||||
/>
|
||||
</Box>
|
||||
<Group>
|
||||
<Button bg={colors['blue-button']}>Submit</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
<Box>
|
||||
<Paper bg={colors['white-1']} p={"md"}>
|
||||
<Stack gap={"xs"}>
|
||||
<Title order={4}>Preview Data Program Kesehatan</Title>
|
||||
<Text fw={"bold"} fz={"sm"}>Deskripsi Program Kesehatan</Text>
|
||||
<Box>
|
||||
<Text fw={"bold"} fz={"sm"}>Image</Text>
|
||||
<IconImageInPicture size={50} />
|
||||
</Box>
|
||||
<Text fw={"bold"} fz={"sm"}>Nama Konten Program Kesehatan</Text>
|
||||
<Text fw={"bold"} fz={"sm"}>Deskripsi Konten Program Kesehatan</Text>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default CreateProgramKesehatan;
|
||||
@@ -8,6 +8,7 @@ import TextAlign from '@tiptap/extension-text-align';
|
||||
import Underline from '@tiptap/extension-underline';
|
||||
import { useEditor } from '@tiptap/react';
|
||||
import StarterKit from '@tiptap/starter-kit';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
|
||||
export function PPIDTextEditor({ onSubmit, onChange, showSubmit = true, initialContent = '', }: {
|
||||
@@ -32,6 +33,12 @@ export function PPIDTextEditor({ onSubmit, onChange, showSubmit = true, initialC
|
||||
}
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (editor && initialContent !== editor.getHTML()) {
|
||||
editor.commands.setContent(initialContent || '<p></p>');
|
||||
}
|
||||
}, [initialContent, editor]);
|
||||
|
||||
return (
|
||||
<Stack>
|
||||
<RichTextEditor editor={editor}>
|
||||
|
||||
44
src/app/admin/(dashboard)/ppid/dasar-hukum/create/create.tsx
Normal file
44
src/app/admin/(dashboard)/ppid/dasar-hukum/create/create.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
'use client'
|
||||
import { Box, Stack, Text } from '@mantine/core';
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
const PPIDTextEditor = dynamic(() => import('../../_com/PPIDTextEditor').then(mod => mod.PPIDTextEditor), {
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
function CreateDasarHukum({
|
||||
valueJudul,
|
||||
valueContent,
|
||||
onJudulChange,
|
||||
onContentChange,
|
||||
error
|
||||
} : {
|
||||
valueJudul: string;
|
||||
valueContent: string;
|
||||
onJudulChange: (val: string) => void;
|
||||
onContentChange: (val: string) => void;
|
||||
error?: string;
|
||||
}) {
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<Stack gap={"xs"}>
|
||||
<Text fw={"bold"}>Judul</Text>
|
||||
<PPIDTextEditor
|
||||
showSubmit={false}
|
||||
onChange={onJudulChange}
|
||||
initialContent={valueJudul}
|
||||
/>
|
||||
<Text fw={"bold"}>Content</Text>
|
||||
<PPIDTextEditor
|
||||
showSubmit={false}
|
||||
onChange={onContentChange}
|
||||
initialContent={valueContent}
|
||||
/>
|
||||
{error && <Text c="red" size="sm">{error}</Text>}
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default CreateDasarHukum;
|
||||
@@ -1,64 +0,0 @@
|
||||
'use client'
|
||||
import { Box, Button, Group, Stack, Text } from '@mantine/core';
|
||||
import { useProxy } from 'valtio/utils';
|
||||
import stateDasarHukumPPID from '../../../_state/ppid/dasar_hukum/dasarHukum';
|
||||
import dynamic from 'next/dynamic';
|
||||
import colors from '@/con/colors';
|
||||
import { useShallowEffect } from '@mantine/hooks';
|
||||
|
||||
const PPIDTextEditor = dynamic(() => import('../../_com/PPIDTextEditor').then(mod => mod.PPIDTextEditor), {
|
||||
ssr: false,
|
||||
});
|
||||
function CreateDasarHukum() {
|
||||
const dasarHukumState = useProxy(stateDasarHukumPPID)
|
||||
useShallowEffect(() => {
|
||||
if (!dasarHukumState.findById.data) {
|
||||
dasarHukumState.findById.load(""); // biar masuk ke `findFirst` route kamu
|
||||
}
|
||||
}, []);
|
||||
|
||||
const submit = () => {
|
||||
if (dasarHukumState.findById.data?.judul && dasarHukumState.findById.data?.content) {
|
||||
dasarHukumState.update.save(dasarHukumState.findById.data)
|
||||
}
|
||||
}
|
||||
return (
|
||||
<Box>
|
||||
<Stack gap={"xs"}>
|
||||
<Text fw={"bold"}>Judul</Text>
|
||||
<PPIDTextEditor
|
||||
showSubmit={false}
|
||||
key={`judul-${dasarHukumState.findById.data?.id ?? 'new'}`}
|
||||
onChange={(val) => {
|
||||
if (dasarHukumState.findById.data) {
|
||||
dasarHukumState.findById.data.judul = val
|
||||
}
|
||||
}}
|
||||
initialContent={dasarHukumState.findById.data?.judul ?? ''}
|
||||
/>
|
||||
<Text fw={"bold"}>Content</Text>
|
||||
<PPIDTextEditor
|
||||
showSubmit={false}
|
||||
key={`content-${dasarHukumState.findById.data?.id ?? 'baru'}`}
|
||||
onChange={(val) => {
|
||||
if (dasarHukumState.findById.data) {
|
||||
dasarHukumState.findById.data.content = val
|
||||
}
|
||||
}}
|
||||
initialContent={dasarHukumState.findById.data?.content ?? ''}
|
||||
/>
|
||||
<Group>
|
||||
<Button
|
||||
bg={colors['blue-button']}
|
||||
onClick={submit}
|
||||
loading={dasarHukumState.update.loading}
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default CreateDasarHukum;
|
||||
@@ -1,21 +1,59 @@
|
||||
'use client'
|
||||
import colors from '@/con/colors';
|
||||
import { Box, Paper, SimpleGrid, Stack, Title } from '@mantine/core';
|
||||
import CreateDasarHukum from './create/page';
|
||||
import { Box, Button, Group, Paper, SimpleGrid, Stack, Title } from '@mantine/core';
|
||||
import CreateDasarHukum from './create/create';
|
||||
import ListDataDasarHukum from './listData/page';
|
||||
import { useShallowEffect } from '@mantine/hooks';
|
||||
import { useProxy } from 'valtio/utils';
|
||||
import stateDasarHukumPPID from '../../_state/ppid/dasar_hukum/dasarHukum';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
function Page() {
|
||||
const dasarHukumState = useProxy(stateDasarHukumPPID)
|
||||
const [judul, setJudul] = useState('');
|
||||
const [content, setContent] = useState('');
|
||||
|
||||
useShallowEffect(() => {
|
||||
if (!dasarHukumState.findById.data) {
|
||||
dasarHukumState.findById.initialize(); // biar masuk ke `findFirst` route kamu
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (dasarHukumState.findById.data) {
|
||||
setJudul(dasarHukumState.findById.data.judul ?? '')
|
||||
setContent(dasarHukumState.findById.data.content ?? '')
|
||||
}
|
||||
}, [dasarHukumState.findById.data])
|
||||
|
||||
const submit = () => {
|
||||
if (dasarHukumState.findById.data) {
|
||||
dasarHukumState.findById.data.judul = judul;
|
||||
dasarHukumState.findById.data.content = content;
|
||||
dasarHukumState.update.save(dasarHukumState.findById.data)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Stack gap={"xs"}>
|
||||
<SimpleGrid cols={{ base: 1, md: 2 }}>
|
||||
<Box>
|
||||
<Paper bg={colors['white-1']} p={'md'} radius={10}>
|
||||
<Title order={3}>Dasar Hukum PPID</Title>
|
||||
<CreateDasarHukum/>
|
||||
<Title order={3}>Dasar Hukum PPID</Title>
|
||||
<CreateDasarHukum onJudulChange={setJudul} onContentChange={setContent} valueJudul={judul} valueContent={content} />
|
||||
<Group>
|
||||
<Button
|
||||
mt={10}
|
||||
bg={colors['blue-button']}
|
||||
onClick={submit}
|
||||
loading={dasarHukumState.update.loading}
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
</Group>
|
||||
</Paper>
|
||||
</Box>
|
||||
<ListDataDasarHukum/>
|
||||
<ListDataDasarHukum />
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ function Page() {
|
||||
<Paper bg={colors['white-1']} p={'md'}>
|
||||
<Stack gap={"xs"}>
|
||||
<Title order={3}>Permohonan Informasi Publik</Title>
|
||||
<Box p={"xl"}>
|
||||
<Box>
|
||||
<Table striped withRowBorders withColumnBorders withTableBorder>
|
||||
<TableThead>
|
||||
<TableTr>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
'use client'
|
||||
import { Box, Text } from '@mantine/core';
|
||||
import { PPIDTextEditor } from '../../_com/PPIDTextEditor';
|
||||
|
||||
function MisiPPID({
|
||||
value,
|
||||
onChange,
|
||||
error,
|
||||
}: {
|
||||
value: string;
|
||||
onChange: (val: string) => void;
|
||||
error?: string;
|
||||
}) {
|
||||
return (
|
||||
<Box>
|
||||
<Text fw={'bold'}>Misi PPID</Text>
|
||||
<PPIDTextEditor
|
||||
showSubmit={false}
|
||||
initialContent={value}
|
||||
onChange={onChange}
|
||||
/>
|
||||
{error && <Text c="red" size="sm">{error}</Text>}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default MisiPPID;
|
||||
@@ -1,26 +0,0 @@
|
||||
'use client'
|
||||
import { Box, Text } from '@mantine/core';
|
||||
import { useProxy } from 'valtio/utils';
|
||||
import { PPIDTextEditor } from '../../_com/PPIDTextEditor';
|
||||
import stateVisiMisiPPID from '../../../_state/ppid/visi_misi_ppid/visimisiPPID';
|
||||
|
||||
function MisiPPID() {
|
||||
const misiState = useProxy(stateVisiMisiPPID)
|
||||
return (
|
||||
<Box>
|
||||
<Text fw={"bold"}>Misi PPID</Text>
|
||||
<PPIDTextEditor
|
||||
key={misiState.findById.data?.id ?? 'new'}
|
||||
showSubmit={false}
|
||||
onChange={(val) => {
|
||||
if(misiState.findById.data){
|
||||
misiState.findById.data.misi = val
|
||||
}
|
||||
}}
|
||||
initialContent={misiState.findById.data?.misi ?? ''}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default MisiPPID;
|
||||
@@ -1,11 +1,16 @@
|
||||
'use client'
|
||||
import colors from '@/con/colors';
|
||||
import { Box, Button, Group, Paper, SimpleGrid, Skeleton, Stack, Text, Title } from '@mantine/core';
|
||||
import {
|
||||
Box, Button, Group, Paper, SimpleGrid, Skeleton, Stack, Text, Title
|
||||
} from '@mantine/core';
|
||||
import { useShallowEffect } from '@mantine/hooks';
|
||||
import { useProxy } from 'valtio/utils';
|
||||
import { useEffect, useState } from 'react';
|
||||
import stateVisiMisiPPID from '../../_state/ppid/visi_misi_ppid/visimisiPPID';
|
||||
import MisiPPID from './misiPPID/page';
|
||||
import VisiPPID from './visiPPID/page';
|
||||
import VisiPPID from './visiPPID/visi-PPID';
|
||||
import MisiPPID from './misiPPID/misi-PPID';
|
||||
|
||||
|
||||
|
||||
function Page() {
|
||||
return (
|
||||
@@ -19,26 +24,38 @@ function Page() {
|
||||
}
|
||||
|
||||
function VisiMisiPPIDCreate() {
|
||||
const visiMisi = useProxy(stateVisiMisiPPID)
|
||||
const visiMisi = useProxy(stateVisiMisiPPID);
|
||||
const [draftVisi, setDraftVisi] = useState('');
|
||||
const [draftMisi, setDraftMisi] = useState('');
|
||||
|
||||
useShallowEffect(() => {
|
||||
if(!visiMisi.findById.data){
|
||||
visiMisi.findById.initialize()
|
||||
if (!visiMisi.findById.data) {
|
||||
visiMisi.findById.initialize();
|
||||
}
|
||||
}, [])
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (visiMisi.findById.data) {
|
||||
setDraftVisi(visiMisi.findById.data.visi ?? '');
|
||||
setDraftMisi(visiMisi.findById.data.misi ?? '');
|
||||
}
|
||||
}, [visiMisi.findById.data]);
|
||||
|
||||
const submit = () => {
|
||||
if(visiMisi.findById.data?.misi && visiMisi.findById.data?.visi){
|
||||
visiMisi.update.save(visiMisi.findById.data)
|
||||
if (visiMisi.findById.data) {
|
||||
// update nilai di state global hanya saat submit
|
||||
visiMisi.findById.data.visi = draftVisi;
|
||||
visiMisi.findById.data.misi = draftMisi;
|
||||
visiMisi.update.save(visiMisi.findById.data);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Paper bg={colors['white-1']} p={'md'} radius={10}>
|
||||
<Stack gap={"xs"}>
|
||||
<Stack gap={'xs'}>
|
||||
<Title order={3}>Visi Misi PPID</Title>
|
||||
<VisiPPID />
|
||||
<MisiPPID />
|
||||
<VisiPPID value={draftVisi} onChange={setDraftVisi} />
|
||||
<MisiPPID value={draftMisi} onChange={setDraftMisi} />
|
||||
<Group>
|
||||
<Button
|
||||
bg={colors['blue-button']}
|
||||
@@ -50,34 +67,48 @@ function VisiMisiPPIDCreate() {
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function VisiMisiPPIDList() {
|
||||
const listVisiMisi = useProxy(stateVisiMisiPPID)
|
||||
const listVisiMisi = useProxy(stateVisiMisiPPID);
|
||||
useShallowEffect(() => {
|
||||
listVisiMisi.findById.load("1")
|
||||
}, [])
|
||||
listVisiMisi.findById.load('1');
|
||||
}, []);
|
||||
|
||||
if(!listVisiMisi.findById.data) return <Stack>
|
||||
{Array.from({length: 10}).map((v, k) => <Skeleton key={k} h={40} />)}
|
||||
</Stack>
|
||||
if (!listVisiMisi.findById.data) {
|
||||
return (
|
||||
<Stack>
|
||||
{Array.from({ length: 10 }).map((_, k) => (
|
||||
<Skeleton key={k} h={40} />
|
||||
))}
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Paper bg={colors['white-1']} p={'md'} radius={10}>
|
||||
<Stack gap={"xs"}>
|
||||
<Stack gap={'xs'}>
|
||||
<Title order={3}>List Visi Misi PPID</Title>
|
||||
<Box>
|
||||
<Text fw={"bold"}>Visi PPID</Text>
|
||||
<Text dangerouslySetInnerHTML={{__html: listVisiMisi.findById.data?.visi}}></Text>
|
||||
<Text fw={'bold'}>Visi PPID</Text>
|
||||
<Text
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: listVisiMisi.findById.data.visi,
|
||||
}}
|
||||
></Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text fw={"bold"}>Misi PPID</Text>
|
||||
<Text dangerouslySetInnerHTML={{__html: listVisiMisi.findById.data?.misi}}></Text>
|
||||
<Text fw={'bold'}>Misi PPID</Text>
|
||||
<Text
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: listVisiMisi.findById.data.misi,
|
||||
}}
|
||||
></Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Paper>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export default Page;
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
'use client'
|
||||
import { Box, Text } from '@mantine/core';
|
||||
import { useProxy } from 'valtio/utils';
|
||||
import { PPIDTextEditor } from '../../_com/PPIDTextEditor';
|
||||
import stateVisiMisiPPID from '../../../_state/ppid/visi_misi_ppid/visimisiPPID';
|
||||
|
||||
function VisiPPID() {
|
||||
const visiState = useProxy(stateVisiMisiPPID)
|
||||
return (
|
||||
<Box>
|
||||
<Text fw={"bold"}>Visi PPID</Text>
|
||||
<PPIDTextEditor
|
||||
key={visiState.findById.data?.id ?? 'new'}
|
||||
showSubmit={false}
|
||||
onChange={(val) => {
|
||||
if(visiState.findById.data){
|
||||
visiState.findById.data.visi = val
|
||||
}
|
||||
}}
|
||||
initialContent={visiState.findById.data?.visi ?? ''}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default VisiPPID;
|
||||
@@ -0,0 +1,27 @@
|
||||
'use client'
|
||||
import { Box, Text } from '@mantine/core';
|
||||
import { PPIDTextEditor } from '../../_com/PPIDTextEditor';
|
||||
|
||||
function VisiPPID({
|
||||
value,
|
||||
onChange,
|
||||
error,
|
||||
}: {
|
||||
value: string;
|
||||
onChange: (val: string) => void;
|
||||
error?: string;
|
||||
}) {
|
||||
return (
|
||||
<Box>
|
||||
<Text fw={'bold'}>Visi PPID</Text>
|
||||
<PPIDTextEditor
|
||||
showSubmit={false}
|
||||
initialContent={value}
|
||||
onChange={onChange}
|
||||
/>
|
||||
{error && <Text c="red" size="sm">{error}</Text>}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default VisiPPID;
|
||||
Reference in New Issue
Block a user