import{_ as b}from"./ListTableActionLabel.vue_vue_type_script_setup_true_lang-BIAl7X25.js";import{a as m,F as k,_ as D}from"./AppLayout.vue_vue_type_script_setup_true_lang-BwuDxc8O.js";import{d as j,o,a as l,b as a,e as t,h as C,w as d,f as e,F as f,n as g,g as F,l as _,i as x,t as i,q as P,j as y,D as S}from"./app-bWy6VYs1.js";import{P as h}from"./plus-Da4iPAFw.js";import{S as A}from"./square-pen-VTID55Gt.js";import{T as q}from"./trash-2-zinYW52R.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 B={class:"p-4"},L={class:"mb-6 flex items-center justify-between"},N={class:"flex gap-2"},V={class:"space-y-6"},$={class:"border-b border-gray-200 bg-gray-50 px-6 py-4"},I={class:"flex items-center justify-between"},M={class:"flex items-center gap-3"},E={class:"text-2xl"},z={class:"text-lg font-semibold text-gray-900"},G={class:"text-sm text-gray-600"},H={key:0,class:"p-8 text-center"},U={class:"mt-1 text-gray-500"},J={class:"mt-6"},O={key:1,class:"divide-y divide-gray-200"},Q={class:"flex items-center justify-between"},R={class:"flex-1"},W={class:"flex items-center gap-3"},X={class:"text-lg font-semibold text-gray-900"},Y={class:"mt-1 text-sm text-gray-500"},Z={key:0},K={class:"mt-2 flex items-center gap-4 text-xs text-gray-500"},ee={key:0},te={class:"flex items-center gap-2"},se=["onClick"],ge=j({__name:"Index",props:{modules:{},templates:{}},setup(v){const c=v;function w(p){confirm(`Are you sure you want to delete "${p.name}"?`)&&S.delete(m.pdfTemplates.destroy(p.id).url)}function T(p){return{invoice:"📄",quote:"💼",jobcard:"📋","proforma-invoice":"🧾"}[p]||"📄"}return(p,n)=>(o(),l(f,null,[a(t(C),{title:"PDF Templates"}),a(D,{breadcrumbs:[{title:"Administration",href:t(m).index().url},{title:"PDF Templates",href:"#"}]},{default:d(()=>[e("div",B,[e("div",L,[n[0]||(n[0]=e("div",null,[e("h1",{class:"text-2xl font-bold text-gray-900"},"PDF Templates"),e("p",{class:"text-gray-600"},"Manage PDF templates for invoices, quotes, jobcards, and proforma invoices")],-1)),e("div",N,[(o(!0),l(f,null,g(c.modules,(u,r)=>(o(),F(t(_),{key:r,href:t(m).pdfTemplates.create().url+"?module="+r,class:"flex items-center gap-2 rounded-md bg-blue-600 px-4 py-2 text-sm text-white hover:bg-blue-700"},{default:d(()=>[a(t(h),{class:"h-4 w-4"}),x(" Add "+i(u)+" Template ",1)]),_:2},1032,["href"]))),128))])]),e("div",V,[(o(!0),l(f,null,g(c.modules,(u,r)=>(o(),l("div",{key:r,class:"rounded-lg border bg-white shadow-sm"},[e("div",$,[e("div",I,[e("div",M,[e("span",E,i(T(r)),1),e("div",null,[e("h2",z,i(u)+" Templates",1),e("p",G,i((c.templates[r]||[]).length)+" template(s) ",1)])]),a(t(_),{href:t(m).pdfTemplates.create().url+"?module="+r,class:"flex items-center gap-2 rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-700 hover:bg-gray-50"},{default:d(()=>[a(t(h),{class:"h-4 w-4"}),n[1]||(n[1]=x(" Add Template ",-1))]),_:1},8,["href"])])]),!c.templates[r]||c.templates[r].length===0?(o(),l("div",H,[a(t(k),{class:"mx-auto h-12 w-12 text-gray-400"}),n[3]||(n[3]=e("h3",{class:"mt-2 text-lg font-medium text-gray-900"},"No templates found",-1)),e("p",U,"Get started by creating your first "+i(u)+" template.",1),e("div",J,[a(t(_),{href:t(m).pdfTemplates.create().url+"?module="+r,class:"inline-flex items-center gap-2 rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700"},{default:d(()=>[a(t(h),{class:"h-4 w-4"}),n[2]||(n[2]=x(" Add Template ",-1))]),_:1},8,["href"])])])):(o(),l("div",O,[(o(!0),l(f,null,g(c.templates[r],s=>(o(),l("div",{key:s.id,class:"p-6 hover:bg-gray-50 transition-colors"},[e("div",Q,[e("div",R,[e("div",W,[e("h3",X,i(s.name),1),e("span",{class:P(["rounded-full px-2 py-1 text-xs font-medium",s.is_active?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"])},i(s.is_active?"Active":"Inactive"),3)]),e("p",Y,[x(" Created "+i(new Date(s.created_at).toLocaleDateString())+" ",1),s.updated_at!==s.created_at?(o(),l("span",Z," • Updated "+i(new Date(s.updated_at).toLocaleDateString()),1)):y("",!0)]),e("div",K,[e("span",null,"HTML: "+i(s.html_template?.length||0)+" chars",1),s.css_styles?(o(),l("span",ee,"CSS: "+i(s.css_styles.length)+" chars",1)):y("",!0)])]),e("div",te,[a(t(_),{href:t(m).pdfTemplates.edit(s.id).url,class:"inline-flex items-center justify-center rounded border px-2 py-1.5 text-sm text-gray-700 hover:bg-gray-50 md:px-3 md:py-1"},{default:d(()=>[a(b,{label:"Edit"},{default:d(()=>[a(t(A),{class:"h-4 w-4"})]),_:1})]),_:1},8,["href"]),e("button",{type:"button",onClick:ae=>w(s),class:"inline-flex items-center justify-center rounded border border-red-300 px-2 py-1.5 text-sm text-red-700 hover:bg-red-50 md:px-3 md:py-1"},[a(b,{label:"Delete"},{default:d(()=>[a(t(q),{class:"h-4 w-4"})]),_:1})],8,se)])])]))),128))]))]))),128))])])]),_:1},8,["breadcrumbs"])],64))}});export{ge as default};
