import InputError from '@/components/input-error'; import LoadingButton from '@/components/loading-button'; import Switch from '@/components/switch'; import { Card } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import paypalCurrencies from '@/data/currencies/paypal'; import { onHandleChange } from '@/lib/inertia'; import { SharedData } from '@/types/global'; import { useForm, usePage } from '@inertiajs/react'; interface PaypalProps { payment: Settings; } const Paypal = ({ payment }: PaypalProps) => { const { props } = usePage(); const { translate } = props; const { settings, input, button, common } = translate; const { data, setData, post, errors, processing } = useForm({ ...(payment.fields as PaypalFields), type: 'paypal', }); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); post(route('settings.payment.update', { id: payment.id })); }; return (

{settings.paypal_settings}

{settings.configure_payment_gateway.replace(':gateway', 'PayPal')}

setData('active', checked)} />
{settings.test_mode}: setData('test_mode', checked)} />
{/* Sandbox Credentials Section */}

{settings.sandbox_credentials}

onHandleChange(e, setData)} placeholder={input.sandbox_client_id_placeholder} disabled={!data.test_mode} />
onHandleChange(e, setData)} placeholder={input.sandbox_secret_key_placeholder} disabled={!data.test_mode} type="password" />
{/* Production Credentials Section */}

{settings.production_credentials}

onHandleChange(e, setData)} placeholder={input.production_client_id_placeholder} disabled={data.test_mode} />
onHandleChange(e, setData)} placeholder={input.production_secret_key_placeholder} disabled={data.test_mode} type="password" />
{button.save_changes}
); }; export default Paypal;