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 { onHandleChange } from '@/lib/inertia'; import { SharedData } from '@/types/global'; import { useForm, usePage } from '@inertiajs/react'; interface PaytmProps { payment: Settings; } const Paytm = ({ payment }: PaytmProps) => { const { props } = usePage(); const { translate } = props; const { settings, input, button, common } = translate; const { data, setData, post, errors, processing } = useForm({ ...(payment.fields as PaytmFields), type: 'paytm', }); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); post(route('settings.payment.update', { id: payment.id })); }; return (

{settings.paytm_settings}

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

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

{settings.api_credentials}

onHandleChange(e, setData)} placeholder={input.merchant_id_placeholder} />

{data.test_mode ? settings.use_staging_key.replace(':key', 'merchant ID') : settings.use_production_key.replace(':key', 'merchant ID')}

onHandleChange(e, setData)} placeholder={input.merchant_key_placeholder} type="password" />

{data.test_mode ? settings.use_staging_key.replace(':key', 'merchant key') : settings.use_production_key.replace(':key', 'merchant key')}

{button.save_changes}
); }; export default Paytm;