update dialog add kyc-delete-member
This commit is contained in:
@ -1,9 +1,9 @@
|
|||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogBody,
|
DialogBody,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
DialogHeader,
|
DialogHeader,
|
||||||
DialogTitle
|
DialogTitle
|
||||||
} from '@/components/ui/dialog';
|
} from '@/components/ui/dialog';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
@ -13,11 +13,11 @@ import axios from 'axios';
|
|||||||
|
|
||||||
const API_URL = apiConfig.service_customer;
|
const API_URL = apiConfig.service_customer;
|
||||||
const DetailDialog = () => {
|
const DetailDialog = () => {
|
||||||
const { showDetailDialog, setShowDetailDialog, detailKyc, handleApproveReject } = useManageKycDeletionContext();
|
const { showDetailDialog, setShowDetailDialog, detailKyc, handleApproveReject } = useManageKycDeletionContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={showDetailDialog} onOpenChange={setShowDetailDialog}>
|
<Dialog open={showDetailDialog} onOpenChange={setShowDetailDialog}>
|
||||||
<DialogContent className="container-fixed max-w-[1024px] flex flex-col p-5 overflow-hidden">
|
<DialogContent className="container-fixed max-w-[1024px] flex flex-col p-5 overflow-hidden max-h-[90vh] overflow-y-auto">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Customer Deletion Details </DialogTitle>
|
<DialogTitle>Customer Deletion Details </DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
@ -38,9 +38,9 @@ const DetailDialog = () => {
|
|||||||
|
|
||||||
<div className="flex justify-end gap-2 mt-3">
|
<div className="flex justify-end gap-2 mt-3">
|
||||||
<Button type="button" variant="outline" onClick={() => setShowDetailDialog(false)}>Cancel</Button>
|
<Button type="button" variant="outline" onClick={() => setShowDetailDialog(false)}>Cancel</Button>
|
||||||
<Button onClick={()=>handleApproveReject(detailKyc.id, 'N')} variant="destructive" color="warning">Reject</Button>
|
<Button onClick={() => handleApproveReject(detailKyc.id, 'N')} variant="destructive" color="warning">Reject</Button>
|
||||||
<Button onClick={()=>handleApproveReject(detailKyc.id, 'Y')} variant="default" color="primary">Approve</Button>
|
<Button onClick={() => handleApproveReject(detailKyc.id, 'Y')} variant="default" color="primary">Approve</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : (<div></div>)}
|
) : (<div></div>)}
|
||||||
</DialogBody>
|
</DialogBody>
|
||||||
@ -51,28 +51,28 @@ const DetailDialog = () => {
|
|||||||
|
|
||||||
export default DetailDialog;
|
export default DetailDialog;
|
||||||
|
|
||||||
function generateInput(formData:any, handleChange:any, label:string, name:string, type: string, required: boolean, disabled: boolean) {
|
function generateInput(formData: any, handleChange: any, label: string, name: string, type: string, required: boolean, disabled: boolean) {
|
||||||
function generateDate(isoString: string) {
|
function generateDate(isoString: string) {
|
||||||
return isoString.slice(0, 10); // "2000-01-18"
|
return isoString.slice(0, 10); // "2000-01-18"
|
||||||
}
|
}
|
||||||
|
|
||||||
type Code = 'W' | 'Y' | 'N' | 'T' | 'P' | 'D' | 'L';
|
type Code = 'W' | 'Y' | 'N' | 'T' | 'P' | 'D' | 'L';
|
||||||
interface Reason {
|
interface Reason {
|
||||||
label: string;
|
label: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const statusMap: Record<Code, Reason> = {
|
const statusMap: Record<Code, Reason> = {
|
||||||
W: {label: 'Waiting Approval'},
|
W: { label: 'Waiting Approval' },
|
||||||
Y: {label: 'Approve'},
|
Y: { label: 'Approve' },
|
||||||
N: {label: 'Reject'},
|
N: { label: 'Reject' },
|
||||||
T: {label: 'Tidak lagi menggunakan layanan'},
|
T: { label: 'Tidak lagi menggunakan layanan' },
|
||||||
P: {label: 'Privasi dan keamanan'},
|
P: { label: 'Privasi dan keamanan' },
|
||||||
D: {label: 'Akun ganda'},
|
D: { label: 'Akun ganda' },
|
||||||
L: {label: 'Lainnya'}
|
L: { label: 'Lainnya' }
|
||||||
};
|
};
|
||||||
if (name == 'reason_deletion' || name == 'status_approve') {
|
if (name == 'reason_deletion' || name == 'status_approve') {
|
||||||
const status = formData[name] as Code
|
const status = formData[name] as Code
|
||||||
const fixStatus = statusMap[status] ?? {label: formData[name]}
|
const fixStatus = statusMap[status] ?? { label: formData[name] }
|
||||||
formData[name] = fixStatus.label
|
formData[name] = fixStatus.label
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
@ -80,15 +80,15 @@ function generateInput(formData:any, handleChange:any, label:string, name:string
|
|||||||
<div className="w-full mt-5">
|
<div className="w-full mt-5">
|
||||||
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
{label}<span className="text-red-500">{required?"*":""}</span>
|
{label}<span className="text-red-500">{required ? "*" : ""}</span>
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
className="input"
|
className="input"
|
||||||
readOnly={disabled}
|
readOnly={disabled}
|
||||||
required={required}
|
required={required}
|
||||||
type={type}
|
type={type}
|
||||||
name={name}
|
name={name}
|
||||||
value={formData[name]?(type === 'date' ? generateDate(formData[name]) : formData[name]):""}
|
value={formData[name] ? (type === 'date' ? generateDate(formData[name]) : formData[name]) : ""}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user