import{u as v,b as y,j as e}from"./vendor-BKmmeuxg.js";import{I as c}from"./input-error-LaPr_4wd.js";import{L as f}from"./loading-button-BnTVAMJ7.js";import{S as x}from"./switch-Db09nqXX.js";import{C as N}from"./card-D9_SJYq6.js";import{I as l}from"./input-DM0goJrn.js";import{L as r}from"./label-HmIcv5Yx.js";import{S as k,a as C,b as S,c as w,d as I}from"./select-CD9o3HN1.js";import{p as L}from"./utils-DxSsnXxD.js";import{o}from"./inertia-SZXqLvQm.js";import"./button-BpNwv2aE.js";import"./index-WW_1X1qx.js";import"./switch-DFFqeub-.js";const G=({payment:m})=>{const{props:_}=v(),{translate:h}=_,{settings:d,input:t,button:u,common:p}=h,{data:a,setData:i,post:j,errors:n,processing:g}=y({...m.fields,type:"paypal"}),b=s=>{s.preventDefault(),j(route("settings.payment.update",{id:m.id}))};return e.jsxs(N,{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:d.paypal_settings}),e.jsx("p",{className:"text-gray-500",children:d.configure_payment_gateway.replace(":gateway","PayPal")})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(r,{htmlFor:"status",children:a.active?p.enabled:p.disabled}),e.jsx(x,{id:"status",checked:a.active,onCheckedChange:s=>i("active",s)})]})]}),e.jsxs("form",{onSubmit:b,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(r,{children:t.currency}),e.jsxs(k,{value:a.currency,onValueChange:s=>i("currency",s),children:[e.jsx(C,{children:e.jsx(S,{placeholder:t.currency})}),e.jsx(w,{children:L.map(s=>e.jsxs(I,{value:s.value,children:[s.label," (",s.value,")"]},s.value))})]}),e.jsx(c,{message:n.currency})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:[d.test_mode,":"]}),e.jsx(x,{id:"status",checked:a.test_mode,onCheckedChange:s=>i("test_mode",s)}),e.jsx(r,{htmlFor:"status",className:"text-gray-500",children:a.test_mode?d.using_sandbox_environment:d.using_production_environment})]})]}),e.jsxs("div",{className:`border-b pb-6 ${a.test_mode?"":"opacity-60"}`,children:[e.jsx("h3",{className:"mb-4 text-lg font-medium",children:d.sandbox_credentials}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-1",children:[e.jsxs("div",{children:[e.jsx(r,{children:t.sandbox_client_id}),e.jsx(l,{name:"sandbox_client_id",value:a.sandbox_client_id||"",onChange:s=>o(s,i),placeholder:t.sandbox_client_id_placeholder,disabled:!a.test_mode}),e.jsx(c,{message:n.sandbox_client_id})]}),e.jsxs("div",{children:[e.jsx(r,{children:t.sandbox_secret_key}),e.jsx(l,{name:"sandbox_secret_key",value:a.sandbox_secret_key||"",onChange:s=>o(s,i),placeholder:t.sandbox_secret_key_placeholder,disabled:!a.test_mode,type:"password"}),e.jsx(c,{message:n.sandbox_secret_key})]})]})]}),e.jsxs("div",{className:`border-b pb-6 ${a.test_mode?"opacity-60":""}`,children:[e.jsx("h3",{className:"mb-4 text-lg font-medium",children:d.production_credentials}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-1",children:[e.jsxs("div",{children:[e.jsx(r,{children:t.production_client_id}),e.jsx(l,{name:"production_client_id",value:a.production_client_id||"",onChange:s=>o(s,i),placeholder:t.production_client_id_placeholder,disabled:a.test_mode}),e.jsx(c,{message:n.production_client_id})]}),e.jsxs("div",{children:[e.jsx(r,{children:t.production_secret_key}),e.jsx(l,{name:"production_secret_key",value:a.production_secret_key||"",onChange:s=>o(s,i),placeholder:t.production_secret_key_placeholder,disabled:a.test_mode,type:"password"}),e.jsx(c,{message:n.production_secret_key})]})]})]}),e.jsx(f,{loading:g,type:"submit",className:"w-full",children:u.save_changes})]})]})};export{G as default};
