| 1 |
var U=Object.defineProperty,G=Object.defineProperties;var X=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var Y=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable;var j=(n,s,o)=>s in n?U(n,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[s]=o,c=(n,s)=>{for(var o in s||(s={}))Y.call(s,o)&&j(n,o,s[o]);if(b)for(var o of b(s))J.call(s,o)&&j(n,o,s[o]);return n},T=(n,s)=>G(n,X(s));import{i as K,r as Q,a as W,F as Z,g as ee,aq as te,u as $,q as se,_ as l,j as e,a2 as y,an as ae,E as oe,X as le,d as ne,I as _,U as ie,bm as re,h as w,ce,f as P,aR as de,cd as me,$ as pe,c as ue,z as g,V as fe,B as xe,D as x,bx as v,G as D,N as he}from"./main-294.js";import{F as k}from"./bf-487-72.js";import{L as be}from"./bf-838-400.js";import{S as je}from"./bf-952-401.js";import{t as C}from"./bf-582-82.js";import{k as N,P as Te}from"./bf-176-80.js";import"./bf-867-113.js";function ye({formID:n}){const[s,o]=K(de),[a,p]=Q.useState({show:!1}),{css:E}=W(),F=Z(),{formType:I}=ee(),A=te(me),S=$(pe);let{pdf:u}=S.allFormSettings;u===void 0&&(u={direction:"ltr",font:{name:"DejaVuSansCondensed",fontFamily:"dejavusanscondensed"},fontColor:"#000000",fontFamily:"dejavusanscondensed",fontSize:10,orientation:"p",paperSize:"a4",pdfFileName:"",watermark:{}});const{pathname:h}=se(),z=t=>{const r=P(s,i=>{const{title:d,body:m,setting:B}=i[t],q=`${d} - Copy`;i.splice(t+1,0,{title:q,body:m,setting:B}),i.push({updateTem:1})});o(r)},L=(t,r)=>{if(r.original.id){const i=ue({formID:n,id:r.original.id},"bitforms_delete_pdf_template").then(d=>{if(d!==void 0&&d.success){const m=g(s);m.splice(t,1),o(m)}});fe.promise(i,{loading:"Deleting",success:"Successfully Deleted",error:"Error Occurred"})}else{const i=g(s);i.splice(t,1),o(i)}},f=()=>{a.show=!1,p(c({},a))},R=(t,r)=>{a.btnTxt=l("Delete"),a.body=l("Are you sure to delete this template"),a.btnClass="",a.action=()=>{L(t,r),f()},a.show=!0,p(c({},a))},M=t=>{a.btnTxt=l("Duplicate"),a.body=l("Are you sure to duplicate this template?"),a.btnClass="blue",a.action=()=>{z(t),f()},a.show=!0,p(c({},a))},O={title:"Untitled PDF Template",setting:T(c({},u),{password:{static:!0,pass:""}}),body:"${bf_all_data}"},V=()=>{if(!_){A(c({show:!0},ce.pdfProInstalledAlert));return}const t=s.length,r=P(s,i=>{i.push(O),i.push({updateTem:1})});o(r),F(`/form/settings/${I}/${n}/pdf-templates/${t}`)},H=[{Header:l("Template Name"),accessor:"title",Cell:t=>e.jsx(y,{to:`${h}/${t.row.index}`,children:e.jsx("b",{children:t.cell.value})})},{Header:l("Action"),accessor:"action",Cell:t=>e.jsxs(e.Fragment,{children:[e.jsx(N,{onClick:()=>M(t.row.index),className:"icn-btn mr-2 tooltip pos-rel",style:{"--tooltip-txt":`'${l("Duplicate")}'`},children:e.jsx(ae,{size:"22"})}),e.jsx(y,{to:`${h}/${t.row.index}`,className:"icn-btn mr-2 flx flx-center tooltip pos-rel",style:{"--tooltip-txt":`'${l("Edit")}'`},children:e.jsx(oe,{size:"22"})}),e.jsx(N,{onClick:()=>R(t.row.index,t.row),className:"icn-btn tooltip pos-rel",style:{"--tooltip-txt":`'${l("Delete")}'`},children:e.jsx(le,{size:"21"})})]})}];return e.jsxs("div",{className:"w-7 pos-rel",children:[e.jsx(ne,{show:a.show,close:f,btnTxt:a.btnTxt,btnClass:a.btnClass,body:a.body,action:a.action}),!_&&e.jsx(Te,{style:{height:"110%",left:-53,width:"110%"}}),e.jsx("h2",{children:l("PDF Templates")}),e.jsxs("h5",{className:"mt-3",children:[l("How to setup PDF Templates:"),e.jsx("a",{href:C.pdfTemplate.link,target:"_blank",rel:"noreferrer",className:"yt-txt ml-1 mr-1",children:l("YouTube")}),e.jsx("a",{href:C.pdfTemplateDoc.link,target:"_blank",rel:"noreferrer",className:"doc-txt",children:l("Documentation")})]}),e.jsxs("div",{className:"",children:[e.jsxs(ie,{size:"sm",onClick:V,variant:"tertiary",children:[e.jsx(be,{size:"20"})," ",l("Add New Template")]}),s.length>0?e.jsx(re,{height:"60vh",className:"btcd-neu-table mr-1",columns:H,data:s.sort((t,r)=>r.id-t.id)}):e.jsxs("div",{className:E(w.btcdEmpty,w.txCenter),children:[e.jsx(je,{size:"50"}),l("Empty")]})]})]})}const _e=v(()=>D(()=>import("./bf-547-402.js"),["./bf-547-402.js","./main-294.js","./main-294.css","./bf-176-80.js","./bf-293-475.css","./bf-186-103.js"],import.meta.url),{fallback:e.jsx(k,{})}),we=v(()=>D(()=>import("./bf-983-403.js"),["./bf-983-403.js","./main-294.js","./main-294.css","./bf-176-80.js","./bf-293-475.css","./bf-186-103.js","./bf-487-72.js","./bf-867-113.js","./bf-890-474.css"],import.meta.url),{fallback:e.jsx(k,{})});function Ee(){const n=$(he);return e.jsxs(xe,{children:[e.jsx(x,{index:!0,element:e.jsx(ye,{formID:n})}),e.jsx(x,{path:"/new",element:e.jsx(_e,{})}),e.jsx(x,{path:"/:id",element:e.jsx(we,{})})]})}export{Ee as default}; |