1import{A as E}from"./AdminLayout-CDEPcI7g.js";import{A as $}from"./AdminTopMenu-CLcLpxfW.js";import{J as D}from"./ConfirmationModal-Dg1UlSva.js";import{J as V}from"./SecondaryButton-ChCv-dFK.js";import{J as A}from"./DangerButton-B7Cp1iPJ.js";import{aH as u,O as l,P as B,Q as p,aj as e,S as h,ah as m,ai as s,a2 as i,F as b,a3 as f,T as _,Y as L,aI as v,aJ as O,as as g,aQ as P,W as S,aL as T}from"./vendor-DGIfAMcx.js";import{_ as J}from"./media-6pd64PdO.js";import"./mitt-D52JP_s6.js";import"./nuxt-ui-D3Q7VuiZ.js";import"./icons-BKDXwKQn.js";import"./clickOutside-DT2P2o-I.js";import"./Modal-DlKdN6vg.js";const F={title:null,status:!1,color:"green",currencies:[]},U=[{value:"l-green",hex:"#bbf7d0"},{value:"green",hex:"#22c55e"},{value:"d-green",hex:"#166534"},{value:"l-red",hex:"#fecaca"},{value:"red",hex:"#ef4444"},{value:"d-red",hex:"#991b1b"},{value:"l-yellow",hex:"#fef08a"},{value:"yellow",hex:"#eab308"},{value:"d-yellow",hex:"#854d0e"},{value:"l-gray",hex:"#e5e7eb"},{value:"gray",hex:"#6b7280"},{value:"d-gray",hex:"#374151"},{value:"l-orange",hex:"#fed7aa"},{value:"orange",hex:"#f97316"},{value:"d-orange",hex:"#9a3412"},{value:"l-brown",hex:"#d6d3d1"},{value:"brown",hex:"#a16207"},{value:"d-brown",hex:"#451a03"},{value:"l-purple",hex:"#e9d5ff"},{value:"purple",hex:"#a855f7"},{value:"d-purple",hex:"#581c87"},{value:"l-pink",hex:"#fbcfe8"},{value:"pink",hex:"#ec4899"},{value:"d-pink",hex:"#9d174d"}],I={components:{AppLayout:E,AdminTopMenu:$,JetConfirmationModal:D,JetSecondaryButton:V,JetDangerButton:A},props:{isEdit:{type:Boolean,default:!1},errors:{type:Object,default:()=>({})},paymentMethod:{type:Object,default:null},currencies:{type:Array,default:()=>[]},currenciesIds:{type:Array,default:()=>[]}},data(){return{sending:!1,form:{...F},showDeleteModal:!1}},computed:{colorOptions(){return U.map(t=>({...t,label:this.$t(`admin_p2p.payment_methods.color_${t.value.replace(/-/g,"_")}`)}))},subTitle(){return this.isEdit&&this.paymentMethod?this.paymentMethod.title:this.$t("admin_p2p.payment_methods.breadcrumb_create")},actionButtonTitle(){return this.isEdit?this.$t("admin_p2p.payment_methods.update_payment_method"):this.$t("admin_p2p.payment_methods.create_payment_method")},serverErrors(){return this.errors&&typeof this.errors=="object"?this.errors:{}}}
1,mounted(){this.isEdit&&this.paymentMethod&&(this.form={title:this.paymentMethod.title,status:!!this.paymentMethod.status,color:this.paymentMethod.color||"green",currencies:Array.isArray(this.currenciesIds)?[...this.currenciesIds]:[]})},methods:{fieldLabel(t){const o=`admin_p2p.payment_methods.attr_${t}`;return this.$te(o)?this.$t(o):t},submit(){if(this.$page.props.mode==="readonly")return this.$toast.warning(this.$t("admin_p2p.payment_methods.demo_readonly"));const t={onStart:()=>this.sending=!0,onFinish:()=>this.sending=!1,onSuccess:()=>this.$toast.success(this.$t("admin_p2p.payment_methods.toast_saved")),onError:()=>this.$toast.error(this.$t("admin_p2p.payment_methods.toast_form_errors"))};this.isEdit?this.$inertia.put(this.route("admin.peerPaymentMethods.update",this.paymentMethod.id),this.form,t):this.$inertia.post(this.route("admin.peerPaymentMethods.store"),this.form,t)},destroy(){if(this.$page.props.mode==="readonly")return this.$toast.warning(this.$t("admin_p2p.payment_methods.demo_readonly"));this.showDeleteModal=!0},closeDeleteModal(){this.showDeleteModal=!1},confirmDelete(){this.$inertia.delete(this.route("admin.peerPaymentMethods.destroy",this.paymentMethod.id),{onSuccess:()=>{this.$toast.success(this.$t("admin_p2p.payment_methods.toast_deleted")),this.showDeleteModal=!1},onError:()=>this.$toast.error(this.$t("admin_p2p.payment_methods.toast_delete_failed"))})}}},N={class:"space-y-6"},z={class:"flex items-center justify-between"},R={class:"flex items-center gap-2 text-sm text-slate-500 mb-1"},Q={class:"text-slate-700 font-medium"},q={class:"text-2xl font-bold text-slate-800"},H={class:"text-sm text-slate-500 mt-1"},W={class:"flex items-center gap-3"},Y={key:0,class:"p-4 bg-red-50 border border-red-200 rounded-lg"},G={class:"flex items-center gap-2 font-medium text-red-700 mb-2"},K={class:"list-disc list-inside text-sm text-red-600 space-y-1"},X={class:"bg-white rounded-xl shadow-md border border-slate-200 overflow-hidden"},Z={class:"px-6 py-4 border-b border-slate-200"},ee={class:"text-lg font-semibold text-slate-800"},te={class:"text-sm text-slate-500 mt-0.5"},se={class:"p-6 space-y-6"},oe={class:"block text-sm font-medium text-slate-700 mb-2"},re=["placeholder"],ne={key:0,class:"mt-1 text-sm text-red-600"},le={class:"block text-sm font-medium text-slate-800"},ae={class:"block text-xs text-slate-500"},ie={class:"block text-sm font-medium text-slate-700 mb-2"},de={class:"flex flex-wrap gap-2"},me=["value"],pe=["title"],he={class:"text-sm text-slate-700"},ue={key:0,class:"mt-1 text-sm text-red-600"},ce={class:"bg-white rounded-xl shadow-md border border-slate-200 overflow-hidden mt-6"},_e={class:"px-6 py-4 border-b border-slate-200"},ye={class:"text-lg font-semibold text-slate-800"},be={class:"text-sm text-slate-500 mt-0.5"},fe={class:"p-6"},ve={key:0,class:"text-sm text-red-600 mb-3"},ge={key:1,class:"space-y-2"},xe=["value"],ke={class:"text-sm font-medium text-slate-800"},we={key:2,class:"text-sm text-slate-500"},Me={class:"mt-6 flex items-center justify-between flex-wrap gap-3"},Ce={class:"flex items-center gap-3 ms-auto"},je=["disabled"],Ee={key:0,class:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none"},$e={class:"text-sm text-slate-600"};function De(t,o,d,Ve,a,n){const x=u("admin-top-menu"),y=u("Link"),k=u("t-toggle"),w=u("jet-secondary-button"),M=u("jet-danger-button"),C=u("jet-confirmation-modal"),j=u("app-layout");return l(),B(j,null,{default:p(()=>[e("div",N,[h(x,{section:"peerPaymentMethods"}),e("div",z,[e("div",null,[e("div",R,[h(y,{href:t.route("admin.peerPaymentMethods"),class:"hover:text-slate-700 transition-colors"},{default:p(()=>[m(s(t.$t("admin_p2p.payment_methods.title")),1)]),_:1},8,["href"]),o[6]||(o[6]=e("span",null,"/",-1)),e("span",Q,s(n.subTitle),1)]),e("h1",q,s(d.isEdit?t.$t("admin_p2p.payment_methods.page_title_edit"):t.$t("admin_p2p.payment_methods.page_title_create")),1),e("p",H,s(d.isEdit?t.$t("admin_p2p.payment_methods.subtitle_edit"):t.$t("admin_p2p.payment_methods.subtitle_create")),1)]),e("div",W,[h(y,{href:t.route("admin.peerPaymentMethods"),class:"inline-flex items-center px-4 py-2 text-sm font-medium rounded-lg bg-slate-100 text-slate-700 hover:bg-slate-200 transition-colors"},{default:p(()=>[m(s(t.$t("admin_p2p.payment_methods.back_to_list")),1)]),_:1},8,["href"])])]),n.serverErrors&&Object.keys(n.serverErrors).length>0?(l(),i("div",Y,[e("div",G,[o[7]||(o[7]=e("span",null,"â",-1)),m(" "+s(t.$t("admin_p2p.payment_methods.server_errors_banner",{count:Object.keys(n.serverErrors).length,errors:Object.keys(n.serverErrors).length===1?t.$t("admin_p2p.payment_methods.validation_error_one"):t.$t("admin_p2p.payment_methods.validation_errors_many")})),1)]),e("ul",K,[(l(!0),i(b,null,f(n.serverErrors,(r,c)=>(l(),i("li",{key:c},[e("strong",null,s(n.fieldLabel(c))+":",1),m(" "+s(Array.isArray(r)?r[0]:r),1)]))),128))])])):_("",!0),e("form",{onSubmit:o[5]||(o[5]=L((...r)=>n.submit&&n.submit(...r),["prevent"]))},[e("div",X,[e("div",Z,[e("h2",ee,s(t.$t("admin_p2p.payment_methods.section_general")),1),e("p",te,s(t.$t("admin_p2p.payment_methods.section_general_hint")),1)]),e("div",se,[e("div",null,[e("label",oe,[m(s(t.$t("admin_p2p.payment_methods.field_name"))+" ",1),o[8]||(o[8]=e("span",{class:"text-red-500"},"*",-1))]),v(e("input",{"onUpdate:modelValue":o[0]||(o[0]=r=>
1a.form.title=r),type:"text",class:"w-full px-3 py-2 text-sm rounded-lg border border-slate-200 bg-white focus:border-blue-500 focus:ring-2 focus:ring-blue-500/20 transition-colors",placeholder:t.$t("admin_p2p.payment_methods.field_name_placeholder")},null,8,re),[[O,a.form.title]]),d.errors.title?(l(),i("p",ne,s(d.errors.title),1)):_("",!0)]),e("div",{class:g(["flex items-center justify-between p-4 rounded-lg border border-slate-200 transition-colors",a.form.status?"bg-emerald-50 border-emerald-200":"bg-slate-50"])},[e("div",null,[e("span",le,s(t.$t("admin_p2p.payment_methods.field_active")),1),e("span",ae,s(t.$t("admin_p2p.payment_methods.field_active_hint")),1)]),h(k,{modelValue:a.form.status,"onUpdate:modelValue":o[1]||(o[1]=r=>a.form.status=r)},null,8,["modelValue"])],2),e("div",null,[e("label",ie,s(t.$t("admin_p2p.payment_methods.field_badge_color")),1),e("div",de,[(l(!0),i(b,null,f(n.colorOptions,r=>(l(),i("label",{key:r.value,class:g(["inline-flex items-center gap-2 px-3 py-2 rounded-lg border-2 cursor-pointer transition-colors",a.form.color===r.value?"border-blue-500 bg-blue-50":"border-slate-200 hover:border-slate-300 bg-white"])},[v(e("input",{type:"radio","onUpdate:modelValue":o[2]||(o[2]=c=>a.form.color=c),value:r.value,class:"sr-only peer"},null,8,me),[[P,a.form.color]]),e("span",{class:"w-5 h-5 rounded-full shrink-0 border border-slate-300",style:S({backgroundColor:r.hex}),title:r.label},null,12,pe),e("span",he,s(r.label),1)],2))),128))]),d.errors.color?(l(),i("p",ue,s(d.errors.color),1)):_("",!0)])])]),e("div",ce,[e("div",_e,[e("h2",ye,s(t.$t("admin_p2p.payment_methods.section_fiat_currencies")),1),e("p",be,s(t.$t("admin_p2p.payment_methods.section_fiat_currencies_hint")),1)]),e("div",fe,[d.errors.currencies?(l(),i("p",ve,s(d.errors.currencies),1)):_("",!0),d.currencies?.length?(l(),i("div",ge,[(l(!0),i(b,null,f(d.currencies,r=>(l(),i("label",{key:r.id,class:"relative flex items-center gap-3 p-3 rounded-lg border border-slate-200 hover:bg-slate-50 cursor-pointer transition-colors"},[v(e("input",{type:"checkbox",value:r.id,"onUpdate:modelValue":o[3]||(o[3]=c=>a.form.currencies=c),class:"sr-only peer"},null,8,xe),[[T,a.form.currencies]]),o[9]||(o[9]=e("div",{class:"w-4 h-4 border-2 border-slate-300 rounded bg-white peer-checked:bg-blue-500 peer-checked:border-blue-500 transition-colors shrink-0"},null,-1)),o[10]||(o[10]=e("svg",{class:"absolute start-3 top-1/2 -translate-y-1/2 w-4 h-4 hidden peer-checked:block pointer-events-none text-white",fill:"none",stroke:"currentColor","stroke-width":"3",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 13l4 4L19 7"})],-1)),e("span",ke,s(r.name)+" ("+s(r.symbol)+")",1)]))),128))])):(l(),i("p",we,s(t.$t("admin_p2p.payment_methods.no_fiat_currencies")),1))])]),e("div",Me,[d.isEdit?(l(),i("button",{key:0,type:"button",onClick:o[4]||(o[4]=(...r)=>n.destroy&&n.destroy(...r)),class:"px-4 py-2.5 text-sm font-medium rounded-lg border border-red-200 text-red-600 hover:bg-red-50 bg-white transition-colors"},s(t.$t("admin_p2p.payment_methods.delete_payment_method")),1)):_("",!0),e("div",Ce,[h(y,{href:t.route("admin.peerPaymentMethods"),class:"inline-flex items-center px-4 py-2.5 text-sm font-medium rounded-lg bg-slate-100 text-slate-700 hover:bg-slate-200 transition-colors"},{default:p(()=>[m(s(t.$t("admin_p2p.payment_methods.cancel")),1)]),_:1},8,["href"]),e("button",{type:"submit",disabled:a.sending,class:"inline-flex items-center justify-center gap-2 px-4 py-2.5 bg-blue-600 text-white text-sm font-semibold rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"},[a.sending?(l(),i("svg",Ee,[...o[11]||(o[11]=[e("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4",opacity:"0.25"},null,-1),e("path",{fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z",opacity:"0.75"},null,-1)])])):_("",!0),m(" "+s(a.sending?t.$t("admin_p2p.payment_methods.saving"):n.actionButtonTitle),1)],8,je)])])],32),h(C,{show:a.showDeleteModal,type:"danger",onClose:n.closeDeleteModal},{title:p(()=>[m(s(t.$t("admin_p2p.payment_methods.modal_delete_title")),1)]),content:p(()=>[e("p",$e,s(t.$t("admin_p2p.payment_methods.modal_delete_body")),1)]),footer:p(()=>[h(w,{onClick:n.closeDeleteModal},{default:p(()=>[m(s(t.$t("admin_p2p.payment_methods.cancel")),1)]),_:1},8,["onClick"]),h(M,{class:"ms-3",onClick:n.confirmDelete},{default:p(()=>[m(s(t.$t("admin_p2p.payment_methods.modal_delete_confirm")),1)]),_:1},8,["onClick"])]),_:1},8,["show","onClose"])])]),_:1})}const ze=J(I,[["render",De]]);export{ze as default}; 2//# sourceMappingURL=PaymentMethodForm-CD6L0QoY.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.