import{T as f,c as r,b as s,a,u as n,g as p,w as d,f as g,t as P,o as l,C as N,j as v}from"./app-z_grtNg1.js";import{_ as c,a as m}from"./TextInput-C3QbKAv6.js";import{_ as u}from"./InputLabel-Dmit8LpD.js";import{P as y}from"./PrimaryButton-i7WPAeR-.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";const x={key:0},T={class:"flex items-center gap-4"},V={key:0,class:"text-sm text-gray-600"},C={__name:"UpdateTransactionPinForm",props:{hasTransactionPin:{type:Boolean,default:!1}},setup(i){const t=f({current_transaction_pin:"",transaction_pin:"",transaction_pin_confirmation:""}),_=()=>{t.patch(route("profile.transaction-pin.update"),{preserveScroll:!0,onSuccess:()=>t.reset(),onError:()=>{t.reset("current_transaction_pin","transaction_pin","transaction_pin_confirmation")}})};return(h,e)=>(l(),r("section",null,[e[3]||(e[3]=s("header",null,[s("h2",{class:"text-lg font-medium text-gray-900"},"Transaction PIN"),s("p",{class:"mt-1 text-sm text-gray-600"}," Set a 4-digit PIN required before completing wallet purchases. ")],-1)),s("form",{class:"mt-6 space-y-6",onSubmit:v(_,["prevent"])},[i.hasTransactionPin?(l(),r("div",x,[a(u,{for:"current_transaction_pin",value:"Current Transaction PIN"}),a(c,{id:"current_transaction_pin",modelValue:n(t).current_transaction_pin,"onUpdate:modelValue":e[0]||(e[0]=o=>n(t).current_transaction_pin=o),type:"password",inputmode:"numeric",maxlength:"4",class:"mt-1 block w-full",autocomplete:"off",placeholder:"Current 4-digit PIN"},null,8,["modelValue"]),a(m,{message:n(t).errors.current_transaction_pin,class:"mt-2"},null,8,["message"])])):p("",!0),s("div",null,[a(u,{for:"transaction_pin",value:i.hasTransactionPin?"New Transaction PIN":"Transaction PIN"},null,8,["value"]),a(c,{id:"transaction_pin",modelValue:n(t).transaction_pin,"onUpdate:modelValue":e[1]||(e[1]=o=>n(t).transaction_pin=o),type:"password",inputmode:"numeric",maxlength:"4",class:"mt-1 block w-full",autocomplete:"off",placeholder:"4-digit PIN"},null,8,["modelValue"]),a(m,{message:n(t).errors.transaction_pin,class:"mt-2"},null,8,["message"])]),s("div",null,[a(u,{for:"transaction_pin_confirmation",value:"Confirm Transaction PIN"}),a(c,{id:"transaction_pin_confirmation",modelValue:n(t).transaction_pin_confirmation,"onUpdate:modelValue":e[2]||(e[2]=o=>n(t).transaction_pin_confirmation=o),type:"password",inputmode:"numeric",maxlength:"4",class:"mt-1 block w-full",autocomplete:"off",placeholder:"Repeat 4-digit PIN"},null,8,["modelValue"]),a(m,{message:n(t).errors.transaction_pin_confirmation,class:"mt-2"},null,8,["message"])]),s("div",T,[a(y,{disabled:n(t).processing},{default:d(()=>[g(P(i.hasTransactionPin?"Update PIN":"Set PIN"),1)]),_:1},8,["disabled"]),a(N,{"enter-active-class":"transition ease-in-out","enter-from-class":"opacity-0","leave-active-class":"transition ease-in-out","leave-to-class":"opacity-0"},{default:d(()=>[n(t).recentlySuccessful?(l(),r("p",V,"Saved.")):p("",!0)]),_:1})])],32)]))}};export{C as default};
