diff --git a/apps/backoffice/src/app/dashboard/_components/modal-add-item.tsx b/apps/backoffice/src/app/dashboard/_components/modal-add-item.tsx new file mode 100644 index 0000000..0a0a189 --- /dev/null +++ b/apps/backoffice/src/app/dashboard/_components/modal-add-item.tsx @@ -0,0 +1,119 @@ +import { Button } from '@imphnen-frontend-service/ui/atoms'; +import { InputForm, Modal } from '@imphnen-frontend-service/ui/molecules'; + +interface IModalAddItem { + isOpen: boolean; + onClose: () => void; + onAddItem: () => void; + currentStep?: number; +} + +const ModalAddItem = ({ + isOpen, + onClose, + onAddItem, + currentStep = 1, +}: IModalAddItem) => { + return ( + + {currentStep === 1 && ( + { + console.log('Next step'); + }} + onClose={onClose} + /> + )} + {currentStep === 2 && ( + { + console.log('Reset step'); + }} + /> + )} + + ); +}; + +// TODO: Functional stepper +interface IStepOneProps { + nextStep: () => void; + onClose: () => void; +} + +const StepOne = ({ nextStep, onClose }: IStepOneProps) => ( + <> + +

+ Tambah Item Gacha +

+

+ Lengkapi detail di bawah ini untuk menambahkan item gacha +

+
+ +
+ + + +
+ + +
+ +); + +interface IStepTwoProps { + onClose: () => void; + resetStep: () => void; +} + +const StepTwo = ({ onClose, resetStep }: IStepTwoProps) => ( + <> + +

+ Tambah Item +

+

+ Apakah kamu yakin ingin +
menambahkan item ini? +

+
+ + + + + +); + +export default ModalAddItem; diff --git a/apps/backoffice/src/app/dashboard/_components/modal-delete-item.tsx b/apps/backoffice/src/app/dashboard/_components/modal-delete-item.tsx index 212da7b..fc7ce78 100644 --- a/apps/backoffice/src/app/dashboard/_components/modal-delete-item.tsx +++ b/apps/backoffice/src/app/dashboard/_components/modal-delete-item.tsx @@ -40,7 +40,7 @@ const ModalDeleteItem = ({ variant="secondary" size="lg" className="w-full" - onClick={() => onClose()} + onClick={onClose} > Batal Hapus diff --git a/apps/backoffice/src/app/dashboard/_components/modal-edit-item.tsx b/apps/backoffice/src/app/dashboard/_components/modal-edit-item.tsx new file mode 100644 index 0000000..7dc82e2 --- /dev/null +++ b/apps/backoffice/src/app/dashboard/_components/modal-edit-item.tsx @@ -0,0 +1,118 @@ +import { Button } from '@imphnen-frontend-service/ui/atoms'; +import { InputForm, Modal } from '@imphnen-frontend-service/ui/molecules'; + +interface IModalEditItem { + isOpen: boolean; + onClose: () => void; + onEditItem: () => void; + currentStep?: number; +} + +const ModalEditItem = ({ + isOpen, + onClose, + onEditItem, + currentStep = 1, +}: IModalEditItem) => { + 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) => ( + <> + +

+ Edit Item Gacha +

+

+ Silakan mengubah detail dari item yang diperlukan +

+
+ +
+ + + +
+ + +
+ +); + +interface IStepTwoProps { + onClose: () => void; + resetStep: () => void; +} + +const StepTwo = ({ onClose, resetStep }: IStepTwoProps) => ( + <> + +

+ Update Item +

+

+ Apakah kamu yakin dengan +
perubahan yang dilakukan? +

+
+ + + + + +); + +export default ModalEditItem; diff --git a/apps/backoffice/src/app/dashboard/page.tsx b/apps/backoffice/src/app/dashboard/page.tsx index 8f89cda..a009bf4 100644 --- a/apps/backoffice/src/app/dashboard/page.tsx +++ b/apps/backoffice/src/app/dashboard/page.tsx @@ -7,9 +7,13 @@ import { } from '@ant-design/icons'; import { Button } from '@imphnen-frontend-service/ui/atoms'; import { FC, Fragment, ReactElement, useState } from 'react'; +import ModalAddItem from './_components/modal-add-item'; +import ModalEditItem from './_components/modal-edit-item'; import ModalDeleteItem from './_components/modal-delete-item'; export const Components: FC = (): ReactElement => { + const [showModalAddItem, setShowModalAddItem] = useState(false); + const [showModalEditItem, setShowModalEditItem] = useState(false); const [showModalDeleteItem, setShowModalDeleteItem] = useState(false); return ( @@ -84,7 +88,12 @@ export const Components: FC = (): ReactElement => {

Gacha Items

- @@ -112,6 +121,7 @@ export const Components: FC = (): ReactElement => { variant="text" size="sm" className="text-[10px] text-neutral-500 p-0 font-normal hover:bg-transparent hover:text-primary-500" + onClick={() => setShowModalEditItem(true)} > Edit @@ -147,6 +157,24 @@ export const Components: FC = (): ReactElement => { + {/* Modal Add Item */} + setShowModalAddItem(false)} + onAddItem={() => { + console.log('Item added'); + }} + /> + + {/* Modal Add Item */} + setShowModalEditItem(false)} + onEditItem={() => { + console.log('Item edited'); + }} + /> + {/* Modal Delete Item */}