diff --git a/apps/backoffice/src/app/accounts/_components/modal-edit-account.tsx b/apps/backoffice/src/app/accounts/_components/modal-edit-account.tsx new file mode 100644 index 0000000..0e23a97 --- /dev/null +++ b/apps/backoffice/src/app/accounts/_components/modal-edit-account.tsx @@ -0,0 +1,157 @@ +import { Button } from '@imphnen-frontend-service/ui/atoms'; +import { InputForm, Modal } from '@imphnen-frontend-service/ui/molecules'; +import { useState } from 'react'; + +interface IModalEditAccount { + isOpen: boolean; + onClose: () => void; + handleEditAccount?: () => void; + currentStep?: number; +} + +const ModalEditAccount = ({ + isOpen, + onClose, + handleEditAccount, + currentStep = 1, +}: IModalEditAccount) => { + return ( + + {currentStep === 1 && ( + { + console.log('Next step'); + }} + onClose={onClose} + /> + )} + {currentStep === 2 && ( + { + console.log('Reset step'); + }} + /> + )} + + ); +}; + +interface IStepOneProps { + nextStep: () => void; + onClose: () => void; +} + +const StepOne = ({ nextStep, onClose }: IStepOneProps) => { + const [fullName, setFullName] = useState('Ahmad Wiyana'); + const [email, setEmail] = useState('fullname23@gmail.com'); + const [phoneNumber, setPhoneNumber] = useState('081904423804'); + const [address, setAddress] = useState('Jl. Pantai Cibaduyut Indah'); + + return ( + <> + +

+ Edit Data Akun +

+
+ +
+ setFullName(e.target.value)} + size="lg" + className="w-full" + /> + setEmail(e.target.value)} + size="lg" + className="w-full" + /> + setPhoneNumber(e.target.value)} + size="lg" + className="w-full" + /> + setAddress(e.target.value)} + size="lg" + className="w-full" + /> +
+ + +
+ + ); +}; + +interface IStepTwoProps { + onClose: () => void; + handleEditAccount?: () => void; + resetStep: () => void; +} + +const StepTwo = ({ onClose, handleEditAccount, resetStep }: IStepTwoProps) => ( + <> + +

+ Update Data +

+

+ Apakah kamu yakin dengan +
perubahan yang dilakukan? +

+
+ + + + + +); + +export default ModalEditAccount; diff --git a/apps/backoffice/src/app/accounts/page.tsx b/apps/backoffice/src/app/accounts/page.tsx index 404b462..9ce96b6 100644 --- a/apps/backoffice/src/app/accounts/page.tsx +++ b/apps/backoffice/src/app/accounts/page.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; -import { FC, ReactElement, useState } from 'react'; +import { FC, Fragment, ReactElement, useState } from 'react'; import { FilterOutlined, SearchOutlined, @@ -17,6 +17,7 @@ import { useReactTable, RowSelectionState, } from '@tanstack/react-table'; +import ModalEditAccount from './_components/modal-edit-account'; interface Account { id: number; @@ -35,65 +36,9 @@ const mockData: Account[] = Array.from({ length: 90 }, (_, i) => ({ address: 'Jl. Pantai Cibaduyut Indah', })); -const columns: ColumnDef[] = [ - { - id: 'select', - header: ({ table }) => ( - - ), - cell: ({ row }) => ( - - ), - }, - { - header: 'No', - accessorKey: 'id', - }, - { - header: 'Nama Lengkap', - accessorKey: 'name', - }, - { - header: 'Email', - accessorKey: 'email', - }, - { - header: 'Nomor Telp', - accessorKey: 'phone', - }, - { - header: 'Alamat Pengiriman', - accessorKey: 'address', - }, - { - header: 'Action', - cell: ({ row }) => ( - - ), - }, -]; - export const Components: FC = (): ReactElement => { + const [showModalEditAccount, setShowModalEditAccount] = useState(false); + const [pagination, setPagination] = React.useState({ pageIndex: 0, pageSize: 9, @@ -102,6 +47,64 @@ export const Components: FC = (): ReactElement => { const [rowSelection, setRowSelection] = React.useState({}); const [showFilter, setShowFilter] = useState(false); + const columns: ColumnDef[] = [ + { + id: 'select', + header: ({ table }) => ( + + ), + cell: ({ row }) => ( + + ), + }, + { + header: 'No', + accessorKey: 'id', + }, + { + header: 'Nama Lengkap', + accessorKey: 'name', + }, + { + header: 'Email', + accessorKey: 'email', + }, + { + header: 'Nomor Telp', + accessorKey: 'phone', + }, + { + header: 'Alamat Pengiriman', + accessorKey: 'address', + }, + { + header: 'Action', + cell: ({ row }) => ( + + ), + }, + ]; + const table = useReactTable({ data: mockData, columns, @@ -119,49 +122,57 @@ export const Components: FC = (): ReactElement => { }); return ( -
- {/* Header */} -
-

Data Akun

-
- - {/* Account Table Section */} -
- {/* Search and Filter */} -
-
- -
- + +
+ {/* Header */} +
+

Data Akun

+
+ {/* Account Table Section */} +
+ {/* Search and Filter */} +
+
+ +
+ +
+
+
+ + {showFilter && ( +
+ setShowFilter(false)} /> +
+ )}
+ {/* Table */} + +
+
-
- - {showFilter && ( -
- setShowFilter(false)} /> -
- )} -
-
- - {/* Table */} - -
-
+ {/* Modal Edit Account */} + setShowModalEditAccount(false)} + handleEditAccount={() => { + console.log('Account updated'); + }} + /> + ); };