| Current Path : /home/users/unlimited/www/whatsapp-crm/public/build/assets/ |
| Current File : /home/users/unlimited/www/whatsapp-crm/public/build/assets/Show-77b291e0.js |
import{r as y,T as J,c as g,e as d,f as x,F as ee,o as u,a as t,t as a,u as e,l as R,k,b as f,n as r,g as Y,h as q}from"./app-43851608.js";import te from"./App-ad5f7ecb.js";import{_ as c}from"./FormInput-4a309017.js";import{_ as se}from"./FormPhoneInput-c64878db.js";import{_ as z}from"./FormSelect-2d73589a.js";import{_ as oe}from"./BillingTable-36180a35.js";import{_ as le}from"./Modal-22a49fae.js";import{_ as ne}from"./UserTable-9f108c32.js";import{t as h}from"./index-17cd980e.js";import"./Sidebar-7bb6d772.js";import"./Menu-4221d61f.js";import"./ProfileModal-628e5b7c.js";import"./LangToggle-8d05b0dc.js";import"./MobileSidebar-b73cd192.js";import"./index-99011d5f.js";/* empty css */import"./use-text-value-242aa4d7.js";import"./ChevronUpDownIcon-8859f144.js";import"./debounce-729b203d.js";import"./_baseGetTag-2e10a2d1.js";import"./Table-69702a89.js";import"./Pagination-8172d90a.js";import"./_plugin-vue_export-helper-c27b6911.js";import"./TableHeaderRowItem-459897e8.js";import"./TableBodyRowItem-110be769.js";import"./AlertModal-1a288ce3.js";import"./useAlertModal-27d09708.js";import"./Dropdown-6e7c10b4.js";import"./use-tree-walker-7c9f6f67.js";import"./DropdownItem-48d91d39.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"},ae={key:0,class:"md:flex justify-between hidden"},re={class:"text-xl mb-1"},de={class:"mb-6 flex items-center text-sm leading-6 text-gray-600"},me=t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24"},[t("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),ue={class:"ml-1 mt-1"},pe={key:1,class:"flex justify-between"},ce={class:"flex items-center space-x-2 mb-8 mt-8 md:mt-0"},ge=t("div",{class:"rounded-full p-1"},[t("div",{class:"rounded-full w-32 h-32 bg-slate-200 flex justify-center items-center"},[t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"80",height:"80",viewBox:"0 0 24 24"},[t("g",{fill:"none","fill-rule":"evenodd"},[t("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"}),t("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),fe={class:"text-lg"},ve={class:"text-sm"},be={key:0,class:"bg-[#000] text-white text-xs py-1 px-2 rounded-md"},ye={class:"text-sm capitalize"},he={class:"flex space-x-4"},we={key:2,class:"flex border-b space-x-4 text-sm"},xe={key:3,class:"pt-5"},Ve={key:4,class:"pt-5"},$e={class:"sm:flex border-b py-5"},_e={class:"hidden sm:block sm:w-[40%] mb-1"},ke={class:"text-sm tracking-[0px]"},ze={class:"sm:w-[60%] sm:flex space-x-6"},Ce={class:"sm:w-[80%] grid gap-x-6 gap-y-4 sm:grid-cols-6"},Ue={key:0,class:"sm:flex border-b py-5"},Se={class:"hidden sm:block sm:w-[40%] mb-1"},Be={class:"text-sm tracking-[0px]"},Ze={class:"text-sm text-gray-500"},Ae={class:"sm:w-[60%]"},Oe={class:"sm:w-[80%] flex justify-between bg-primary rounded-[5px] p-1 space-x-2 mb-4 text-white"},je={key:0,class:"sm:w-[80%] grid gap-x-6 gap-y-4 sm:grid-cols-6"},Me={key:1,class:"sm:w-[80%] grid gap-x-6 gap-y-4 sm:grid-cols-6"},Ne={class:"sm:flex py-5"},Te={class:"hidden sm:block w-[40%] mb-1"},Fe={class:"text-sm tracking-[0px]"},De={class:"sm:w-[60%] sm:flex space-x-6"},Ee={class:"sm:w-[80%] grid gap-x-6 gap-y-4 sm:grid-cols-6"},Pe={class:"py-6"},He={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"},Le={class:"mt-5 grid grid-cols-1 gap-x-6 gap-y-4"},Je={class:"grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-6 sm:col-span-4"},Re={class:"bg-red-800 py-1 px-2 rounded-[5px] mt-6"},Ye={class:"text-[12px] flex items-center space-x-2 text-white"},qe=t("svg",{class:"text-white",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},[t("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),Ge={class:"mt-6 flex"},Ie=["disabled"],Ke={key:0,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},Qe=t("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),We=t("path",{fill:"currentColor",d:"M20 12h2A10 10 0 0 0 12 2V4A8 8 0 0 1 20 12Z"},[t("animateTransform",{attributeName:"transform",dur:"1s",from:"0 12 12",repeatCount:"indefinite",to:"360 12 12",type:"rotate"})],-1),Xe=[Qe,We],et={key:1},Zt={__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,s)=>{if(l){const m=JSON.parse(l);return(m==null?void 0:m[s])??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:h("Credit")},{value:"debit",label:h("Debit")},{value:"payment",label:h("Payment")}]),K=y([{value:"manual",label:h("Manual")},{value:"bank",label:h("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),w=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})},_=()=>{V.value=!V.value},X=async()=>{p.post("/admin/billing",{preserveScroll:!0,onSuccess:()=>{_(),w("billing")}})};return(l,s)=>(u(),g(ee,null,[d(te,null,{default:x(()=>{var m,F,D,E,P,H,L;return[t("div",ie,[i.organization===null?(u(),g("div",ae,[t("div",null,[t("h1",re,a(l.$t("Create organization")),1),t("p",de,[me,t("span",ue,a(l.$t("Create organization")),1)])]),t("div",null,[d(e(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(()=>[k(a(l.$t("Back")),1)]),_:1})])])):f("",!0),i.organization?(u(),g("div",pe,[t("div",ce,[ge,t("div",null,[t("h1",fe,a(i.organization.name),1),t("h2",ve,[k(a(l.$t("Subscription plan"))+": "+a(((D=(F=(m=i.organization)==null?void 0:m.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",be,a(l.$t("Trial period")),1)):f("",!0)]),t("h2",ye,a(l.$t("Valid until"))+": "+a(((L=(H=i.organization)==null?void 0:H.subscription)==null?void 0:L.valid_until)??"Not set"),1)])]),t("div",he,[t("div",null,[t("button",{type:"button",onClick:s[0]||(s[0]=n=>_()),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"},a(l.$t("Create transaction")),1)]),d(e(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(()=>[k(a(l.$t("Back")),1)]),_:1})])])):f("",!0),i.organization?(u(),g("div",we,[t("div",{onClick:s[1]||(s[1]=n=>w("organization")),class:r(["cursor-pointer px-2 py-2",v.value==="organization"?"bg-white":""])},a(l.$t("User details")),3),t("div",{onClick:s[2]||(s[2]=n=>w("team")),class:r(["cursor-pointer px-2 py-2",v.value==="team"?"bg-white":""])},a(l.$t("Team")),3),t("div",{onClick:s[3]||(s[3]=n=>w("billing")),class:r(["cursor-pointer px-2 py-2",v.value==="billing"?"bg-white":""])},a(l.$t("Billing history")),3)])):f("",!0),i.organization&&v.value==="team"?(u(),g("div",xe,[d(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",Ve,[d(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:s[20]||(s[20]=Y(n=>W(),["prevent"])),class:"bg-white py-5 px-5 rounded-bl-[0.5rem] rounded-br-[0.5rem]"},[t("div",$e,[t("div",_e,[t("h3",ke,a(l.$t("Organization details")),1)]),t("div",ze,[t("div",Ce,[d(c,{modelValue:e(o).name,"onUpdate:modelValue":s[4]||(s[4]=n=>e(o).name=n),name:l.$t("Name"),error:e(o).errors.name,type:"text",class:r("sm:col-span-6")},null,8,["modelValue","name","error"]),d(z,{modelValue:e(o).plan,"onUpdate:modelValue":s[5]||(s[5]=n=>e(o).plan=n),name:l.$t("Subscription plan"),error:e(o).errors.plan,options:Q(),type:"text",class:r("sm:col-span-6")},null,8,["modelValue","name","error","options"])])])]),i.organization===null?(u(),g("div",Ue,[t("div",Se,[t("h3",Be,a(l.$t("User details")),1),t("p",Ze,a(l.$t("Enter the details of the main administrative user of this organization")),1)]),t("div",Ae,[t("div",Oe,[t("button",{type:"button",class:r(["w-[50%] rounded-[5px] px-1 py-2 text-sm",{"bg-white text-black":e(o).create_user===1}]),onClick:s[6]||(s[6]=n=>C(1))},a(l.$t("Add user")),3),t("button",{type:"button",class:r(["w-[50%] rounded-[5px] px-1 py-2 text-sm",{"bg-white text-black":e(o).create_user===0}]),onClick:s[7]||(s[7]=n=>C(0))},a(l.$t("Select existing user")),3)]),e(o).create_user===1?(u(),g("div",je,[d(c,{modelValue:e(o).first_name,"onUpdate:modelValue":s[8]||(s[8]=n=>e(o).first_name=n),name:l.$t("First name"),error:e(o).errors.first_name,type:"text",class:r("sm:col-span-3")},null,8,["modelValue","name","error"]),d(c,{modelValue:e(o).last_name,"onUpdate:modelValue":s[9]||(s[9]=n=>e(o).last_name=n),name:l.$t("Last name"),error:e(o).errors.last_name,type:"text",class:r("sm:col-span-3")},null,8,["modelValue","name","error"]),d(c,{modelValue:e(o).email,"onUpdate:modelValue":s[10]||(s[10]=n=>e(o).email=n),name:l.$t("Email"),error:e(o).errors.email,type:"text",class:r("sm:col-span-3")},null,8,["modelValue","name","error"]),d(se,{modelValue:e(o).phone,"onUpdate:modelValue":s[11]||(s[11]=n=>e(o).phone=n),name:l.$t("Phone"),error:e(o).errors.phone,type:"text",class:r("sm:col-span-3")},null,8,["modelValue","name","error"]),d(c,{modelValue:e(o).password,"onUpdate:modelValue":s[12]||(s[12]=n=>e(o).password=n),name:l.$t("Password"),error:e(o).errors.password,type:"password",class:r("sm:col-span-3")},null,8,["modelValue","name","error"]),d(c,{modelValue:e(o).password_confirmation,"onUpdate:modelValue":s[13]||(s[13]=n=>e(o).password_confirmation=n),name:l.$t("Confirm password"),error:e(o).errors.password_confirmation,type:"password",class:r("sm:col-span-3")},null,8,["modelValue","name","error"])])):(u(),g("div",Me,[d(c,{modelValue:e(o).email,"onUpdate:modelValue":s[14]||(s[14]=n=>e(o).email=n),name:l.$t("Email"),error:e(o).errors.email,type:"text",class:r("sm:col-span-6")},null,8,["modelValue","name","error"])]))])])):f("",!0),t("div",Ne,[t("div",Te,[t("h3",Fe,a(l.$t("Address details")),1)]),t("div",De,[t("div",Ee,[d(c,{modelValue:e(o).street,"onUpdate:modelValue":s[15]||(s[15]=n=>e(o).street=n),name:l.$t("Street"),error:e(o).errors.street,type:"text",class:r("sm:col-span-6")},null,8,["modelValue","name","error"]),d(c,{modelValue:e(o).city,"onUpdate:modelValue":s[16]||(s[16]=n=>e(o).city=n),name:l.$t("City"),error:e(o).errors.city,type:"text",class:r("sm:col-span-3")},null,8,["modelValue","name","error"]),d(c,{modelValue:e(o).state,"onUpdate:modelValue":s[17]||(s[17]=n=>e(o).state=n),name:l.$t("State"),error:e(o).errors.state,type:"text",class:r("sm:col-span-3")},null,8,["modelValue","name","error"]),d(c,{modelValue:e(o).zip,"onUpdate:modelValue":s[18]||(s[18]=n=>e(o).zip=n),name:l.$t("Zip code"),error:e(o).errors.zip,type:"text",class:r("sm:col-span-3")},null,8,["modelValue","name","error"]),d(c,{modelValue:e(o).country,"onUpdate:modelValue":s[19]||(s[19]=n=>e(o).country=n),name:l.$t("Country"),error:e(o).errors.country,type:"text",class:r("sm:col-span-3")},null,8,["modelValue","name","error"])])])]),t("div",Pe,[t("button",He,a(l.$t("Save")),1)])],32)):f("",!0)])]}),_:1}),d(le,{label:l.$t("Create transaction"),isOpen:V.value},{default:x(()=>[t("div",Le,[t("form",{onSubmit:s[26]||(s[26]=Y(m=>X(),["prevent"])),class:""},[t("div",Je,[d(z,{modelValue:e(p).type,"onUpdate:modelValue":s[21]||(s[21]=m=>e(p).type=m),name:l.$t("Transaction type"),error:e(p).errors.type,options:I.value,class:r("sm:col-span-3")},null,8,["modelValue","name","error","options"]),d(c,{modelValue:e(p).amount,"onUpdate:modelValue":s[22]||(s[22]=m=>e(p).amount=m),name:l.$t("Amount"),error:e(p).errors.amount,type:"number",class:r("sm:col-span-3")},null,8,["modelValue","name","error"]),e(p).type==="payment"?(u(),q(z,{key:0,modelValue:e(p).method,"onUpdate:modelValue":s[23]||(s[23]=m=>e(p).method=m),name:l.$t("Payment method"),error:e(p).errors.method,options:K.value,class:r("sm:col-span-6")},null,8,["modelValue","name","error","options"])):(u(),q(c,{key:1,modelValue:e(p).description,"onUpdate:modelValue":s[24]||(s[24]=m=>e(p).description=m),name:l.$t("Description"),error:e(p).errors.description,type:"text",class:r("sm:col-span-6")},null,8,["modelValue","name","error"]))]),t("div",Re,[t("p",Ye,[qe,t("span",null,a(l.$t("You can't undo this transaction once you save it")),1)])]),t("div",Ge,[t("button",{type:"button",onClick:s[25]||(s[25]=m=>_()),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"},a(l.$t("Cancel")),1),t("button",{class:r(["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",Ke,Xe)):(u(),g("span",et,a(l.$t("Save")),1))],10,Ie)])],32)])]),_:1},8,["label","isOpen"])],64))}};export{Zt as default};