diff --git a/apps/backoffice/src/app/dashboard/_components/modal-add-item.tsx b/apps/backoffice/src/app/dashboard/_components/modal-add-item.tsx
index 0a0a189..2b561f1 100644
--- a/apps/backoffice/src/app/dashboard/_components/modal-add-item.tsx
+++ b/apps/backoffice/src/app/dashboard/_components/modal-add-item.tsx
@@ -4,14 +4,14 @@ import { InputForm, Modal } from '@imphnen-frontend-service/ui/molecules';
interface IModalAddItem {
isOpen: boolean;
onClose: () => void;
- onAddItem: () => void;
+ handleAddItem: () => void;
currentStep?: number;
}
const ModalAddItem = ({
isOpen,
onClose,
- onAddItem,
+ handleAddItem,
currentStep = 1,
}: IModalAddItem) => {
return (
@@ -32,6 +32,7 @@ const ModalAddItem = ({
{currentStep === 2 && (
{
console.log('Reset step');
}}
@@ -92,9 +93,10 @@ const StepOne = ({ nextStep, onClose }: IStepOneProps) => (
interface IStepTwoProps {
onClose: () => void;
resetStep: () => void;
+ handleAddItem?: () => void;
}
-const StepTwo = ({ onClose, resetStep }: IStepTwoProps) => (
+const StepTwo = ({ onClose, handleAddItem, resetStep }: IStepTwoProps) => (
<>
@@ -106,10 +108,22 @@ const StepTwo = ({ onClose, resetStep }: IStepTwoProps) => (
-
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 fc7ce78..3663ee0 100644
--- a/apps/backoffice/src/app/dashboard/_components/modal-delete-item.tsx
+++ b/apps/backoffice/src/app/dashboard/_components/modal-delete-item.tsx
@@ -4,13 +4,13 @@ import { Modal } from '@imphnen-frontend-service/ui/molecules';
interface IModalDeleteItem {
isOpen: boolean;
onClose: () => void;
- onDeleteItem: () => void;
+ handleDeleteItem?: () => void;
}
const ModalDeleteItem = ({
isOpen,
onClose,
- onDeleteItem,
+ handleDeleteItem,
}: IModalDeleteItem) => {
return (
onDeleteItem()}
+ onClick={() => {
+ handleDeleteItem && handleDeleteItem();
+ }}
>
Hapus Item
diff --git a/apps/backoffice/src/app/dashboard/_components/modal-edit-item.tsx b/apps/backoffice/src/app/dashboard/_components/modal-edit-item.tsx
index 7dc82e2..6166933 100644
--- a/apps/backoffice/src/app/dashboard/_components/modal-edit-item.tsx
+++ b/apps/backoffice/src/app/dashboard/_components/modal-edit-item.tsx
@@ -4,14 +4,14 @@ import { InputForm, Modal } from '@imphnen-frontend-service/ui/molecules';
interface IModalEditItem {
isOpen: boolean;
onClose: () => void;
- onEditItem: () => void;
+ handleEditItem?: () => void;
currentStep?: number;
}
const ModalEditItem = ({
isOpen,
onClose,
- onEditItem,
+ handleEditItem,
currentStep = 1,
}: IModalEditItem) => {
return (
@@ -81,7 +81,7 @@ const StepOne = ({ nextStep, onClose }: IStepOneProps) => (
/>
-
+
Perbarui Item
@@ -90,10 +90,11 @@ const StepOne = ({ nextStep, onClose }: IStepOneProps) => (
interface IStepTwoProps {
onClose: () => void;
+ handleEditItem?: () => void;
resetStep: () => void;
}
-const StepTwo = ({ onClose, resetStep }: IStepTwoProps) => (
+const StepTwo = ({ onClose, handleEditItem, resetStep }: IStepTwoProps) => (
<>
@@ -105,10 +106,22 @@ const StepTwo = ({ onClose, resetStep }: IStepTwoProps) => (
-
+
Batal
-
+ {
+ handleEditItem && handleEditItem();
+ }}
+ >
Update
diff --git a/apps/backoffice/src/app/dashboard/page.tsx b/apps/backoffice/src/app/dashboard/page.tsx
index a009bf4..3559af7 100644
--- a/apps/backoffice/src/app/dashboard/page.tsx
+++ b/apps/backoffice/src/app/dashboard/page.tsx
@@ -161,16 +161,16 @@ export const Components: FC = (): ReactElement => {
setShowModalAddItem(false)}
- onAddItem={() => {
+ handleAddItem={() => {
console.log('Item added');
}}
/>
- {/* Modal Add Item */}
+ {/* Modal Edit Item */}
setShowModalEditItem(false)}
- onEditItem={() => {
+ handleEditItem={() => {
console.log('Item edited');
}}
/>
@@ -179,7 +179,7 @@ export const Components: FC = (): ReactElement => {
setShowModalDeleteItem(false)}
- onDeleteItem={() => {
+ handleDeleteItem={() => {
console.log('Item deleted');
}}
/>
diff --git a/apps/backoffice/src/app/prizes/_components/modal-process-item.tsx b/apps/backoffice/src/app/prizes/_components/modal-process-item.tsx
index 3472c45..19a907b 100644
--- a/apps/backoffice/src/app/prizes/_components/modal-process-item.tsx
+++ b/apps/backoffice/src/app/prizes/_components/modal-process-item.tsx
@@ -4,10 +4,14 @@ import { InputForm, Modal } from '@imphnen-frontend-service/ui/molecules';
interface IModalProcessDelivery {
isOpen: boolean;
onClose: () => void;
- onProcessDelivery?: () => void;
+ handleProcessDelivery?: () => void;
}
-const ModalProcessDelivery = ({ isOpen, onClose }: IModalProcessDelivery) => {
+const ModalProcessDelivery = ({
+ isOpen,
+ onClose,
+ handleProcessDelivery,
+}: IModalProcessDelivery) => {
return (
{
value="Ahmad Wiyana"
size="lg"
className="w-full"
+ readOnly
/>
{
value="Lanyard + ID Card"
size="lg"
className="w-full"
+ readOnly
/>
{
value="Jl. Pantai Cibaduyut Indah"
size="lg"
className="w-full"
+ readOnly
/>
{
value="Lanyard + ID Card"
size="lg"
className="w-full"
+ readOnly
/>
-
+ handleProcessDelivery && handleProcessDelivery()}
+ >
Proses Pengiriman
diff --git a/apps/backoffice/src/app/prizes/page.tsx b/apps/backoffice/src/app/prizes/page.tsx
index ffac78d..72a77ec 100644
--- a/apps/backoffice/src/app/prizes/page.tsx
+++ b/apps/backoffice/src/app/prizes/page.tsx
@@ -155,6 +155,7 @@ export const Components: FC = (): ReactElement => {
variant="primary"
size="sm"
onClick={(e) => {
+ e.stopPropagation();
setShowModalProcessDelivery(true);
}}
className="flex items-center gap-2 w-full"
@@ -227,8 +228,8 @@ export const Components: FC = (): ReactElement => {
setShowModalProcessDelivery(false)}
- onProcessDelivery={() => {
- console.log('Item added');
+ handleProcessDelivery={() => {
+ console.log('Action ketika user menekan tombol Proses Pengiriman');
}}
/>
diff --git a/apps/backoffice/src/app/transactions/_components/modal-validate.tsx b/apps/backoffice/src/app/transactions/_components/modal-validate.tsx
new file mode 100644
index 0000000..5938490
--- /dev/null
+++ b/apps/backoffice/src/app/transactions/_components/modal-validate.tsx
@@ -0,0 +1,61 @@
+import { Button } from '@imphnen-frontend-service/ui/atoms';
+import { InputForm, Modal } from '@imphnen-frontend-service/ui/molecules';
+
+interface IModalValidate {
+ isOpen: boolean;
+ onClose: () => void;
+ handleValid?: () => void;
+ handleInvalid?: () => void;
+}
+
+const ModalValidate = ({
+ isOpen,
+ onClose,
+ handleValid,
+ handleInvalid,
+}: IModalValidate) => {
+ return (
+
+
+
+ Validasi Transaksi
+
+
+
+
+
+ handleInvalid && handleInvalid()}
+ >
+ Tidak Valid
+
+ handleValid && handleValid()}
+ >
+ Valid
+
+
+
+
+ );
+};
+
+export default ModalValidate;
diff --git a/apps/backoffice/src/app/transactions/page.tsx b/apps/backoffice/src/app/transactions/page.tsx
index a03b161..dec6413 100644
--- a/apps/backoffice/src/app/transactions/page.tsx
+++ b/apps/backoffice/src/app/transactions/page.tsx
@@ -1,5 +1,5 @@
import * as React from 'react';
-import { FC, ReactElement, useState } from 'react';
+import { FC, Fragment, ReactElement, useState } from 'react';
import {
FilterOutlined,
SearchOutlined,
@@ -16,6 +16,7 @@ import {
useReactTable,
RowSelectionState,
} from '@tanstack/react-table';
+import ModalValidate from './_components/modal-validate';
type TransactionStatus = 'valid' | 'invalid' | 'unchecked';
@@ -38,81 +39,9 @@ const mockTransactions: Transaction[] = Array.from({ length: 20 }, (_, i) => ({
: 'valid') as TransactionStatus,
}));
-const columns: ColumnDef[] = [
- {
- id: 'select',
- header: ({ table }) => (
-
- ),
- cell: ({ row }) => (
-
- ),
- },
- {
- header: 'No',
- accessorKey: 'id',
- },
- {
- header: 'Nama Lengkap',
- accessorKey: 'name',
- },
- {
- header: 'Nomor Transaksi',
- accessorKey: 'transactionNumber',
- },
- {
- header: 'Order Valid?',
- accessorKey: 'status',
- cell: ({ row }) => {
- const status = row.original.status;
- const statusColors: Record = {
- valid: 'bg-success-200 text-success-500',
- invalid: 'bg-danger-200 text-danger-500',
- unchecked: 'bg-warning-200 text-warning-900',
- };
- const statusText: Record = {
- valid: 'Valid',
- invalid: 'Invalid',
- unchecked: 'Unchecked',
- };
- return (
-
- {statusText[status]}
-
- );
- },
- },
- {
- header: 'Action',
- cell: ({ row }) => (
- {
- e.stopPropagation();
- // handleUpdate(row.id);
- }}
- className="flex items-center gap-2 w-full"
- >
- Update
-
- ),
- },
-];
-
export const Components: FC = (): ReactElement => {
+ const [showModalValidate, setShowModalValidate] = useState(false);
+
const [pagination, setPagination] = React.useState({
pageIndex: 0,
pageSize: 9,
@@ -121,6 +50,80 @@ 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: 'Nomor Transaksi',
+ accessorKey: 'transactionNumber',
+ },
+ {
+ header: 'Order Valid?',
+ accessorKey: 'status',
+ cell: ({ row }) => {
+ const status = row.original.status;
+ const statusColors: Record = {
+ valid: 'bg-success-200 text-success-500',
+ invalid: 'bg-danger-200 text-danger-500',
+ unchecked: 'bg-warning-200 text-warning-900',
+ };
+ const statusText: Record = {
+ valid: 'Valid',
+ invalid: 'Invalid',
+ unchecked: 'Unchecked',
+ };
+ return (
+
+ {statusText[status]}
+
+ );
+ },
+ },
+ {
+ header: 'Action',
+ cell: ({ row }) => (
+ {
+ e.stopPropagation();
+ setShowModalValidate(true);
+ }}
+ className="flex items-center gap-2 w-full"
+ >
+ Update
+
+ ),
+ },
+ ];
+
const table = useReactTable({
data: mockTransactions,
columns,
@@ -138,48 +141,60 @@ export const Components: FC = (): ReactElement => {
});
return (
-
- {/* Header */}
-
+
+
+ {/* Header */}
+
- {/* Account Table Section */}
-
- {/* Search and Filter */}
-
-
-
-
-
+ {/* Account Table Section */}
+
+ {/* Search and Filter */}
+
+
+
+
+
setShowFilter(!showFilter)}
+ >
+
+ Filters
+
+ {showFilter && (
+
+ setShowFilter(false)} />
+
+ )}
-
-
setShowFilter(!showFilter)}
- >
-
- Filters
-
- {showFilter && (
-
- setShowFilter(false)} />
-
- )}
-
-
-
- {/* Table */}
-
-
-
+ {/* Table */}
+
+
+
+
setShowModalValidate(false)}
+ handleValid={() => {
+ console.log('Action ketika user klik Valid');
+ }}
+ handleInvalid={() => {
+ console.log('Action ketika user klik Tidak Valid');
+ }}
+ />
+
);
};