| Current Path : /home/users/unlimited/www/whatsapp-crm/public/build/assets/ |
| Current File : /home/users/unlimited/www/whatsapp-crm/public/build/assets/Index-b7a2c092.js |
import{_ as R}from"./App-26099fac.js";import{T as z,r as T,O as D,o as r,c,a,w as H,v as O,u as d,b as w,e as t,f as s,k as n,t as l,F as V,d as Z,h as B,n as I,l as u,i as U,j as q}from"./app-43851608.js";import{d as E}from"./debounce-729b203d.js";import{_ as P}from"./AlertModal-1a288ce3.js";import{u as Y}from"./useAlertModal-27d09708.js";import{_ as G}from"./Table-69702a89.js";import{T as J,a as K,_ as p}from"./TableHeaderRowItem-459897e8.js";import{T as Q,a as W,_ as h}from"./TableBodyRowItem-110be769.js";import{_ as X}from"./Dropdown-6e7c10b4.js";import{_ as ee,a as N}from"./DropdownItem-48d91d39.js";import"./Sidebar-13bbdf6e.js";import"./Menu-7a7609fd.js";import"./Modal-22a49fae.js";import"./ProfileModal-628e5b7c.js";import"./FormInput-4a309017.js";import"./LangToggle-8d05b0dc.js";import"./index-99011d5f.js";import"./MobileSidebar-64958b6d.js";/* empty css */import"./_baseGetTag-2e10a2d1.js";import"./Pagination-8172d90a.js";import"./_plugin-vue_export-helper-c27b6911.js";import"./use-text-value-242aa4d7.js";import"./use-tree-walker-7c9f6f67.js";const te={class:"bg-[#f0f2f5] md:bg-white flex items-center md:border md:border-primary md:border-none md:shadow-sm h-12 md:h-10 w-full md:w-80 rounded-xl mb-6 text-sm mt-6"},se=a("span",{class:"pl-3"},[a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},[a("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m15 15l6 6m-11-4a7 7 0 1 1 0-14a7 7 0 0 1 0 14Z"})])],-1),ae=["placeholder"],oe=a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[a("path",{fill:"currentColor",d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10s10-4.5 10-10S17.5 2 12 2zm3.7 12.3c.4.4.4 1 0 1.4c-.4.4-1 .4-1.4 0L12 13.4l-2.3 2.3c-.4.4-1 .4-1.4 0c-.4-.4-.4-1 0-1.4l2.3-2.3l-2.3-2.3c-.4-.4-.4-1 0-1.4c.4-.4 1-.4 1.4 0l2.3 2.3l2.3-2.3c.4-.4 1-.4 1.4 0c.4.4.4 1 0 1.4L13.4 12l2.3 2.3z"})],-1),le=[oe],ie={key:1,class:"pr-2"},ne=q('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><circle cx="12" cy="3.5" r="1.5" fill="currentColor" opacity="0"><animateTransform attributeName="transform" calcMode="discrete" dur="2.4s" repeatCount="indefinite" type="rotate" values="0 12 12;90 12 12;180 12 12;270 12 12"></animateTransform><animate attributeName="opacity" dur="0.6s" keyTimes="0;0.5;1" repeatCount="indefinite" values="1;1;0"></animate></circle><circle cx="12" cy="3.5" r="1.5" fill="currentColor" opacity="0"><animateTransform attributeName="transform" begin="0.2s" calcMode="discrete" dur="2.4s" repeatCount="indefinite" type="rotate" values="30 12 12;120 12 12;210 12 12;300 12 12"></animateTransform><animate attributeName="opacity" begin="0.2s" dur="0.6s" keyTimes="0;0.5;1" repeatCount="indefinite" values="1;1;0"></animate></circle><circle cx="12" cy="3.5" r="1.5" fill="currentColor" opacity="0"><animateTransform attributeName="transform" begin="0.4s" calcMode="discrete" dur="2.4s" repeatCount="indefinite" type="rotate" values="60 12 12;150 12 12;240 12 12;330 12 12"></animateTransform><animate attributeName="opacity" begin="0.4s" dur="0.6s" keyTimes="0;0.5;1" repeatCount="indefinite" values="1;1;0"></animate></circle></svg>',1),re=[ne],de={key:0},ce={key:1},ue={class:"bg-slate-200 px-1 py-1 rounded-lg mr-1 hidden md:inline-block"},me={key:0},fe={key:1},pe={class:"bg-slate-200 px-1 py-1 rounded-lg mr-1 hidden md:inline-block"},he=a("button",{class:"inline-flex w-full justify-center rounded-md text-sm font-medium text-black hover:bg-opacity-30 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75"},[a("span",{class:"hover:bg-[#F6F7F9] hover:rounded-full w-[fit-content] p-2"},[a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},[a("path",{fill:"currentColor",d:"M12 16a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2m0-6a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2m0-6a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2Z"})])])],-1),_e={key:0,class:"bg-white rounded-xl"},ge={class:"p-4 py-8"},we=a("div",{class:"flex justify-center mb-4"},[a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"72",height:"72",viewBox:"0 0 256 256"},[a("path",{fill:"currentColor",d:"M216 80h-32V48a16 16 0 0 0-16-16H40a16 16 0 0 0-16 16v128a8 8 0 0 0 13 6.22L72 154v30a16 16 0 0 0 16 16h93.59L219 230.22a8 8 0 0 0 5 1.78a8 8 0 0 0 8-8V96a16 16 0 0 0-16-16M66.55 137.78L40 159.25V48h128v88H71.58a8 8 0 0 0-5.03 1.78M216 207.25l-26.55-21.47a8 8 0 0 0-5-1.78H88v-32h80a16 16 0 0 0 16-16V96h32Z"})])],-1),ve={class:"text-center text-lg font-medium mb-4"},be={class:"flex justify-center"},ye={key:0},ke={__name:"CampaignTable",props:{rows:{type:Object,required:!0},filters:{type:Object}},emits:["delete"],setup(m,{emit:v}){const f=m,{isOpenAlert:g,openAlert:M,confirmAlert:j}=Y(),A=z({test:null}),L=o=>{A.delete("/campaigns/"+o)},_=T({search:f.filters.search}),S=o=>o===f.rows.data.length-1,b=T(!1),y=(o,i,e)=>i>0?(o/i*100).toFixed(2)+"%":(o/e*100).toFixed(2)+"%",k=(o,i,e)=>i>0?o+"/"+i:o+"/"+e,F=()=>{_.value.search=null,$()},x=E(()=>{b.value=!0,$()},1e3),$=()=>{D.visit("/campaigns",{method:"get",data:_.value})};return(o,i)=>(r(),c(V,null,[a("div",te,[se,H(a("input",{onInput:i[0]||(i[0]=(...e)=>d(x)&&d(x)(...e)),"onUpdate:modelValue":i[1]||(i[1]=e=>_.value.search=e),type:"text",class:"outline-none px-4 w-full bg-inherit",placeholder:o.$t("Search campaigns")},null,40,ae),[[O,_.value.search]]),b.value===!1&&_.value.search?(r(),c("button",{key:0,onClick:F,type:"button",class:"pr-2"},le)):w("",!0),b.value?(r(),c("span",ie,re)):w("",!0)]),t(G,{rows:m.rows},{default:s(()=>[t(J,null,{default:s(()=>[t(K,null,{default:s(()=>[t(p,{position:"first"},{default:s(()=>[n(l(o.$t("Campaign name")),1)]),_:1}),t(p,{class:"hidden md:table-cell"},{default:s(()=>[n(l(o.$t("Template")),1)]),_:1}),t(p,null,{default:s(()=>[n(l(o.$t("Delivery rate")),1)]),_:1}),t(p,null,{default:s(()=>[n(l(o.$t("Read rate")),1)]),_:1}),t(p,null,{default:s(()=>[n(l(o.$t("Status")),1)]),_:1}),t(p,{position:"last"})]),_:1})]),_:1}),t(Q,null,{default:s(()=>[(r(!0),c(V,null,Z(m.rows.data,(e,C)=>(r(),B(W,{key:C,class:I(S(C)?"":"border-b")},{default:s(()=>[t(h,{position:"first"},{default:s(()=>[t(d(u),{href:"/campaigns/"+e.uuid,class:"block w-full"},{default:s(()=>[n(l(e.name),1)]),_:2},1032,["href"])]),_:2},1024),t(h,{class:"hidden md:table-cell"},{default:s(()=>[t(d(u),{href:"/campaigns/"+e.uuid,class:"block w-full"},{default:s(()=>[n(l(e.template.name),1)]),_:2},1032,["href"])]),_:2},1024),t(h,{class:"hidden sm:table-cell"},{default:s(()=>[t(d(u),{href:"/campaigns/"+e.uuid,class:"block w-full"},{default:s(()=>[e.status=="scheduled"?(r(),c("div",de,l(o.$t("N/A")),1)):(r(),c("div",ce,[a("span",ue,l(y(e.delivery_count,e.contacts_count,e.contact_group_count)),1),n(" "+l(k(e.delivery_count,e.contacts_count,e.contact_group_count)),1)]))]),_:2},1032,["href"])]),_:2},1024),t(h,{class:"hidden sm:table-cell"},{default:s(()=>[t(d(u),{href:"/campaigns/"+e.uuid,class:"block w-full"},{default:s(()=>[e.status=="scheduled"?(r(),c("div",me,l(o.$t("N/A")),1)):(r(),c("div",fe,[a("span",pe,l(y(e.read_count,e.contacts_count,e.contact_group_count)),1),n(" "+l(k(e.read_count,e.contacts_count,e.contact_group_count)),1)]))]),_:2},1032,["href"])]),_:2},1024),t(h,null,{default:s(()=>[t(d(u),{href:"/campaigns/"+e.uuid,class:"flex items-center w-full capitalize"},{default:s(()=>[n(l(e.status),1)]),_:2},1032,["href"])]),_:2},1024),t(h,{position:"last"},{default:s(()=>[t(X,{align:"right",class:"mt-2"},{items:s(()=>[t(ee,null,{default:s(()=>[t(N,{href:"/campaigns/"+e.uuid},{default:s(()=>[n(l(o.$t("View")),1)]),_:2},1032,["href"]),t(N,{as:"button",onClick:Be=>d(M)(e.uuid)},{default:s(()=>[n(l(o.$t("Delete")),1)]),_:2},1032,["onClick"])]),_:2},1024)]),default:s(()=>[he]),_:2},1024)]),_:2},1024)]),_:2},1032,["class"]))),128))]),_:1})]),_:1},8,["rows"]),m.rows.data.length==0?(r(),c("div",_e,[a("div",ge,[we,a("h3",ve,l(o.$t("You don't have any campaigns")),1),a("div",be,[t(d(u),{href:"/campaigns/create",class:"rounded-md px-3 py-2 text-sm hover:shadow-md text-white focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 bg-primary",disabled:o.isLoading},{default:s(()=>[o.isLoading?w("",!0):(r(),c("span",ye,l(o.$t("Create campaign")),1))]),_:1},8,["disabled"])])])])):w("",!0),t(P,{modelValue:d(g),"onUpdate:modelValue":i[2]||(i[2]=e=>U(g)?g.value=e:null),onConfirm:i[3]||(i[3]=()=>d(j)(L)),label:o.$t("Delete row"),description:o.$t("Are you sure you want to delete this campaign? This action will only delete the campaign; sent messages will not be deleted from the chat history.")},null,8,["modelValue","label","description"])],64))}},xe={class:"bg-white md:bg-inherit pt-0 px-4 md:pt-8 md:p-8 rounded-[5px] text-[#000] overflow-y-scroll capitalize"},$e={class:"md:flex justify-between mt-8 md:mt-0 hidden"},Ce={class:"text-xl mb-1"},Te={class:"mb-6 md:flex items-center text-sm leading-6 text-gray-600 hidden"},Ve=a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24"},[a("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 11v5m0 5a9 9 0 1 1 0-18a9 9 0 0 1 0 18Zm.05-13v.1h-.1V8h.1Z"})],-1),Ne={class:"ml-1 mt-1"},et={__name:"Index",props:["rows","filters"],setup(m){const v=m;return(f,g)=>(r(),B(R,null,{default:s(()=>[a("div",xe,[a("div",$e,[a("div",null,[a("h2",Ce,l(f.$t("Campaigns")),1),a("p",Te,[Ve,a("span",Ne,l(f.$t("Add campaigns")),1)])]),a("div",null,[t(d(u),{href:"/campaigns/create",class:"rounded-md bg-primary px-3 py-2 text-sm text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 md:block hidden"},{default:s(()=>[n(l(f.$t("Create campaign")),1)]),_:1})])]),t(ke,{rows:v.rows,filters:v.filters},null,8,["rows","filters"])])]),_:1}))}};export{et as default};