| Current Path : /home/users/unlimited/www/whatsapp-crm/public/build/assets/ |
| Current File : /home/users/unlimited/www/whatsapp-crm/public/build/assets/Create-9ccb5ee8.js |
import{r as h,T as j,c as n,e as c,f as x,F as b,o as a,a as e,t as l,u as s,l as B,k as g,g as w,n as p,b as f,d as R}from"./app-43851608.js";import{_ as T}from"./App-26099fac.js";import{t as u}from"./index-17cd980e.js";import{_ as A}from"./FormInput-4a309017.js";import{_ as y}from"./FormSelect-2d73589a.js";import{_ as N}from"./FormTextArea-a182534a.js";import{_ as U}from"./Modal-22a49fae.js";import"./Sidebar-13bbdf6e.js";import"./Menu-7a7609fd.js";import"./ProfileModal-628e5b7c.js";import"./LangToggle-8d05b0dc.js";import"./index-99011d5f.js";import"./MobileSidebar-64958b6d.js";/* empty css */import"./use-text-value-242aa4d7.js";import"./ChevronUpDownIcon-8859f144.js";const F={class:"bg-white md:bg-inherit pt-10 px-4 md:pt-8 md:p-8 rounded-[5px] text-[#000] h-full md:overflow-y-auto"},O={class:"flex justify-between"},P={class:"text-xl mb-1"},I={class:"mb-6 flex items-center text-sm leading-6 text-gray-600"},D=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24"},[e("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),E={class:"ml-1 mt-1"},G=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},[e("path",{fill:"currentColor","fill-rule":"evenodd",d:"M5.841 5.28a.75.75 0 0 0-1.06-1.06L1.53 7.47L1 8l.53.53l3.25 3.25a.75.75 0 0 0 1.061-1.06l-1.97-1.97H24.25a.75.75 0 0 0 0-1.5H3.871l1.97-1.97Z","clip-rule":"evenodd"})],-1),H={class:"flex border-b py-5"},W={class:"w-[40%] mb-1"},z={class:"text-sm text-gray-500 tracking-[0px]"},J={class:"w-[60%] flex space-x-6"},q={class:"w-[80%]"},K={class:"flex border-b py-5"},Q={class:"w-[40%] mb-1"},X={class:"text-sm text-gray-500 tracking-[0px]"},Y={class:"flex text-xs mt-2"},ee=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 24 24"},[e("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),te={class:"w-[60%] flex space-x-6"},se={class:"w-[80%]"},oe={class:"flex border-b py-5"},ie={class:"w-[40%] mb-1"},le={class:"text-sm text-gray-500 tracking-[0px]"},re={class:"flex text-xs mt-2"},ne=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 24 24"},[e("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),ae={class:"w-[60%] flex space-x-6"},de={class:"w-[80%]"},ce={class:"flex border-b py-5"},pe={class:"w-[40%] mb-1"},ue={class:"text-sm text-gray-500 tracking-[0px]"},me={class:"w-[60%] flex space-x-6"},he={class:"w-[80%]"},ge={key:0,class:"flex py-5"},fe={class:"w-[40%] mb-1"},xe={class:"text-sm text-gray-500 tracking-[0px]"},_e={class:"w-[60%] flex space-x-6"},ve={class:"w-[80%]"},be={class:p("sm:col-span-6 mb-2")},we={class:"mt-2"},ye={key:0,class:"form-error text-[#b91c1c] text-xs"},ke=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M8.25 15L12 18.75L15.75 15m-7.5-6L12 5.25L15.75 9"})],-1),$e={type:"submit",class:"float-right flex items-center space-x-4 rounded-md bg-black px-3 py-2 text-sm text-white shadow-sm hover:bg-slate-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"},Ce={key:1,class:"flex py-5"},Ve={class:"w-[40%] mb-1"},Le={key:0,class:"text-sm text-gray-500 tracking-[0px]"},Me={key:1,class:"text-sm text-gray-500 tracking-[0px]"},Se={class:"w-[60%] flex space-x-6"},Ze={class:"w-[80%]"},je=["accept"],Be={class:"text-center"},Re={key:0,class:"flex justify-center items-center"},Te={class:"flex justify-center items-center space-x-3 py-1 border bg-slate-100 rounded-lg mb-2 w-fit px-2"},Ae=e("div",null,[e("svg",{class:"mx-auto h-6 w-6 text-gray-400 cursor-pointer",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"M14 9a1.5 1.5 0 1 1 3 0a1.5 1.5 0 0 1-3 0Z"}),e("path",{fill:"currentColor","fill-rule":"evenodd",d:"M7.268 4.658a54.647 54.647 0 0 1 9.465 0l1.51.132a3.138 3.138 0 0 1 2.831 2.66a30.604 30.604 0 0 1 0 9.1a3.138 3.138 0 0 1-2.831 2.66l-1.51.131c-3.15.274-6.316.274-9.465 0l-1.51-.131a3.138 3.138 0 0 1-2.832-2.66a30.601 30.601 0 0 1 0-9.1a3.138 3.138 0 0 1 2.831-2.66l1.51-.132Zm9.335 1.495a53.147 53.147 0 0 0-9.206 0l-1.51.131A1.638 1.638 0 0 0 4.41 7.672a29.101 29.101 0 0 0-.311 5.17L7.97 8.97a.75.75 0 0 1 1.09.032l3.672 4.13l2.53-.844a.75.75 0 0 1 .796.21l3.519 3.91a29.101 29.101 0 0 0 .014-8.736a1.638 1.638 0 0 0-1.478-1.388l-1.51-.131Zm2.017 11.435l-3.349-3.721l-2.534.844a.75.75 0 0 1-.798-.213l-3.471-3.905l-4.244 4.243c.049.498.11.996.185 1.491a1.638 1.638 0 0 0 1.478 1.389l1.51.131c3.063.266 6.143.266 9.206 0l1.51-.131c.178-.016.35-.06.507-.128Z","clip-rule":"evenodd"})])],-1),Ne={class:"flex items-center space-x-2"},Ue={class:"text-sm"},Fe=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor","fill-rule":"evenodd",d:"M17.707 7.707a1 1 0 0 0-1.414-1.414L12 10.586L7.707 6.293a1 1 0 0 0-1.414 1.414L10.586 12l-4.293 4.293a1 1 0 1 0 1.414 1.414L12 13.414l4.293 4.293a1 1 0 1 0 1.414-1.414L13.414 12l4.293-4.293Z","clip-rule":"evenodd"})],-1),Oe=[Fe],Pe={class:"flex justify-center text-sm text-gray-600"},Ie={key:0,for:"file-upload",class:"relative cursor-pointer bg-white rounded-md font-medium hover:text-indigo-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-indigo-500"},De={class:"text-xs text-center text-gray-500"},Ee={key:1,for:"file-upload",class:"relative cursor-pointer bg-white rounded-md font-medium hover:text-indigo-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-indigo-500"},Ge={class:"text-xs text-center text-gray-500"},He={key:0,class:"form-error text-[#b91c1c] text-xs"},We={type:"submit",class:"mt-10 float-right flex items-center space-x-4 rounded-md bg-black px-3 py-2 text-sm text-white shadow-sm hover:bg-slate-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"},ze=e("div",{class:"flex bg-slate-50 p-2 rounded-md mt-3"},[e("span",{class:"font-light text-sm"},"Select a placeholder to add to your response. The placeholder will replace itself with the actual data.")],-1),Je={class:"mt-2 grid grid-cols-1 gap-x-6"},qe={class:"pt-3 grid grid-cols-2 gap-x-2 text-sm gap-y-1"},Ke=["onClick"],Qe={class:"mt-4 border-t pt-4"},ht={__name:"Create",props:["placeholders"],setup(k){const $=k,m=h(!1),_=h(null),C=o=>{const i=_.value;if(i){const d=i.selectionStart,r=i.selectionEnd;i.value=`${i.value.substring(0,d)}${o}${i.value.substring(r)}`}m.value=!1},V=o=>{t.response=o.target.value},t=j({name:null,trigger:null,match_criteria:null,response_type:"text",response:null}),L=h([{value:"exact match",label:u("When text is an exact match to trigger text")},{value:"contains",label:u("When text contains trigger text")}]),M=h([{value:"text",label:u("Respond with text")},{value:"image",label:u("Respond with image")},{value:"audio",label:u("Respond with audio")}]),S=o=>{const i=o.target.files[0],d=new FileReader;d.onload=r=>{t.response=i},d.readAsDataURL(i)},v=()=>{t.response=null},Z=()=>{t.post("/automation/basic",{preserveScroll:!0,onSuccess:()=>t.reset()})};return(o,i)=>(a(),n(b,null,[c(T,null,{default:x(()=>{var d;return[e("div",F,[e("div",O,[e("div",null,[e("h2",P,l(o.$t("Create automation")),1),e("p",I,[D,e("span",E,l(o.$t("Create reply automation using your own criteria")),1)])]),e("div",null,[c(s(B),{href:"/automation/basic",class:"flex items-center space-x-4 rounded-md bg-indigo-600 px-3 py-2 text-sm text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"},{default:x(()=>[G,g(" "+l(o.$t("Back")),1)]),_:1})])]),e("form",{onSubmit:i[7]||(i[7]=w(r=>Z(),["prevent"])),class:"bg-white border py-5 px-5 rounded-[0.5rem]"},[e("div",H,[e("div",W,[e("h2",z,l(o.$t("Name")),1)]),e("div",J,[e("div",q,[c(A,{modelValue:s(t).name,"onUpdate:modelValue":i[0]||(i[0]=r=>s(t).name=r),type:"text",error:s(t).errors.name,class:p("w-full"),labelClass:"mb-0"},null,8,["modelValue","error"])])])]),e("div",K,[e("div",Q,[e("h2",X,l(o.$t("Trigger")),1),e("span",Y,[ee,g(" "+l(o.$t("Add the string of text responsible for triggering the response")),1)])]),e("div",te,[e("div",se,[c(N,{modelValue:s(t).trigger,"onUpdate:modelValue":i[1]||(i[1]=r=>s(t).trigger=r),type:"text",error:s(t).errors.trigger,textAreaRows:3,class:p("sm:col-span-6 mb-10")},null,8,["modelValue","error"])])])]),e("div",oe,[e("div",ie,[e("h2",le,l(o.$t("Match criteria")),1),e("span",re,[ne,g(" "+l(o.$t("Select the criteria for matching the trigger text above")),1)])]),e("div",ae,[e("div",de,[c(y,{modelValue:s(t).match_criteria,"onUpdate:modelValue":i[2]||(i[2]=r=>s(t).match_criteria=r),options:L.value,error:s(t).errors.match_criteria,class:p("sm:col-span-6"),placeholder:o.$t("Select criteria")},null,8,["modelValue","options","error","placeholder"])])])]),e("div",ce,[e("div",pe,[e("h2",ue,l(o.$t("Response type")),1)]),e("div",me,[e("div",he,[c(y,{modelValue:s(t).response_type,"onUpdate:modelValue":[i[3]||(i[3]=r=>s(t).response_type=r),v],options:M.value,error:s(t).errors.response_type,class:p("sm:col-span-6"),placeholder:"Select Type"},null,8,["modelValue","options","error"])])])]),s(t).response_type==="text"?(a(),n("div",ge,[e("div",fe,[e("h2",xe,l(o.$t("Text response")),1)]),e("div",_e,[e("div",ve,[e("div",null,[e("div",be,[e("div",we,[e("textarea",{class:p(["block w-full rounded-md border-0 py-1.5 px-4 text-gray-900 shadow-sm outline-none ring-1 ring-inset placeholder:text-gray-400 sm:text-sm sm:leading-6",s(t).errors.response?"ring-[#b91c1c]":"ring-gray-300"]),onInput:V,rows:"3",ref_key:"textareaRef",ref:_},l(s(t).response),35)]),s(t).errors.response?(a(),n("div",ye,l(s(t).errors.response),1)):f("",!0)]),e("button",{type:"button",onClick:i[4]||(i[4]=r=>m.value=!0),class:"bg-slate-100 px-2 py-1 rounded-md text-sm flex items-center gap-x-1 shadow-sm"},[g(" Add Variable "),ke])]),e("button",$e,l(o.$t("Save")),1)])])])):s(t).response_type==="image"||s(t).response_type==="audio"?(a(),n("div",Ce,[e("div",Ve,[s(t).response_type==="image"?(a(),n("h2",Le,l(o.$t("Image response")),1)):(a(),n("h2",Me,l(o.$t("Audio response")),1))]),e("div",Se,[e("div",Ze,[e("div",{class:p([s(t).errors.response?"border-[#b91c1c]":"border-gray-300","flex justify-center px-6 pt-5 pb-6 border-2 border-dashed rounded-md"])},[e("input",{type:"file",class:"sr-only",accept:s(t).response_type==="image"?".jpg, .png":".mp3",ref:"fileInput",id:"file-upload",onChange:i[5]||(i[5]=r=>S(r))},null,40,je),e("div",Be,[e("div",null,[s(t).response?(a(),n("div",Re,[e("div",Te,[Ae,e("div",Ne,[e("span",Ue,l(((d=s(t).response)==null?void 0:d.name)??s(t).response),1),e("button",{type:"button",onClick:i[6]||(i[6]=r=>v())},Oe)])])])):f("",!0),e("div",Pe,[s(t).response_type==="image"?(a(),n("label",Ie,[e("p",null,l(o.$t("Click to upload image")),1),e("p",De,l(o.$t("PNG or JPG files only")),1)])):(a(),n("label",Ee,[e("p",null,l(o.$t("Click to upload audio")),1),e("p",Ge,l(o.$t("MP3 files only")),1)]))])])])],2),s(t).errors.response?(a(),n("div",He,l(s(t).errors.response),1)):f("",!0),e("button",We,l(o.$t("Save")),1)])])])):f("",!0)],32)])]}),_:1}),c(U,{label:o.$t("Select variable"),isOpen:m.value},{default:x(()=>[ze,e("div",Je,[e("div",qe,[(a(!0),n(b,null,R($.placeholders,d=>(a(),n("button",{onClick:r=>C(d.value),class:"col-span-1 bg-gray-100 p-2 rounded-md text-left hover:bg-gray-50"},l(o.$t(d.label)),9,Ke))),256))]),e("div",Qe,[e("button",{type:"button",onClick:i[8]||(i[8]=w(d=>m.value=!1,["self"])),class:"inline-flex justify-center rounded-md border border-transparent bg-slate-50 px-4 py-2 text-sm text-slate-500 hover:bg-slate-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 mr-4"},l(o.$t("Cancel")),1)])])]),_:1},8,["label","isOpen"])],64))}};export{ht as default};