| Current Path : /home/users/unlimited/www/whatsapp-crm/public/build/assets/ |
| Current File : /home/users/unlimited/www/whatsapp-crm/public/build/assets/Show-c4378ca4.js |
import{r as y,T as J,c as g,f as m,g as x,F as ee,o as u,a as s,t as r,u as t,l as R,k as z,b as f,n as a,h as Y,i as q}from"./app-f1493ab2.js";import te from"./App-6e8cb8a8.js";import{_ as c}from"./FormInput-b3450213.js";import{_ as se}from"./FormPhoneInput-bc257ef2.js";import{_}from"./FormSelect-3a6ffebd.js";import{_ as oe}from"./BillingTable-62dc48d8.js";import{_ as le}from"./Modal-a0814fa2.js";import{_ as ne}from"./UserTable-606f0543.js";import{t as w}from"./index-764662c4.js";import"./Sidebar-b962a0c1.js";import"./Menu-45912eaa.js";import"./ProfileModal-09ae28bb.js";import"./tabs-80627b62.js";import"./hidden-f79cef22.js";import"./micro-task-89dcd6af.js";import"./transition-f32a8133.js";import"./use-outside-click-92c6377f.js";import"./LangToggle-d2b58a25.js";import"./MobileSidebar-5b51f786.js";import"./index-114bea05.js";/* empty css */import"./use-text-value-ecd8c541.js";import"./debounce-7f7c0d78.js";import"./_baseGetTag-f7f93ac1.js";import"./Table-700fbce6.js";import"./Pagination-6973c28d.js";import"./_plugin-vue_export-helper-c27b6911.js";import"./TableHeaderRowItem-6e9202af.js";import"./TableBodyRowItem-551209f9.js";import"./AlertModal-2bf70f0d.js";import"./useAlertModal-3aa166da.js";import"./Dropdown-c843374c.js";import"./use-tree-walker-d52d0c0b.js";import"./DropdownItem-5a13c2ff.js";const ie={class:"bg-white md:bg-inherit pt-0 px-4 md:pt-8 md:p-8 rounded-[5px] text-[#000] h-full overflow-y-scroll"},re={key:0,class:"md:flex justify-between hidden"},ae={class:"text-xl mb-1"},me={class:"mb-6 flex items-center text-sm leading-6 text-gray-600"},de={class:"ml-1 mt-1"},ue={key:1,class:"flex justify-between"},pe={class:"flex items-center space-x-2 mb-8 mt-8 md:mt-0"},ce={class:"text-lg"},ge={class:"text-sm"},fe={key:0,class:"bg-[#000] text-white text-xs py-1 px-2 rounded-md"},ve={class:"text-sm capitalize"},be={class:"flex space-x-4"},ye={key:2,class:"flex border-b space-x-4 text-sm"},we={key:3,class:"pt-5"},he={key:4,class:"pt-5"},xe={class:"sm:flex border-b py-5"},Ve={class:"hidden sm:block sm:w-[40%] mb-1"},$e={class:"text-sm tracking-[0px]"},ke={class:"sm:w-[60%] sm:flex space-x-6"},ze={class:"sm:w-[80%] grid gap-x-6 gap-y-4 sm:grid-cols-6"},_e={key:0,class:"sm:flex border-b py-5"},Ce={class:"hidden sm:block sm:w-[40%] mb-1"},Ue={class:"text-sm tracking-[0px]"},Se={class:"text-sm text-gray-500"},Be={class:"sm:w-[60%]"},Ze={class:"sm:w-[80%] flex justify-between bg-primary rounded-[5px] p-1 space-x-2 mb-4 text-white"},Ae={key:0,class:"sm:w-[80%] grid gap-x-6 gap-y-4 sm:grid-cols-6"},Oe={key:1,class:"sm:w-[80%] grid gap-x-6 gap-y-4 sm:grid-cols-6"},je={class:"sm:flex py-5"},Me={class:"hidden sm:block w-[40%] mb-1"},Ne={class:"text-sm tracking-[0px]"},Te={class:"sm:w-[60%] sm:flex space-x-6"},Fe={class:"sm:w-[80%] grid gap-x-6 gap-y-4 sm:grid-cols-6"},De={class:"py-6"},Ee={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"},Pe={class:"mt-5 grid grid-cols-1 gap-x-6 gap-y-4"},He={class:"grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-6 sm:col-span-4"},Le={class:"bg-red-800 py-1 px-2 rounded-[5px] mt-6"},Je={class:"text-[12px] flex items-center space-x-2 text-white"},Re={class:"mt-6 flex"},Ye=["disabled"],qe={key:0,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},Ge={key:1},St={__name:"Show",props:{showAddBtn:{type:Boolean,default:!0},title:String,organization:Object,users:Object,invoices:Object,plans:Object,filters:Object,mode:String},setup(G){var U,S,B,Z,A,O,j,M,N,T;const i=G,v=y("organization"),b=(l,e)=>{if(l){const d=JSON.parse(l);return(d==null?void 0:d[e])??null}else return null},o=J({name:(U=i.organization)==null?void 0:U.name,plan:(Z=(B=(S=i.organization)==null?void 0:S.subscription)==null?void 0:B.plan)==null?void 0:Z.uuid,create_user:1,first_name:null,last_name:null,email:null,phone:null,password:null,password_confirmation:null,street:b((A=i.organization)==null?void 0:A.address,"street"),city:b((O=i.organization)==null?void 0:O.address,"city"),state:b((j=i.organization)==null?void 0:j.address,"state"),zip:b((M=i.organization)==null?void 0:M.address,"zip"),country:b((N=i.organization)==null?void 0:N.address,"country")}),I=y([{value:"credit",label:w("Credit")},{value:"debit",label:w("Debit")},{value:"payment",label:w("Payment")}]),K=y([{value:"manual",label:w("Manual")},{value:"bank",label:w("Bank")}]),p=J({uuid:(T=i.organization)==null?void 0:T.uuid,type:null,amount:null,method:null,description:null}),Q=()=>i.plans.map(l=>({value:l.uuid,label:l.name})),V=y(!1),$=y(!1),h=l=>{v.value=l},C=l=>{o.create_user=l,l===0?(o.first_name=null,o.last_name=null,o.email=null,o.phone=null,o.password=null,o.password_confirmation=null):o.email=null},W=async()=>{const l=i.organization?window.location.pathname:"/admin/organizations";o[i.organization?"put":"post"](l,{preserveScroll:!0})},k=()=>{V.value=!V.value},X=async()=>{p.post("/admin/billing",{preserveScroll:!0,onSuccess:()=>{k(),h("billing")}})};return(l,e)=>(u(),g(ee,null,[m(te,null,{default:x(()=>{var d,F,D,E,P,H,L;return[s("div",ie,[i.organization===null?(u(),g("div",re,[s("div",null,[s("h1",ae,r(l.$t("Create organization")),1),s("p",me,[e[27]||(e[27]=s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24"},[s("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)),s("span",de,r(l.$t("Create organization")),1)])]),s("div",null,[m(t(R),{href:"/admin/organizations",class:"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(()=>[z(r(l.$t("Back")),1)]),_:1})])])):f("",!0),i.organization?(u(),g("div",ue,[s("div",pe,[e[28]||(e[28]=s("div",{class:"rounded-full p-1"},[s("div",{class:"rounded-full w-32 h-32 bg-slate-200 flex justify-center items-center"},[s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"80",height:"80",viewBox:"0 0 24 24"},[s("g",{fill:"none","fill-rule":"evenodd"},[s("path",{d:"M24 0v24H0V0h24ZM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427c-.002-.01-.009-.017-.017-.018Zm.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093c.012.004.023 0 .029-.008l.004-.014l-.034-.614c-.003-.012-.01-.02-.02-.022Zm-.715.002a.023.023 0 0 0-.027.006l-.006.014l-.034.614c0 .012.007.02.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01l-.184-.092Z"}),s("path",{fill:"currentColor",d:"M17 3.722v5.497l2.864.716A1.5 1.5 0 0 1 21 11.39V19a1 1 0 1 1 0 2H3a1 1 0 1 1 0-2v-7.69a1.5 1.5 0 0 1 .83-1.343L7 8.382V6.347a1.5 1.5 0 0 1 .973-1.405l7-2.625A1.5 1.5 0 0 1 17 3.722Zm-2 .721l-6 2.25V19h6V4.443Zm2 6.838V19h2v-7.22l-2-.5Zm-10-.663l-2 1V19h2v-8.382Z"})])])])],-1)),s("div",null,[s("h1",ce,r(i.organization.name),1),s("h2",ge,[z(r(l.$t("Subscription plan"))+": "+r(((D=(F=(d=i.organization)==null?void 0:d.subscription)==null?void 0:F.plan)==null?void 0:D.name)??"Not set")+" ",1),((P=(E=i.organization)==null?void 0:E.subscription)==null?void 0:P.status)==="trial"?(u(),g("span",fe,r(l.$t("Trial period")),1)):f("",!0)]),s("h2",ve,r(l.$t("Valid until"))+": "+r(((L=(H=i.organization)==null?void 0:H.subscription)==null?void 0:L.valid_until)??"Not set"),1)])]),s("div",be,[s("div",null,[s("button",{type:"button",onClick:e[0]||(e[0]=n=>k()),class:"rounded-md bg-indigo-600 px-3 h-9 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"},r(l.$t("Create transaction")),1)]),m(t(R),{href:"/admin/organizations",class:"rounded-md h-9 bg-black 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(()=>[z(r(l.$t("Back")),1)]),_:1})])])):f("",!0),i.organization?(u(),g("div",ye,[s("div",{onClick:e[1]||(e[1]=n=>h("organization")),class:a(["cursor-pointer px-2 py-2",v.value==="organization"?"bg-white":""])},r(l.$t("User details")),3),s("div",{onClick:e[2]||(e[2]=n=>h("team")),class:a(["cursor-pointer px-2 py-2",v.value==="team"?"bg-white":""])},r(l.$t("Team")),3),s("div",{onClick:e[3]||(e[3]=n=>h("billing")),class:a(["cursor-pointer px-2 py-2",v.value==="billing"?"bg-white":""])},r(l.$t("Billing history")),3)])):f("",!0),i.organization&&v.value==="team"?(u(),g("div",we,[m(ne,{rows:i.users,filters:i.filters,type:"user",showRole:!0,showDeleteBtn:!1},null,8,["rows","filters"])])):f("",!0),i.organization&&v.value==="billing"?(u(),g("div",he,[m(oe,{rows:i.invoices,filters:i.filters,uuid:i.organization.uuid},null,8,["rows","filters","uuid"])])):f("",!0),v.value==="organization"?(u(),g("form",{key:5,onSubmit:e[20]||(e[20]=Y(n=>W(),["prevent"])),class:"bg-white py-5 px-5 rounded-bl-[0.5rem] rounded-br-[0.5rem]"},[s("div",xe,[s("div",Ve,[s("h3",$e,r(l.$t("Organization details")),1)]),s("div",ke,[s("div",ze,[m(c,{modelValue:t(o).name,"onUpdate:modelValue":e[4]||(e[4]=n=>t(o).name=n),name:l.$t("Name"),error:t(o).errors.name,type:"text",class:a("sm:col-span-6")},null,8,["modelValue","name","error"]),m(_,{modelValue:t(o).plan,"onUpdate:modelValue":e[5]||(e[5]=n=>t(o).plan=n),name:l.$t("Subscription plan"),error:t(o).errors.plan,options:Q(),type:"text",class:a("sm:col-span-6")},null,8,["modelValue","name","error","options"])])])]),i.organization===null?(u(),g("div",_e,[s("div",Ce,[s("h3",Ue,r(l.$t("User details")),1),s("p",Se,r(l.$t("Enter the details of the main administrative user of this organization")),1)]),s("div",Be,[s("div",Ze,[s("button",{type:"button",class:a(["w-[50%] rounded-[5px] px-1 py-2 text-sm",{"bg-white text-black":t(o).create_user===1}]),onClick:e[6]||(e[6]=n=>C(1))},r(l.$t("Add user")),3),s("button",{type:"button",class:a(["w-[50%] rounded-[5px] px-1 py-2 text-sm",{"bg-white text-black":t(o).create_user===0}]),onClick:e[7]||(e[7]=n=>C(0))},r(l.$t("Select existing user")),3)]),t(o).create_user===1?(u(),g("div",Ae,[m(c,{modelValue:t(o).first_name,"onUpdate:modelValue":e[8]||(e[8]=n=>t(o).first_name=n),name:l.$t("First name"),error:t(o).errors.first_name,type:"text",class:a("sm:col-span-3")},null,8,["modelValue","name","error"]),m(c,{modelValue:t(o).last_name,"onUpdate:modelValue":e[9]||(e[9]=n=>t(o).last_name=n),name:l.$t("Last name"),error:t(o).errors.last_name,type:"text",class:a("sm:col-span-3")},null,8,["modelValue","name","error"]),m(c,{modelValue:t(o).email,"onUpdate:modelValue":e[10]||(e[10]=n=>t(o).email=n),name:l.$t("Email"),error:t(o).errors.email,type:"text",class:a("sm:col-span-3")},null,8,["modelValue","name","error"]),m(se,{modelValue:t(o).phone,"onUpdate:modelValue":e[11]||(e[11]=n=>t(o).phone=n),name:l.$t("Phone"),error:t(o).errors.phone,type:"text",class:a("sm:col-span-3")},null,8,["modelValue","name","error"]),m(c,{modelValue:t(o).password,"onUpdate:modelValue":e[12]||(e[12]=n=>t(o).password=n),name:l.$t("Password"),error:t(o).errors.password,type:"password",class:a("sm:col-span-3")},null,8,["modelValue","name","error"]),m(c,{modelValue:t(o).password_confirmation,"onUpdate:modelValue":e[13]||(e[13]=n=>t(o).password_confirmation=n),name:l.$t("Confirm password"),error:t(o).errors.password_confirmation,type:"password",class:a("sm:col-span-3")},null,8,["modelValue","name","error"])])):(u(),g("div",Oe,[m(c,{modelValue:t(o).email,"onUpdate:modelValue":e[14]||(e[14]=n=>t(o).email=n),name:l.$t("Email"),error:t(o).errors.email,type:"text",class:a("sm:col-span-6")},null,8,["modelValue","name","error"])]))])])):f("",!0),s("div",je,[s("div",Me,[s("h3",Ne,r(l.$t("Address details")),1)]),s("div",Te,[s("div",Fe,[m(c,{modelValue:t(o).street,"onUpdate:modelValue":e[15]||(e[15]=n=>t(o).street=n),name:l.$t("Street"),error:t(o).errors.street,type:"text",class:a("sm:col-span-6")},null,8,["modelValue","name","error"]),m(c,{modelValue:t(o).city,"onUpdate:modelValue":e[16]||(e[16]=n=>t(o).city=n),name:l.$t("City"),error:t(o).errors.city,type:"text",class:a("sm:col-span-3")},null,8,["modelValue","name","error"]),m(c,{modelValue:t(o).state,"onUpdate:modelValue":e[17]||(e[17]=n=>t(o).state=n),name:l.$t("State"),error:t(o).errors.state,type:"text",class:a("sm:col-span-3")},null,8,["modelValue","name","error"]),m(c,{modelValue:t(o).zip,"onUpdate:modelValue":e[18]||(e[18]=n=>t(o).zip=n),name:l.$t("Zip code"),error:t(o).errors.zip,type:"text",class:a("sm:col-span-3")},null,8,["modelValue","name","error"]),m(c,{modelValue:t(o).country,"onUpdate:modelValue":e[19]||(e[19]=n=>t(o).country=n),name:l.$t("Country"),error:t(o).errors.country,type:"text",class:a("sm:col-span-3")},null,8,["modelValue","name","error"])])])]),s("div",De,[s("button",Ee,r(l.$t("Save")),1)])],32)):f("",!0)])]}),_:1}),m(le,{label:l.$t("Create transaction"),isOpen:V.value},{default:x(()=>[s("div",Pe,[s("form",{onSubmit:e[26]||(e[26]=Y(d=>X(),["prevent"])),class:""},[s("div",He,[m(_,{modelValue:t(p).type,"onUpdate:modelValue":e[21]||(e[21]=d=>t(p).type=d),name:l.$t("Transaction type"),error:t(p).errors.type,options:I.value,class:a("sm:col-span-3")},null,8,["modelValue","name","error","options"]),m(c,{modelValue:t(p).amount,"onUpdate:modelValue":e[22]||(e[22]=d=>t(p).amount=d),name:l.$t("Amount"),error:t(p).errors.amount,type:"number",class:a("sm:col-span-3")},null,8,["modelValue","name","error"]),t(p).type==="payment"?(u(),q(_,{key:0,modelValue:t(p).method,"onUpdate:modelValue":e[23]||(e[23]=d=>t(p).method=d),name:l.$t("Payment method"),error:t(p).errors.method,options:K.value,class:a("sm:col-span-6")},null,8,["modelValue","name","error","options"])):(u(),q(c,{key:1,modelValue:t(p).description,"onUpdate:modelValue":e[24]||(e[24]=d=>t(p).description=d),name:l.$t("Description"),error:t(p).errors.description,type:"text",class:a("sm:col-span-6")},null,8,["modelValue","name","error"]))]),s("div",Le,[s("p",Je,[e[29]||(e[29]=s("svg",{class:"text-white",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},[s("path",{fill:"currentColor","fill-rule":"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625zM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5m0 9a1 1 0 1 0 0-2a1 1 0 0 0 0 2","clip-rule":"evenodd"})],-1)),s("span",null,r(l.$t("You can't undo this transaction once you save it")),1)])]),s("div",Re,[s("button",{type:"button",onClick:e[25]||(e[25]=d=>k()),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"},r(l.$t("Cancel")),1),s("button",{class:a(["inline-flex justify-center rounded-md border border-transparent bg-primary px-4 py-2 text-sm text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",{"opacity-50":$.value}]),disabled:$.value},[$.value?(u(),g("svg",qe,e[30]||(e[30]=[s("path",{fill:"currentColor",d:"M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2Zm0 18a8 8 0 1 1 8-8A8 8 0 0 1 12 20Z",opacity:".5"},null,-1),s("path",{fill:"currentColor",d:"M20 12h2A10 10 0 0 0 12 2V4A8 8 0 0 1 20 12Z"},[s("animateTransform",{attributeName:"transform",dur:"1s",from:"0 12 12",repeatCount:"indefinite",to:"360 12 12",type:"rotate"})],-1)]))):(u(),g("span",Ge,r(l.$t("Save")),1))],10,Ye)])],32)])]),_:1},8,["label","isOpen"])],64))}};export{St as default};