Merge branch 'master' of https://git.shiblysolution.id/TPAY/dashboard
This commit is contained in:
@ -9,6 +9,7 @@ import { useAuthContext } from '@/auth';
|
|||||||
import { useLayout } from '@/providers';
|
import { useLayout } from '@/providers';
|
||||||
import { Alert } from '@/components';
|
import { Alert } from '@/components';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
import { Helmet } from 'react-helmet';
|
||||||
|
|
||||||
const loginSchema = Yup.object().shape({
|
const loginSchema = Yup.object().shape({
|
||||||
username: Yup.string().required('Username is required'),
|
username: Yup.string().required('Username is required'),
|
||||||
@ -76,6 +77,10 @@ const Login = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
<Helmet>
|
||||||
|
<title>TPAY | Sign In</title>
|
||||||
|
</Helmet>
|
||||||
<div className="card max-w-[390px] w-full">
|
<div className="card max-w-[390px] w-full">
|
||||||
<form
|
<form
|
||||||
className="card-body flex flex-col gap-5 p-10"
|
className="card-body flex flex-col gap-5 p-10"
|
||||||
@ -171,6 +176,7 @@ const Login = () => {
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { useAuthContext } from '@/auth/useAuthContext';
|
|||||||
import { Alert, KeenIcon } from '@/components';
|
import { Alert, KeenIcon } from '@/components';
|
||||||
import { useLayout } from '@/providers';
|
import { useLayout } from '@/providers';
|
||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
|
import { Helmet } from 'react-helmet';
|
||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
email: ''
|
email: ''
|
||||||
@ -64,6 +65,10 @@ const ResetPassword = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
<Helmet>
|
||||||
|
<title>TPAY | Reset Password</title>
|
||||||
|
</Helmet>
|
||||||
<div className="card max-w-[370px] w-full">
|
<div className="card max-w-[370px] w-full">
|
||||||
<form
|
<form
|
||||||
className="card-body flex flex-col gap-5 p-10"
|
className="card-body flex flex-col gap-5 p-10"
|
||||||
@ -128,6 +133,7 @@ const ResetPassword = () => {
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import {
|
|||||||
SelectValue
|
SelectValue
|
||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
import { NumericFormat } from 'react-number-format';
|
||||||
|
|
||||||
interface ProviderProps {
|
interface ProviderProps {
|
||||||
provider_id: number;
|
provider_id: number;
|
||||||
@ -40,15 +41,29 @@ const AddDialog = () => {
|
|||||||
show: false,
|
show: false,
|
||||||
message: ''
|
message: ''
|
||||||
});
|
});
|
||||||
const initialState = {
|
const initialState: {
|
||||||
|
name: string;
|
||||||
|
code: string;
|
||||||
|
type: string;
|
||||||
|
description: string;
|
||||||
|
price_point: string | number | null;
|
||||||
|
price_cash: string | number | null;
|
||||||
|
cashback_point: string | number | null;
|
||||||
|
cashback_cash: string | number | null;
|
||||||
|
status: string;
|
||||||
|
provider: string;
|
||||||
|
process_on_third_party: string;
|
||||||
|
created_by: string;
|
||||||
|
created_at: string;
|
||||||
|
} = {
|
||||||
name: '',
|
name: '',
|
||||||
code: '',
|
code: '',
|
||||||
type: '',
|
type: '',
|
||||||
description: '',
|
description: '',
|
||||||
price_point: 0,
|
price_point: null,
|
||||||
price_cash: 0,
|
price_cash: null,
|
||||||
cashback_point: 0,
|
cashback_point: null,
|
||||||
cashback_cash: 0,
|
cashback_cash: null,
|
||||||
status: '',
|
status: '',
|
||||||
provider: '',
|
provider: '',
|
||||||
process_on_third_party: '',
|
process_on_third_party: '',
|
||||||
@ -117,11 +132,13 @@ const AddDialog = () => {
|
|||||||
formField.type.trim() === '' ||
|
formField.type.trim() === '' ||
|
||||||
formField.code.trim() === '' ||
|
formField.code.trim() === '' ||
|
||||||
formField.description.trim() === '' ||
|
formField.description.trim() === '' ||
|
||||||
formField.price_point === 0 ||
|
formField.price_point === null ||
|
||||||
formField.price_cash === 0 ||
|
formField.price_cash === null ||
|
||||||
formField.cashback_point === 0 ||
|
formField.cashback_point === null ||
|
||||||
formField.cashback_cash === 0 ||
|
formField.cashback_cash === null ||
|
||||||
formField.status.trim() === '' ||
|
formField.status.trim() === '' ||
|
||||||
|
formField.provider.trim() === '' ||
|
||||||
|
formField.process_on_third_party.trim() === '' ||
|
||||||
formField.created_by.trim() === '' ||
|
formField.created_by.trim() === '' ||
|
||||||
formField.created_at.trim() === ''
|
formField.created_at.trim() === ''
|
||||||
) {
|
) {
|
||||||
@ -234,19 +251,19 @@ const AddDialog = () => {
|
|||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
Price Point<span className="text-red-500">*</span>
|
Price Point<span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<NumericFormat
|
||||||
className="input"
|
className="input"
|
||||||
type="number"
|
value={formField.price_point ?? ''}
|
||||||
min={0}
|
thousandSeparator="."
|
||||||
step={0.01}
|
decimalSeparator=","
|
||||||
value={formField.price_point}
|
allowNegative={false}
|
||||||
onChange={(e) => {
|
onValueChange={(values) => {
|
||||||
const value = parseFloat(e.target.value);
|
setFormField((prev) => ({
|
||||||
setFormField({
|
...prev,
|
||||||
...formField,
|
price_point: values.floatValue !== undefined ? values.floatValue : ''
|
||||||
price_point: isNaN(value) ? 0 : value
|
}));
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
|
placeholder="Enter Price Point"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -256,19 +273,19 @@ const AddDialog = () => {
|
|||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
Price Cash<span className="text-red-500">*</span>
|
Price Cash<span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<NumericFormat
|
||||||
className="input"
|
className="input"
|
||||||
type="number"
|
value={formField.price_cash ?? ''}
|
||||||
min={0}
|
thousandSeparator="."
|
||||||
step={0.01}
|
decimalSeparator=","
|
||||||
value={formField.price_cash}
|
allowNegative={false}
|
||||||
onChange={(e) => {
|
onValueChange={(values) => {
|
||||||
const value = parseFloat(e.target.value);
|
setFormField((prev) => ({
|
||||||
setFormField({
|
...prev,
|
||||||
...formField,
|
price_cash: values.floatValue !== undefined ? values.floatValue : ''
|
||||||
price_cash: isNaN(value) ? 0 : value
|
}));
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
|
placeholder="Enter Price Cash"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -278,19 +295,19 @@ const AddDialog = () => {
|
|||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
Cashback Point<span className="text-red-500">*</span>
|
Cashback Point<span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<NumericFormat
|
||||||
className="input"
|
className="input"
|
||||||
type="number"
|
value={formField.cashback_point ?? ''}
|
||||||
min={0}
|
thousandSeparator="."
|
||||||
step={0.01}
|
decimalSeparator=","
|
||||||
value={formField.cashback_point}
|
allowNegative={false}
|
||||||
onChange={(e) => {
|
onValueChange={(values) => {
|
||||||
const value = parseFloat(e.target.value);
|
setFormField((prev) => ({
|
||||||
setFormField({
|
...prev,
|
||||||
...formField,
|
cashback_point: values.floatValue !== undefined ? values.floatValue : ''
|
||||||
cashback_point: isNaN(value) ? 0 : value
|
}));
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
|
placeholder="Enter Cashback Point"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -300,19 +317,19 @@ const AddDialog = () => {
|
|||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
Cashback Cash<span className="text-red-500">*</span>
|
Cashback Cash<span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<NumericFormat
|
||||||
className="input"
|
className="input"
|
||||||
type="number"
|
value={formField.cashback_cash ?? ''}
|
||||||
min={0}
|
thousandSeparator="."
|
||||||
step={0.01}
|
decimalSeparator=","
|
||||||
value={formField.cashback_cash}
|
allowNegative={false}
|
||||||
onChange={(e) => {
|
onValueChange={(values) => {
|
||||||
const value = parseFloat(e.target.value);
|
setFormField((prev) => ({
|
||||||
setFormField({
|
...prev,
|
||||||
...formField,
|
cashback_cash: values.floatValue !== undefined ? values.floatValue : ''
|
||||||
cashback_cash: isNaN(value) ? 0 : value
|
}));
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
|
placeholder="Enter Cashback Cash"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -68,7 +68,7 @@ const AddDialog = () => {
|
|||||||
type: string;
|
type: string;
|
||||||
status: string;
|
status: string;
|
||||||
transaction_type: string;
|
transaction_type: string;
|
||||||
agent: string;
|
agent: string | null;
|
||||||
created_by: string;
|
created_by: string;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
} = {
|
} = {
|
||||||
@ -77,7 +77,7 @@ const AddDialog = () => {
|
|||||||
type: '',
|
type: '',
|
||||||
status: '',
|
status: '',
|
||||||
transaction_type: '',
|
transaction_type: '',
|
||||||
agent: '',
|
agent: null,
|
||||||
created_by: '',
|
created_by: '',
|
||||||
created_at: ''
|
created_at: ''
|
||||||
};
|
};
|
||||||
@ -133,7 +133,7 @@ const AddDialog = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(formField);
|
// console.log(formField);
|
||||||
doCreateProvider(e);
|
doCreateProvider(e);
|
||||||
setAlert({ show: false, message: '' });
|
setAlert({ show: false, message: '' });
|
||||||
};
|
};
|
||||||
|
|||||||
@ -58,7 +58,7 @@ const EditDialog = () => {
|
|||||||
type: string;
|
type: string;
|
||||||
status: string;
|
status: string;
|
||||||
transaction_type: string;
|
transaction_type: string;
|
||||||
agent: string;
|
agent: string | null;
|
||||||
updated_by: string;
|
updated_by: string;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
} = {
|
} = {
|
||||||
@ -67,7 +67,7 @@ const EditDialog = () => {
|
|||||||
type: '',
|
type: '',
|
||||||
status: '',
|
status: '',
|
||||||
transaction_type: '',
|
transaction_type: '',
|
||||||
agent: '',
|
agent: null,
|
||||||
updated_by: '',
|
updated_by: '',
|
||||||
updated_at: ''
|
updated_at: ''
|
||||||
};
|
};
|
||||||
@ -156,7 +156,7 @@ const EditDialog = () => {
|
|||||||
type: response?.data.type,
|
type: response?.data.type,
|
||||||
status: response?.data.status,
|
status: response?.data.status,
|
||||||
transaction_type: response?.data.transaction_type.id,
|
transaction_type: response?.data.transaction_type.id,
|
||||||
agent: response?.data.agent?.id || ''
|
agent: response?.data.agent?.id || null
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
@ -169,8 +169,7 @@ const EditDialog = () => {
|
|||||||
formField.description.trim() === '' ||
|
formField.description.trim() === '' ||
|
||||||
formField.type.trim() === '' ||
|
formField.type.trim() === '' ||
|
||||||
formField.status.trim() === '' ||
|
formField.status.trim() === '' ||
|
||||||
formField.transaction_type.trim() === '' ||
|
formField.transaction_type.trim() === ''
|
||||||
formField.agent.trim() === ''
|
|
||||||
) {
|
) {
|
||||||
setAlert({ show: true, message: 'Please fill in all required fields.' });
|
setAlert({ show: true, message: 'Please fill in all required fields.' });
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -123,7 +123,16 @@ const AddDialog = () => {
|
|||||||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (formField.id_group.trim() === '' || formField.status.trim() === '') {
|
if (
|
||||||
|
formField.id_group.trim() === '' ||
|
||||||
|
formField.status.trim() === '' ||
|
||||||
|
formField.id_wallet.trim() === '' ||
|
||||||
|
formField.max_transaction_per_day === null ||
|
||||||
|
formField.balance_minimum === null ||
|
||||||
|
formField.balance_maximum === null ||
|
||||||
|
formField.credit_limit === null ||
|
||||||
|
formField.monthly_limit === null
|
||||||
|
) {
|
||||||
setAlert({ show: true, message: 'Please fill in all required fields.' });
|
setAlert({ show: true, message: 'Please fill in all required fields.' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -155,7 +155,7 @@ const ApprovalTransactionProvider = ({ children }: { children: React.ReactNode }
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: 'type.name',
|
accessorKey: 'type.name',
|
||||||
header: ({ column }) => <DataGridColumnHeader title="Name" column={column} />,
|
header: ({ column }) => <DataGridColumnHeader title="Transaction Type" column={column} />,
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
enableHiding: false,
|
enableHiding: false,
|
||||||
meta: {
|
meta: {
|
||||||
|
|||||||
@ -157,7 +157,7 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: 'type.name',
|
accessorKey: 'type.name',
|
||||||
header: ({ column }) => <DataGridColumnHeader title="Name" column={column} />,
|
header: ({ column }) => <DataGridColumnHeader title="Transaction Type" column={column} />,
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
enableHiding: false,
|
enableHiding: false,
|
||||||
meta: {
|
meta: {
|
||||||
|
|||||||
@ -218,7 +218,7 @@ const AddDialog = () => {
|
|||||||
order_direction: 'ASC',
|
order_direction: 'ASC',
|
||||||
};
|
};
|
||||||
const response = await GetData(`${API_URL_MASTERDATA}/wallet/list`, params);
|
const response = await GetData(`${API_URL_MASTERDATA}/wallet/list`, params);
|
||||||
console.log(response)
|
// console.log(response)
|
||||||
if (response?.status && response?.data) {
|
if (response?.status && response?.data) {
|
||||||
setWallets(response.data.list);
|
setWallets(response.data.list);
|
||||||
} else {
|
} else {
|
||||||
@ -230,7 +230,7 @@ const AddDialog = () => {
|
|||||||
if (!showAddDialog) return;
|
if (!showAddDialog) return;
|
||||||
fetchWallets();
|
fetchWallets();
|
||||||
}, [showAddDialog]);
|
}, [showAddDialog]);
|
||||||
|
// console.log(formField)
|
||||||
return (
|
return (
|
||||||
<Dialog open={showAddDialog} onOpenChange={(open) => handleAddDialog(open)}>
|
<Dialog open={showAddDialog} onOpenChange={(open) => handleAddDialog(open)}>
|
||||||
<DialogContent className="container-fixed max-w-[1080px] flex flex-col p-5 overflow-hidden [&>button]:hidden">
|
<DialogContent className="container-fixed max-w-[1080px] flex flex-col p-5 overflow-hidden [&>button]:hidden">
|
||||||
|
|||||||
@ -19,7 +19,9 @@ const DeleteDialog = () => {
|
|||||||
message: ''
|
message: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
const doDeleteTransferType = useCallback(async () => {
|
|
||||||
|
|
||||||
|
const doDeleteTransferType = useCallback(async (id:string|null) => {
|
||||||
if (!selectedTransferType) {
|
if (!selectedTransferType) {
|
||||||
toast.error('No Transfer Type selected');
|
toast.error('No Transfer Type selected');
|
||||||
return;
|
return;
|
||||||
@ -37,9 +39,15 @@ const DeleteDialog = () => {
|
|||||||
setTimeout(() => toast.success('Success Delete Transaction Type'), 0);
|
setTimeout(() => toast.success('Success Delete Transaction Type'), 0);
|
||||||
} else {
|
} else {
|
||||||
setAlert({ show: true, message: response?.message });
|
setAlert({ show: true, message: response?.message });
|
||||||
setTimeout(() => toast.error('Failed Delete Product'), 0);
|
// setTimeout(() => toast.error('Failed Delete Product'), 0);
|
||||||
}
|
}
|
||||||
}, [selectedTransferType, DeleteData, handleDeleteDialog, reload]);
|
}, [selectedTransferType, DeleteData, handleDeleteDialog, reload]);
|
||||||
|
|
||||||
|
const handleDelete = ((id:string|null) => {
|
||||||
|
console.log(id);
|
||||||
|
doDeleteTransferType(id);
|
||||||
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={showDeleteDialog} onOpenChange={(open) => handleDeleteDialog(open, null)}>
|
<Dialog open={showDeleteDialog} onOpenChange={(open) => handleDeleteDialog(open, null)}>
|
||||||
<DialogContent className="container-fixed max-w-md flex flex-col p-5 overflow-hidden [&>button]:hidden">
|
<DialogContent className="container-fixed max-w-md flex flex-col p-5 overflow-hidden [&>button]:hidden">
|
||||||
@ -60,7 +68,7 @@ const DeleteDialog = () => {
|
|||||||
<Button variant={'outline'} onClick={() => handleDeleteDialog(false, null)}>
|
<Button variant={'outline'} onClick={() => handleDeleteDialog(false, null)}>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant={'destructive'} onClick={() => doDeleteTransferType()}>
|
<Button variant={'destructive'} onClick={() => handleDelete(selectedTransferType)}>
|
||||||
Delete
|
Delete
|
||||||
</Button>
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
|
|||||||
@ -70,8 +70,8 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleDeleteDialog = useCallback((show: boolean, selected_transfertype: string | null) => {
|
const handleDeleteDialog = useCallback((show: boolean, selected_transfertype: string | null) => {
|
||||||
setShowDeleteDialog(show);
|
|
||||||
setSelectedTransferType(show ? selected_transfertype : null);
|
setSelectedTransferType(show ? selected_transfertype : null);
|
||||||
|
setShowDeleteDialog(show);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const columns = useMemo<ColumnDef<any>[]>(
|
const columns = useMemo<ColumnDef<any>[]>(
|
||||||
|
|||||||
Reference in New Issue
Block a user