import{d as g,u as y,o as d,g as h,w as v,f as e,t as s,s as F,a,F as k,n as j,v as p,q as x,e as i,x as m,j as u}from"./app-bWy6VYs1.js";import{_ as q}from"./AppLayout.vue_vue_type_script_setup_true_lang-BwuDxc8O.js";import"./index-C32fBP6Q.js";import"./index-CMWG4mbA.js";import"./useForwardExpose-Cx2E44RD.js";import"./VisuallyHidden-0BfmsMPn.js";import"./RovingFocusGroup-D20OvR_w.js";import"./useArrowNavigation-C6Y-ieo6.js";import"./_plugin-vue_export-helper-DmjF0He4.js";const N={class:"space-y-6"},V={class:"bg-white shadow rounded-lg p-6"},C={class:"text-sm text-gray-600 mt-1"},S={class:"text-sm font-semibold text-gray-900 mb-3"},U={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},B=["onUpdate:modelValue"],D={key:0,class:"text-red-500 text-sm mt-1"},E=["onUpdate:modelValue"],w={key:0,class:"text-red-500 text-sm mt-1"},I={class:"flex justify-end"},L=["disabled"],G=g({__name:"DocumentNumbering",props:{numbering:{},company:{}},setup(c){const n=c,t=y({invoice_prefix:n.numbering.invoice_prefix,invoice_next:n.numbering.invoice_next,quote_prefix:n.numbering.quote_prefix,quote_next:n.numbering.quote_next,jobcard_prefix:n.numbering.jobcard_prefix,jobcard_next:n.numbering.jobcard_next,credit_note_prefix:n.numbering.credit_note_prefix,credit_note_next:n.numbering.credit_note_next,purchase_order_prefix:n.numbering.purchase_order_prefix,purchase_order_next:n.numbering.purchase_order_next}),_=[{key:"invoice",label:"Invoices",prefixField:"invoice_prefix",nextField:"invoice_next"},{key:"quote",label:"Quotes",prefixField:"quote_prefix",nextField:"quote_next"},{key:"jobcard",label:"Jobcards",prefixField:"jobcard_prefix",nextField:"jobcard_next"},{key:"credit_note",label:"Credit Notes",prefixField:"credit_note_prefix",nextField:"credit_note_next"},{key:"purchase_order",label:"Purchase Orders",prefixField:"purchase_order_prefix",nextField:"purchase_order_next"}],b=()=>{t.put("/administration/document-numbering")};return(f,o)=>(d(),h(q,null,{default:v(()=>[e("div",N,[e("div",V,[o[0]||(o[0]=e("h2",{class:"text-xl font-semibold text-gray-900"},"Document Numbering",-1)),e("p",C," Company: "+s(f.company.name)+". Set custom prefix and next number for each record type. ",1)]),e("form",{onSubmit:F(b,["prevent"]),class:"bg-white shadow rounded-lg p-6 space-y-6"},[(d(),a(k,null,j(_,r=>e("div",{key:r.key,class:"border rounded-lg p-4"},[e("h3",S,s(r.label),1),e("div",U,[e("div",null,[o[1]||(o[1]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Prefix",-1)),p(e("input",{"onUpdate:modelValue":l=>i(t)[r.prefixField]=l,type:"text",class:x(["w-full rounded border px-3 py-2",{"border-red-500":i(t).errors[r.prefixField]}]),placeholder:"Example: INV-"},null,10,B),[[m,i(t)[r.prefixField]]]),o[2]||(o[2]=e("p",{class:"text-xs text-gray-500 mt-1"},"Leave blank to use legacy numbering format.",-1)),i(t).errors[r.prefixField]?(d(),a("div",D,s(i(t).errors[r.prefixField]),1)):u("",!0)]),e("div",null,[o[3]||(o[3]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Next number",-1)),p(e("input",{"onUpdate:modelValue":l=>i(t)[r.nextField]=l,type:"number",min:"1",class:x(["w-full rounded border px-3 py-2",{"border-red-500":i(t).errors[r.nextField]}]),placeholder:"Example: 1001"},null,10,E),[[m,i(t)[r.nextField],void 0,{number:!0}]]),o[4]||(o[4]=e("p",{class:"text-xs text-gray-500 mt-1"},"Used when creating the next record of this type.",-1)),i(t).errors[r.nextField]?(d(),a("div",w,s(i(t).errors[r.nextField]),1)):u("",!0)])])])),64)),e("div",I,[e("button",{type:"submit",disabled:i(t).processing,class:"bg-blue-600 text-white px-5 py-2 rounded hover:bg-blue-700 disabled:opacity-50"},s(i(t).processing?"Saving...":"Save Numbering Settings"),9,L)])],32)])]),_:1}))}});export{G as default};
