var I=Object.defineProperty;var j=Object.getOwnPropertySymbols;var L=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var f=(i,l,a)=>l in i?I(i,l,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[l]=a,r=(i,l)=>{for(var a in l||(l={}))L.call(l,a)&&f(i,a,l[a]);if(j)for(var a of j(l))M.call(l,a)&&f(i,a,l[a]);return i};import{h as z,r as S,a as F,l as R,_ as o,j as e,N as T,U as H,E as O,z as P,e as V,m as B,b as q,c6 as G,x as E,ak as U,g as Y,c as J,q as _,d as K,u as Q,s as W,t as u,aG as C,aH as w,aM as X}from"./main-40.js";import{L as Z}from"./bf-768-197.js";import{S as ee}from"./bf-313-198.js";import{B as y}from"./bf-476-127.js";import{t as N}from"./bf-892-199.js";import{F as k}from"./bf-3-86.js";import"./bf-586-70.js";import"./bf-141-80.js";import"./bf-896-77.js";import"./bf-764-144.js";import"./bf-285-116.js";import"./bf-866-72.js";function te({formID:i}){const[l,a]=z(U),[t,m]=S.useState({show:!1}),{css:x}=F(),{pathname:d}=R(),D=s=>{const c=Y(l,n=>{n.splice(s+1,0,{title:n[s].title,sub:n[s].sub,body:n[s].body}),n.push({updateTem:1})});a(c)},$=(s,c)=>{if(c.original.id){const n=J({formID:i,id:c.original.id},"bitforms_delete_mailtemplate").then(h=>{if(h!==void 0&&h.success){const b=_(l);b.splice(s,1),a(b)}});K.promise(n,{loading:"Deleting",success:"Successfully Deleted",error:"Error Occurred"})}else{const n=_(l);n.splice(s,1),a(n)}},p=()=>{t.show=!1,m(r({},t))},g=(s,c)=>{t.btnTxt=o("Delete"),t.body=o("Are you sure to delete this template"),t.btnClass="",t.action=()=>{$(s,c),p()},t.show=!0,m(r({},t))},v=s=>{t.btnTxt=o("Duplicate"),t.body=o("Are you sure to duplicate this template?"),t.btnClass="blue",t.action=()=>{D(s),p()},t.show=!0,m(r({},t))},A=[{Header:o("Template Name"),accessor:"title",Cell:s=>e.jsx(T,{to:`${d}/${s.row.index}`,children:e.jsx("b",{children:s.cell.value})})},{Header:o("Action"),accessor:"action",Cell:s=>e.jsxs(e.Fragment,{children:[e.jsx(y,{onClick:()=>v(s.row.index),className:"icn-btn mr-2 tooltip pos-rel",style:{"--tooltip-txt":`'${o("Duplicate")}'`},children:e.jsx(H,{size:"22"})}),e.jsx(T,{to:`${d}/${s.row.index}`,className:"icn-btn mr-2 flx flx-center tooltip pos-rel",style:{"--tooltip-txt":`'${o("Edit")}'`},children:e.jsx(O,{size:"22"})}),e.jsx(y,{onClick:()=>g(s.row.index,s.row),className:"icn-btn tooltip pos-rel",style:{"--tooltip-txt":`'${o("Delete")}'`},children:e.jsx(P,{size:"21"})})]})}];return e.jsxs("div",{className:"w-7",children:[e.jsx(V,{show:t.show,close:p,btnTxt:t.btnTxt,btnClass:t.btnClass,body:t.body,action:t.action}),e.jsx("h2",{children:o("Email Templates")}),e.jsxs("h5",{children:["How to setup Email Templates & Send Email Notification:  ",e.jsx("a",{href:N.emailTemplates.link,target:"_blank",rel:"noreferrer",className:"yt-txt ml-1 mr-1",children:"YouTube"}),e.jsx("a",{href:N.emailTemplatesDoc.link,target:"_blank",rel:"noreferrer",className:"doc-txt",children:"Documentation"})]}),e.jsxs("div",{className:"",children:[e.jsxs(B,{to:`${d}/new`,className:`${x(q.btn)} blue`,children:[e.jsx(Z,{size:"20"})," ",o("Add New Template")]}),l.length>0?e.jsx(G,{height:"60vh",className:"btcd-neu-table mr-1",columns:A,data:l}):e.jsxs("div",{className:x(E.btcdEmpty,E.txCenter),children:[e.jsx(ee,{size:"50"}),o("Empty")]})]})]})}const se=C(()=>w(()=>import("./bf-72-195.js"),["./bf-72-195.js","./main-40.js","./main-40.css","./bf-586-70.js","./bf-141-80.js","./bf-149-418.css","./bf-249-417.css","./bf-200-122.js","./bf-884-118.js","./bf-625-422.css"],import.meta.url),{fallback:e.jsx(k,{})}),le=C(()=>w(()=>import("./bf-974-196.js"),["./bf-974-196.js","./main-40.js","./main-40.css","./bf-586-70.js","./bf-141-80.js","./bf-149-418.css","./bf-249-417.css","./bf-200-122.js","./bf-884-118.js","./bf-625-422.css"],import.meta.url),{fallback:e.jsx(k,{})});function je(){const i=Q(X);return e.jsxs(W,{children:[e.jsx(u,{index:!0,element:e.jsx(te,{formID:i})}),e.jsx(u,{path:"/new",element:e.jsx(se,{})}),e.jsx(u,{path:"/:id",element:e.jsx(le,{})})]})}export{je as default};
