import{u as v,b as f,j as e}from"./vendor-BKmmeuxg.js";import{I as n}from"./input-error-LaPr_4wd.js";import{L as k}from"./loading-button-BnTVAMJ7.js";import{S as m}from"./switch-Db09nqXX.js";import{C as b}from"./card-D9_SJYq6.js";import{I as p}from"./input-DM0goJrn.js";import{L as c}from"./label-HmIcv5Yx.js";import{S as N,a as C,b as S,c as w,d as z}from"./select-CD9o3HN1.js";import{r as I}from"./utils-DxSsnXxD.js";import{o as x}from"./inertia-SZXqLvQm.js";import"./button-BpNwv2aE.js";import"./index-WW_1X1qx.js";import"./switch-DFFqeub-.js";const J=({payment:o})=>{const{props:h}=v(),{translate:u}=h,{settings:a,input:r,button:j,common:d}=u,{data:t,setData:i,post:_,errors:l,processing:g}=f({...o.fields,type:"razorpay"}),y=s=>{s.preventDefault(),_(route("settings.payment.update",{id:o.id}))};return e.jsxs(b,{className:"p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold",children:a.razorpay_settings}),e.jsx("p",{className:"text-gray-500",children:a.configure_payment_gateway.replace(":gateway","Razorpay")})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(c,{htmlFor:"status",children:t.active?d.enabled:d.disabled}),e.jsx(m,{id:"status",checked:t.active,onCheckedChange:s=>i("active",s)})]})]}),e.jsxs("form",{onSubmit:y,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(c,{children:r.currency}),e.jsxs(N,{value:t.currency,onValueChange:s=>i("currency",s),children:[e.jsx(C,{children:e.jsx(S,{placeholder:r.currency})}),e.jsx(w,{children:I.map(s=>e.jsxs(z,{value:s.value,children:[s.label," (",s.value,")"]},s.value))})]}),e.jsx(n,{message:l.currency})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:[a.test_mode,":"]}),e.jsx(m,{id:"status",checked:t.test_mode,onCheckedChange:s=>i("test_mode",s)}),e.jsx(c,{htmlFor:"status",className:"text-gray-500",children:t.test_mode?a.using_test_environment:a.using_live_environment})]})]}),e.jsxs("div",{className:"border-b pb-6",children:[e.jsx("h3",{className:"mb-4 text-lg font-medium",children:a.api_credentials}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(c,{children:r.api_key}),e.jsx(p,{name:"api_key",value:t.api_key||"",onChange:s=>x(s,i),placeholder:r.api_key_placeholder}),e.jsx(n,{message:l.api_key}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:t.test_mode?a.use_test_mode_key.replace(":key","public key"):a.use_live_mode_key.replace(":key","public key")})]}),e.jsxs("div",{children:[e.jsx(c,{children:r.api_secret}),e.jsx(p,{name:"api_secret",value:t.api_secret||"",onChange:s=>x(s,i),placeholder:r.api_secret_placeholder,type:"password"}),e.jsx(n,{message:l.api_secret}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:t.test_mode?a.use_test_mode_key.replace(":key","secret key"):a.use_live_mode_key.replace(":key","secret key")})]})]})]}),e.jsx(k,{loading:g,type:"submit",className:"w-full",children:j.save_changes})]})]})};export{J as default};
