Initial commit, repo migration
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
import { DatatablePrime } from '@/components/Datatables'
|
||||
import { DialogDelete } from '@/components/Dialog'
|
||||
import FormAkun from '@/components/Form/Akun'
|
||||
import { Belakang } from '@/components/Layouts'
|
||||
import { Judul } from '@/components/TextCustom'
|
||||
import { AkunDelete, AkunGetOne, AkunList } from '@/services/referensi/akun-service'
|
||||
import Head from 'next/head'
|
||||
import { Button } from 'primereact/button'
|
||||
import { Column } from 'primereact/column'
|
||||
import { Toast } from 'primereact/toast'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
|
||||
export default function Akun() {
|
||||
const toast = useRef(null)
|
||||
const [data, setData] = useState([])
|
||||
const [dataDrawPrev, setDataDrawPrev] = useState([])
|
||||
const [dataDrawNext, setDataDrawNext] = useState([])
|
||||
|
||||
const [dialogForm, setDialogForm] = useState(false)
|
||||
const [dataEdit, setDataEdit] = useState([])
|
||||
const [refresh, setRefresh] = useState(0)
|
||||
const [search, setSearch] = useState('')
|
||||
const [dialogDelete, setDialogDelete] = useState({})
|
||||
const [draw, setDraw] = useState(1)
|
||||
|
||||
useEffect(() => {
|
||||
let params = {}
|
||||
params.draw = draw
|
||||
search !== null && search !== '' ? (params.search = search) : ''
|
||||
AkunList(params).then((res) => setData(res.data))
|
||||
|
||||
if (draw > 1) {
|
||||
params.draw = draw > 1 ? draw - 1 : draw
|
||||
AkunList(params).then((res) => setDataDrawPrev(res.data))
|
||||
}
|
||||
|
||||
params.draw = draw + 1
|
||||
AkunList(params).then((res) => setDataDrawNext(res.data))
|
||||
}, [refresh, search, draw])
|
||||
|
||||
const editAkun = (data) => {
|
||||
AkunGetOne({ akun_id: data.akun_id }).then((res) => {
|
||||
if (res.status === 'ok') {
|
||||
setDataEdit(res.data)
|
||||
setDialogForm(true)
|
||||
} else {
|
||||
console.log(res.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const actionBodyTemplate = (rowData) => {
|
||||
return (
|
||||
<div className='flex gap-x-2'>
|
||||
<Button icon='pi pi-pencil' className='p-button-sm p-button-rounded' onClick={() => editAkun(rowData)} />
|
||||
<Button
|
||||
icon='pi pi-trash'
|
||||
className='p-button-sm p-button-rounded p-button-danger'
|
||||
onClick={() => setDialogDelete({ akun_id: rowData.akun_id, visible: true })}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const deleteAkun = () => {
|
||||
AkunDelete({ ref_id: dialogDelete.ref_id }).then((res) => {
|
||||
if (res.status === 'success') {
|
||||
setRefresh(Math.random)
|
||||
setDialogDelete({ visible: false })
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
detail: res.message,
|
||||
closable: false,
|
||||
})
|
||||
} else {
|
||||
setDialogDelete({ visible: false })
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
detail: res.message,
|
||||
closable: false,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Toast ref={toast} />
|
||||
<Head>
|
||||
<title>Akun</title>
|
||||
</Head>
|
||||
<Belakang>
|
||||
<Judul>Akun</Judul>
|
||||
<DatatablePrime
|
||||
data={data}
|
||||
dataDrawPrev={dataDrawPrev}
|
||||
dataDrawNext={dataDrawNext}
|
||||
draw={draw}
|
||||
setDraw={setDraw}
|
||||
setSearch={setSearch}
|
||||
dialogForm={dialogForm}
|
||||
setDialogForm={setDialogForm}
|
||||
Form={FormAkun}
|
||||
buttonAdd={true}
|
||||
buttonAddLabel='Tambah data'
|
||||
dataEdit={dataEdit}
|
||||
setDataEdit={setDataEdit}
|
||||
toast={toast}
|
||||
refresh={setRefresh}
|
||||
>
|
||||
<Column field='akun_id' header='Nomor Akun' sortable></Column>
|
||||
<Column field='nama' header='Nama Akun' sortable></Column>
|
||||
<Column header='Action' body={actionBodyTemplate} exportable={false}></Column>
|
||||
</DatatablePrime>
|
||||
</Belakang>
|
||||
|
||||
{dialogDelete.visible === true && (
|
||||
<DialogDelete data={dialogDelete} setDelete={setDialogDelete} onCallback={deleteAkun} />
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
import { DatatablePrime } from '@/components/Datatables'
|
||||
import { DialogDelete } from '@/components/Dialog'
|
||||
import FormJenisBelanja from '@/components/Form/JenisBelanja'
|
||||
import { Belakang } from '@/components/Layouts'
|
||||
import { Judul } from '@/components/TextCustom'
|
||||
import { JenisBelanjaDelete, JenisBelanjaGetOne, JenisBelanjaList } from '@/services/referensi/jenisBelanja-service'
|
||||
import Head from 'next/head'
|
||||
import { Button } from 'primereact/button'
|
||||
import { Column } from 'primereact/column'
|
||||
import { Toast } from 'primereact/toast'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
|
||||
export default function JenisBelanja() {
|
||||
const toast = useRef(null)
|
||||
const [data, setData] = useState([])
|
||||
const [dialogForm, setDialogForm] = useState(false)
|
||||
const [dataEdit, setDataEdit] = useState([])
|
||||
const [refresh, setRefresh] = useState(0)
|
||||
const [search, setSearch] = useState('')
|
||||
const [dialogDelete, setDialogDelete] = useState({})
|
||||
|
||||
useEffect(() => {
|
||||
let params = {}
|
||||
search !== null && search !== '' ? (params.search = search) : ''
|
||||
JenisBelanjaList(params).then((res) => setData(res.data))
|
||||
}, [refresh, search])
|
||||
|
||||
const editJenisBelanja = (data) => {
|
||||
JenisBelanjaGetOne({ ref_id: data.jenis_id }).then((res) => {
|
||||
if (res.status === 'ok') {
|
||||
setDataEdit(res.data)
|
||||
setDialogForm(true)
|
||||
} else {
|
||||
console.log(res.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const deleteJenisBelanja = () => {
|
||||
JenisBelanjaDelete({ ref_id: dialogDelete.ref_id }).then((res) => {
|
||||
if (res.status === 'success') {
|
||||
setRefresh(Math.random)
|
||||
setDialogDelete({ visible: false })
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
detail: res.message,
|
||||
closable: false,
|
||||
})
|
||||
} else {
|
||||
setDialogDelete({ visible: false })
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
detail: res.message,
|
||||
closable: false,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const actionBodyTemplate = (rowData) => {
|
||||
return (
|
||||
<div className='flex gap-x-2'>
|
||||
<Button
|
||||
icon='pi pi-pencil'
|
||||
className='p-button-sm p-button-rounded'
|
||||
onClick={() => editJenisBelanja(rowData)}
|
||||
/>
|
||||
<Button
|
||||
icon='pi pi-trash'
|
||||
className='p-button-sm p-button-rounded'
|
||||
onClick={() => setDialogDelete({ ref_id: rowData.jenis_id, visible: true })}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Toast ref={toast} />
|
||||
<Head>
|
||||
<title>Jenis Belanja</title>
|
||||
</Head>
|
||||
<Belakang>
|
||||
<Judul>Jenis Belanja</Judul>
|
||||
<DatatablePrime
|
||||
data={data}
|
||||
setSearch={setSearch}
|
||||
dialogForm={dialogForm}
|
||||
setDialogForm={setDialogForm}
|
||||
Form={FormJenisBelanja}
|
||||
buttonAdd={true}
|
||||
buttonAddLabel='Tambah data'
|
||||
dataEdit={dataEdit}
|
||||
setDataEdit={setDataEdit}
|
||||
toast={toast}
|
||||
refresh={setRefresh}
|
||||
>
|
||||
<Column field='nama' header='Nama' sortable></Column>
|
||||
<Column header='Action' body={actionBodyTemplate} exportable={false}></Column>
|
||||
</DatatablePrime>
|
||||
</Belakang>
|
||||
|
||||
{dialogDelete.visible === true && (
|
||||
<DialogDelete data={dialogDelete} setDelete={setDialogDelete} onCallback={deleteJenisBelanja} />
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
import { DatatablePrime } from '@/components/Datatables'
|
||||
import { DialogDelete } from '@/components/Dialog'
|
||||
import FormJenisKegiatan from '@/components/Form/JenisKegiatan'
|
||||
import { Belakang } from '@/components/Layouts'
|
||||
import { Judul } from '@/components/TextCustom'
|
||||
import { JenisKegiatanDelete, JenisKegiatanGetOne, JenisKegiatanList } from '@/services/referensi/jenisKegiatan-service'
|
||||
import Head from 'next/head'
|
||||
import { Button } from 'primereact/button'
|
||||
import { Column } from 'primereact/column'
|
||||
import { Toast } from 'primereact/toast'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
|
||||
export default function JenisKegiatan() {
|
||||
const toast = useRef(null)
|
||||
const [data, setData] = useState([])
|
||||
const [dialogForm, setDialogForm] = useState(false)
|
||||
const [dataEdit, setDataEdit] = useState([])
|
||||
const [refresh, setRefresh] = useState(0)
|
||||
const [search, setSearch] = useState('')
|
||||
const [dialogDelete, setDialogDelete] = useState({})
|
||||
const [dataDrawPrev, setDataDrawPrev] = useState([])
|
||||
const [dataDrawNext, setDataDrawNext] = useState([])
|
||||
const [draw, setDraw] = useState(1)
|
||||
|
||||
useEffect(() => {
|
||||
let params = {}
|
||||
|
||||
if (search !== null && search !== '') {
|
||||
params.search = search
|
||||
} else {
|
||||
params.search = ''
|
||||
}
|
||||
|
||||
params.draw = draw
|
||||
JenisKegiatanList(params).then((res) => setData(res.data))
|
||||
|
||||
if (draw > 1) {
|
||||
params.draw = draw > 1 ? draw - 1 : draw
|
||||
JenisKegiatanList(params).then((res) => setDataDrawPrev(res.data))
|
||||
}
|
||||
params.draw = draw + 1
|
||||
JenisKegiatanList(params).then((res) => setDataDrawNext(res.data))
|
||||
}, [search, refresh, draw])
|
||||
|
||||
const editJenisKegiatan = (data) => {
|
||||
JenisKegiatanGetOne({ ref_id: data.jenis_id }).then((res) => {
|
||||
if (res.status === 'ok') {
|
||||
setDataEdit(res.data)
|
||||
setDialogForm(true)
|
||||
} else {
|
||||
console.log(res.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const deleteJenisKegiatan = () => {
|
||||
JenisKegiatanDelete({ ref_id: dialogDelete.ref_id }).then((res) => {
|
||||
if (res.status === 'success') {
|
||||
setRefresh(Math.random)
|
||||
setDialogDelete({ visible: false })
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
detail: res.message,
|
||||
closable: false,
|
||||
})
|
||||
} else {
|
||||
setDialogDelete({ visible: false })
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
detail: res.message,
|
||||
closable: false,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const actionBodyTemplate = (rowData) => {
|
||||
return (
|
||||
<div className='flex gap-x-2'>
|
||||
<Button
|
||||
icon='pi pi-pencil'
|
||||
className='p-button-sm p-button-rounded'
|
||||
onClick={() => editJenisKegiatan(rowData)}
|
||||
/>
|
||||
<Button
|
||||
icon='pi pi-trash'
|
||||
className='p-button-sm p-button-rounded p-button-danger'
|
||||
onClick={() => setDialogDelete({ ref_id: rowData.jenis_id, visible: true })}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Toast ref={toast} />
|
||||
<Head>
|
||||
<title>Jenis Kegiatan</title>
|
||||
</Head>
|
||||
<Belakang>
|
||||
<Judul>Jenis Kegiatan</Judul>
|
||||
<DatatablePrime
|
||||
data={data}
|
||||
dataDrawPrev={dataDrawPrev}
|
||||
dataDrawNext={dataDrawNext}
|
||||
draw={draw}
|
||||
setDraw={setDraw}
|
||||
setSearch={setSearch}
|
||||
dialogForm={dialogForm}
|
||||
setDialogForm={setDialogForm}
|
||||
Form={FormJenisKegiatan}
|
||||
buttonAdd={true}
|
||||
buttonAddLabel='Tambah data'
|
||||
dataEdit={dataEdit}
|
||||
setDataEdit={setDataEdit}
|
||||
toast={toast}
|
||||
refresh={setRefresh}
|
||||
>
|
||||
<Column field='nama' header='Jenis Kegiatan' sortable></Column>
|
||||
<Column header='Action' body={actionBodyTemplate} exportable={false}></Column>
|
||||
</DatatablePrime>
|
||||
</Belakang>
|
||||
|
||||
{dialogDelete.visible === true && (
|
||||
<DialogDelete data={dialogDelete} setDelete={setDialogDelete} onCallback={deleteJenisKegiatan} />
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
import { DatatablePrime } from '@/components/Datatables'
|
||||
import { DialogDelete } from '@/components/Dialog'
|
||||
import FormJenisTagihan from '@/components/Form/JenisTagihan'
|
||||
import { Belakang } from '@/components/Layouts'
|
||||
import { Judul } from '@/components/TextCustom'
|
||||
import { JenisTagihanDelete, JenisTagihanGetOne, JenisTagihanList } from '@/services/referensi/jenisTagihan-service'
|
||||
import Head from 'next/head'
|
||||
import { Button } from 'primereact/button'
|
||||
import { Column } from 'primereact/column'
|
||||
import { Toast } from 'primereact/toast'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
|
||||
export default function JenisTagihan() {
|
||||
const toast = useRef(null)
|
||||
const [data, setData] = useState([])
|
||||
const [dialogForm, setDialogForm] = useState(false)
|
||||
const [dataEdit, setDataEdit] = useState([])
|
||||
const [refresh, setRefresh] = useState(0)
|
||||
const [search, setSearch] = useState('')
|
||||
const [dialogDelete, setDialogDelete] = useState({})
|
||||
|
||||
useEffect(() => {
|
||||
let params = {}
|
||||
|
||||
if (search !== null && search !== '') {
|
||||
params.search = search
|
||||
} else {
|
||||
params.search = ''
|
||||
}
|
||||
|
||||
JenisTagihanList(params).then((res) => setData(res.data))
|
||||
}, [refresh, search])
|
||||
|
||||
const editJenisTagihan = (data) => {
|
||||
JenisTagihanGetOne({ ref_id: data.jenis_id }).then((res) => {
|
||||
if (res.status === 'ok') {
|
||||
setDataEdit(res.data)
|
||||
setDialogForm(true)
|
||||
} else {
|
||||
console.log(res.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const deleteJenisTagihan = () => {
|
||||
JenisTagihanDelete({ ref_id: dialogDelete.ref_id }).then((res) => {
|
||||
if (res.status === 'success') {
|
||||
setRefresh(Math.random)
|
||||
setDialogDelete({ visible: false })
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
detail: res.message,
|
||||
closable: false,
|
||||
})
|
||||
} else {
|
||||
setDialogDelete({ visible: false })
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
detail: res.message,
|
||||
closable: false,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const actionBodyTemplate = (rowData) => {
|
||||
return (
|
||||
<div className='flex gap-x-2'>
|
||||
<Button
|
||||
icon='pi pi-pencil'
|
||||
className='p-button-sm p-button-rounded'
|
||||
onClick={() => editJenisTagihan(rowData)}
|
||||
/>
|
||||
<Button
|
||||
icon='pi pi-trash'
|
||||
className='p-button-sm p-button-rounded'
|
||||
onClick={() => setDialogDelete({ ref_id: rowData.jenis_id, visible: true })}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Toast ref={toast} />
|
||||
<Head>
|
||||
<title>Jenis Tagihan</title>
|
||||
</Head>
|
||||
<Belakang>
|
||||
<Judul>Jenis Tagihan</Judul>
|
||||
<DatatablePrime
|
||||
data={data}
|
||||
setSearch={setSearch}
|
||||
dialogForm={dialogForm}
|
||||
setDialogForm={setDialogForm}
|
||||
Form={FormJenisTagihan}
|
||||
buttonAdd={true}
|
||||
buttonAddLabel='Tambah data'
|
||||
dataEdit={dataEdit}
|
||||
setDataEdit={setDataEdit}
|
||||
toast={toast}
|
||||
refresh={setRefresh}
|
||||
>
|
||||
<Column field='nama' header='Nama' sortable></Column>
|
||||
<Column header='Action' body={actionBodyTemplate} exportable={false}></Column>
|
||||
</DatatablePrime>
|
||||
</Belakang>
|
||||
|
||||
{dialogDelete.visible === true && (
|
||||
<DialogDelete data={dialogDelete} setDelete={setDialogDelete} onCallback={deleteJenisTagihan} />
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
import { DatatablePrime } from '@/components/Datatables'
|
||||
import { DialogDelete } from '@/components/Dialog'
|
||||
import FormPersyaratan from '@/components/Form/Persyaratan'
|
||||
import { Belakang } from '@/components/Layouts'
|
||||
import { Judul } from '@/components/TextCustom'
|
||||
import { PersyaratanDelete, PersyaratanGetOne, PersyaratanList } from '@/services/referensi/persyaratan-service'
|
||||
import { Form, Formik } from 'formik'
|
||||
import Head from 'next/head'
|
||||
import { Button } from 'primereact/button'
|
||||
import { Column } from 'primereact/column'
|
||||
import { Dialog } from 'primereact/dialog'
|
||||
import { Dropdown } from 'primereact/dropdown'
|
||||
// import { Dropdown } from 'primereact/dropdown'
|
||||
import { Toast } from 'primereact/toast'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
|
||||
export default function Persyaratan() {
|
||||
const toast = useRef(null)
|
||||
const [data, setData] = useState([])
|
||||
const [dialogForm, setDialogForm] = useState(false)
|
||||
const [dataEdit, setDataEdit] = useState([])
|
||||
const [refresh, setRefresh] = useState(0)
|
||||
const [search, setSearch] = useState('')
|
||||
const [dialogDelete, setDialogDelete] = useState({})
|
||||
const [dialogUpload, setDialogUpload] = useState(false)
|
||||
const [dataDrawPrev, setDataDrawPrev] = useState([])
|
||||
const [dataDrawNext, setDataDrawNext] = useState([])
|
||||
const [draw, setDraw] = useState(1)
|
||||
|
||||
useEffect(() => {
|
||||
let params = {}
|
||||
|
||||
if (search !== null && search !== '') {
|
||||
params.search = search
|
||||
} else {
|
||||
params.search = ''
|
||||
}
|
||||
|
||||
params.draw = draw
|
||||
PersyaratanList(params).then((res) => setData(res.data))
|
||||
|
||||
if (draw > 1) {
|
||||
params.draw = draw > 1 ? draw - 1 : draw
|
||||
PersyaratanList(params).then((res) => setDataDrawPrev(res.data))
|
||||
}
|
||||
params.draw = draw + 1
|
||||
PersyaratanList(params).then((res) => setDataDrawNext(res.data))
|
||||
}, [search, refresh, draw])
|
||||
|
||||
const editPersyaratan = (data) => {
|
||||
PersyaratanGetOne({ syarat_id: data.syarat_id }).then((res) => {
|
||||
if (res.status === 'ok') {
|
||||
setDataEdit(res.data)
|
||||
setDialogForm(true)
|
||||
} else {
|
||||
console.log(res.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const deletePersyaratan = () => {
|
||||
PersyaratanDelete({ syarat_id: dialogDelete.syarat_id }).then((res) => {
|
||||
if (res.status === 'success') {
|
||||
setRefresh(Math.random)
|
||||
setDialogDelete({ visible: false })
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
detail: res.message,
|
||||
closable: false,
|
||||
})
|
||||
} else {
|
||||
setDialogDelete({ visible: false })
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
detail: res.message,
|
||||
closable: false,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const actionBodyTemplate = (rowData) => {
|
||||
return (
|
||||
<div className='flex gap-x-2'>
|
||||
<Button icon='pi pi-pencil' className='p-button-sm p-button-rounded' onClick={() => editPersyaratan(rowData)} />
|
||||
<Button
|
||||
icon='pi pi-trash'
|
||||
className='p-button-sm p-button-rounded p-button-danger'
|
||||
onClick={() => setDialogDelete({ syarat_id: rowData.syarat_id, visible: true })}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Toast ref={toast} />
|
||||
<Head>
|
||||
<title>Persyaratan</title>
|
||||
</Head>
|
||||
<Belakang>
|
||||
<Judul>Persyaratan</Judul>
|
||||
<DatatablePrime
|
||||
data={data}
|
||||
dataDrawPrev={dataDrawPrev}
|
||||
dataDrawNext={dataDrawNext}
|
||||
draw={draw}
|
||||
setDraw={setDraw}
|
||||
setSearch={setSearch}
|
||||
dialogForm={dialogForm}
|
||||
setDialogForm={setDialogForm}
|
||||
Form={FormPersyaratan}
|
||||
buttonUpload={true}
|
||||
buttonUploadLabel='Upload syarat'
|
||||
buttonAdd={true}
|
||||
buttonAddLabel='Tambah data'
|
||||
dataEdit={dataEdit}
|
||||
setDataEdit={setDataEdit}
|
||||
toast={toast}
|
||||
refresh={setRefresh}
|
||||
dialogUpload={dialogUpload}
|
||||
setDialogUpload={setDialogUpload}
|
||||
>
|
||||
<Column field='nama_tagihan' header='Nama Tagihan' sortable></Column>
|
||||
<Column field='nama_belanja' header='Nama Belanja' sortable></Column>
|
||||
<Column field='nama_kegiatan' header='Nama Kegiatan' sortable></Column>
|
||||
<Column field='syarat_dokumen' header='Syarat Dokumen' sortable></Column>
|
||||
<Column field='keterangan' header='Keterangan' sortable></Column>
|
||||
<Column header='Action' body={actionBodyTemplate} exportable={false}></Column>
|
||||
</DatatablePrime>
|
||||
</Belakang>
|
||||
|
||||
{dialogDelete.visible === true && (
|
||||
<DialogDelete data={dialogDelete} setDelete={setDialogDelete} onCallback={deletePersyaratan} />
|
||||
)}
|
||||
|
||||
<Dialog
|
||||
header='Upload File Persyaratan'
|
||||
visible={dialogUpload}
|
||||
style={{ width: '50vw' }}
|
||||
onHide={() => setDialogUpload(false)}
|
||||
>
|
||||
<Formik
|
||||
initialValues={{
|
||||
truncate: false,
|
||||
jenis_tagihan: '',
|
||||
fileupload: '',
|
||||
}}
|
||||
onSubmit={(values) => {
|
||||
console.log(values)
|
||||
}}
|
||||
>
|
||||
{({ values, handleChange, setFieldValue }) => {
|
||||
const onBrowseFile = async (event) => {
|
||||
const files = event.target.files
|
||||
if (files) {
|
||||
if (files[0].type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {
|
||||
setFieldValue('fileupload', files[0].name)
|
||||
} else {
|
||||
event.target.value = ''
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
detail: 'Invalid format file',
|
||||
closable: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
return (
|
||||
<Form>
|
||||
<div className='p-fluid grid grid-cols-2 gap-2'>
|
||||
<div className=''>
|
||||
<label className='block'>File</label>
|
||||
{values.fileupload ? (
|
||||
<div className=''>
|
||||
<input
|
||||
id='files'
|
||||
type='file'
|
||||
onChange={(e) => onBrowseFile(e)}
|
||||
accept='.xlsx'
|
||||
style={{ display: 'none' }}
|
||||
/>
|
||||
<label htmlFor='files' className='bg-blue-300 p-2 rounded cursor-pointer'>
|
||||
<i className='pi pi-file-pdf' /> {values.fileupload}
|
||||
</label>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<input id='files' type='file' onChange={(e) => onBrowseFile(e)} accept='.xlsx' />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className=''>
|
||||
<label className='block'>Truncate</label>
|
||||
<Dropdown
|
||||
name='truncate'
|
||||
optionLabel='name'
|
||||
optionValue='value'
|
||||
value={values.truncate}
|
||||
options={[
|
||||
{ name: 'Yes', value: true },
|
||||
{ name: 'No', value: false },
|
||||
]}
|
||||
onChange={handleChange}
|
||||
placeholder='Select a City'
|
||||
/>
|
||||
</div>
|
||||
<div className=''>
|
||||
<label className='block'>Jenis Tagihan</label>
|
||||
<Dropdown
|
||||
name='truncate'
|
||||
optionLabel='name'
|
||||
optionValue='value'
|
||||
value={values.truncate}
|
||||
options={[
|
||||
{ name: 'Yes', value: true },
|
||||
{ name: 'No', value: false },
|
||||
]}
|
||||
onChange={handleChange}
|
||||
placeholder='Select a City'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
)
|
||||
}}
|
||||
</Formik>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
import { DatatablePrime } from '@/components/Datatables'
|
||||
import { DialogDelete } from '@/components/Dialog'
|
||||
import FormUnitKerja from '@/components/Form/UnitKerja'
|
||||
import { Belakang } from '@/components/Layouts'
|
||||
import { Judul } from '@/components/TextCustom'
|
||||
import { UnitKerjaDelete, UnitKerjaGetOne, UnitKerjaList } from '@/services/referensi/unitKerja-service'
|
||||
import Head from 'next/head'
|
||||
import { Button } from 'primereact/button'
|
||||
import { Column } from 'primereact/column'
|
||||
import { Toast } from 'primereact/toast'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
|
||||
export default function UnitKerja() {
|
||||
const toast = useRef(null)
|
||||
const [data, setData] = useState([])
|
||||
const [dialogForm, setDialogForm] = useState(false)
|
||||
const [dataEdit, setDataEdit] = useState([])
|
||||
const [refresh, setRefresh] = useState(0)
|
||||
const [search, setSearch] = useState('')
|
||||
const [dialogDelete, setDialogDelete] = useState({})
|
||||
|
||||
useEffect(() => {
|
||||
let params = { draw: 0 }
|
||||
|
||||
if (search !== null && search !== '') {
|
||||
params.search = search
|
||||
} else {
|
||||
params.search = ''
|
||||
}
|
||||
|
||||
UnitKerjaList(params).then((res) => setData(res.data))
|
||||
}, [search, refresh])
|
||||
|
||||
const editUnitKerja = (data) => {
|
||||
UnitKerjaGetOne({ ref_id: data.ref_id }).then((res) => {
|
||||
if (res.status === 'ok') {
|
||||
setDataEdit(res.data)
|
||||
setDialogForm(true)
|
||||
} else {
|
||||
console.log(res.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const deleteUnitKerja = () => {
|
||||
UnitKerjaDelete({ ref_id: dialogDelete.ref_id }).then((res) => {
|
||||
if (res.status === 'success') {
|
||||
setRefresh(Math.random)
|
||||
setDialogDelete({ visible: false })
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
detail: res.message,
|
||||
closable: false,
|
||||
})
|
||||
} else {
|
||||
setDialogDelete({ visible: false })
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
detail: res.message,
|
||||
closable: false,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const actionBodyTemplate = (rowData) => {
|
||||
return (
|
||||
<div className='flex gap-x-2'>
|
||||
<Button icon='pi pi-pencil' className='p-button-sm p-button-rounded' onClick={() => editUnitKerja(rowData)} />
|
||||
<Button
|
||||
icon='pi pi-trash'
|
||||
className='p-button-sm p-button-rounded p-button-danger'
|
||||
onClick={() => setDialogDelete({ ref_id: rowData.ref_id, visible: true })}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Toast ref={toast} />
|
||||
<Head>
|
||||
<title>Unit Kerja</title>
|
||||
</Head>
|
||||
<Belakang>
|
||||
<Judul>Unit Kerja</Judul>
|
||||
<DatatablePrime
|
||||
data={data}
|
||||
setSearch={setSearch}
|
||||
dialogForm={dialogForm}
|
||||
setDialogForm={setDialogForm}
|
||||
Form={FormUnitKerja}
|
||||
buttonAdd={true}
|
||||
buttonAddLabel='Tambah data'
|
||||
dataEdit={dataEdit}
|
||||
setDataEdit={setDataEdit}
|
||||
toast={toast}
|
||||
refresh={setRefresh}
|
||||
>
|
||||
<Column field='unit_id' header='Kode Unit' sortable></Column>
|
||||
<Column field='nama' header='Unit Kerja' sortable></Column>
|
||||
<Column field='bobot' header='Bobot' sortable></Column>
|
||||
<Column header='Action' body={actionBodyTemplate} exportable={false}></Column>
|
||||
</DatatablePrime>
|
||||
</Belakang>
|
||||
|
||||
{dialogDelete.visible === true && (
|
||||
<DialogDelete data={dialogDelete} setDelete={setDialogDelete} onCallback={deleteUnitKerja} />
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
import { DatatablePrime } from '@/components/Datatables'
|
||||
import { DialogDelete } from '@/components/Dialog'
|
||||
import FormVerifikator from '@/components/Form/Verifikator'
|
||||
import { Belakang } from '@/components/Layouts'
|
||||
import { Judul } from '@/components/TextCustom'
|
||||
import { VerifikatorDelete, VerifikatorGetOne, VerifikatorList } from '@/services/referensi/verifikator-service'
|
||||
import Head from 'next/head'
|
||||
import { Button } from 'primereact/button'
|
||||
import { Column } from 'primereact/column'
|
||||
import { Toast } from 'primereact/toast'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
|
||||
export default function Verifikator() {
|
||||
const toast = useRef(null)
|
||||
const [data, setData] = useState([])
|
||||
const [dialogForm, setDialogForm] = useState(false)
|
||||
const [dataEdit, setDataEdit] = useState([])
|
||||
const [refresh, setRefresh] = useState(0)
|
||||
const [search, setSearch] = useState('')
|
||||
const [dialogDelete, setDialogDelete] = useState({})
|
||||
|
||||
useEffect(() => {
|
||||
let params = {}
|
||||
|
||||
if (search !== null && search !== '') {
|
||||
params.search = search
|
||||
} else {
|
||||
params.search = ''
|
||||
}
|
||||
|
||||
VerifikatorList(params)
|
||||
.then((res) => {
|
||||
if (res.status === 'success') {
|
||||
setData(res.data)
|
||||
} else {
|
||||
console.log('Verifikator list error', res)
|
||||
}
|
||||
})
|
||||
.catch((err) => console.log(err))
|
||||
}, [search, refresh])
|
||||
|
||||
const editVerifikator = (data) => {
|
||||
VerifikatorGetOne({ user_id: data.user_id }).then((res) => {
|
||||
if (res.status === 'success') {
|
||||
setDataEdit(res.data)
|
||||
setDialogForm(true)
|
||||
} else {
|
||||
console.log(res.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const deleteVerifikator = () => {
|
||||
VerifikatorDelete({ user_id: dialogDelete.user_id }).then((res) => {
|
||||
if (res.status === 'success') {
|
||||
setRefresh(Math.random)
|
||||
setDialogDelete({ visible: false })
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
detail: res.message,
|
||||
closable: false,
|
||||
})
|
||||
} else {
|
||||
setDialogDelete({ visible: false })
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
detail: res.message,
|
||||
closable: false,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const actionBodyTemplate = (rowData) => {
|
||||
return (
|
||||
<div className='flex gap-x-2'>
|
||||
<Button icon='pi pi-pencil' className='p-button-sm p-button-rounded' onClick={() => editVerifikator(rowData)} />
|
||||
<Button
|
||||
icon='pi pi-trash'
|
||||
className='p-button-sm p-button-rounded p-button-danger'
|
||||
onClick={() => setDialogDelete({ user_id: rowData.user_id, visible: true })}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Toast ref={toast} />
|
||||
<Head>
|
||||
<title>Verifikator</title>
|
||||
</Head>
|
||||
<Belakang>
|
||||
<Judul>Verifikator</Judul>
|
||||
<DatatablePrime
|
||||
data={data}
|
||||
setSearch={setSearch}
|
||||
dialogForm={dialogForm}
|
||||
setDialogForm={setDialogForm}
|
||||
Form={FormVerifikator}
|
||||
buttonAdd={true}
|
||||
buttonAddLabel='Tambah data'
|
||||
dataEdit={dataEdit}
|
||||
setDataEdit={setDataEdit}
|
||||
toast={toast}
|
||||
refresh={setRefresh}
|
||||
>
|
||||
<Column field='nama' header='Nama' sortable></Column>
|
||||
<Column field='unit' header='Unit Kerja' sortable></Column>
|
||||
<Column field='bobot' header='Bobot' sortable></Column>
|
||||
<Column header='Action' body={actionBodyTemplate} exportable={false}></Column>
|
||||
</DatatablePrime>
|
||||
</Belakang>
|
||||
|
||||
{dialogDelete.visible === true && (
|
||||
<DialogDelete data={dialogDelete} setDelete={setDialogDelete} onCallback={deleteVerifikator} />
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user