Files
site/public/dist/assets/MessangerModal.289f37b7.js
2025-04-21 16:03:20 +02:00

2 lines
5.1 KiB
JavaScript
Vendored

import{o as y,q as b,g as i,a5 as C,y as T,P as d,r as l,w as u,i as o,f as D,k as j,j as M,l as A,v as z,a as B,e as L,m as R}from"./vendor.7e4e5e39.js";import{_ as V}from"./plugin-vue_export-helper.21dcd24c.js";import{D as E,a as I,b as N,T as O,c as q}from"./transition.esm.89c10969.js";function S(a,t){return y(),b("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true"},[i("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})])}const F=a=>{const t=()=>{a.value.style.height="auto",a.value.style.height=a.value.scrollHeight+"px"};C(s=>{!a.value||(t(),a.value.addEventListener("input",t),s(()=>{var e;return(e=a.value)==null?void 0:e.removeEventListener("input",t)}))})},H={components:{Dialog:E,DialogOverlay:I,DialogTitle:N,TransitionChild:O,TransitionRoot:q,ChatIcon:S},setup(a,{expose:t}){const s=T({message:null,chat_room:null,user_id:null}),e=d(),c=d(),f=d(!1),h=d(!1),r=d(!1),g=p=>{f.value=!0,c.value=p,s.user_id=p.id,h.value||x(c.value)},m=()=>{f.value=!1},x=p=>{h.value=!0,B.post("/messenger-check-room",{params:{user:p.id}}).then(w=>{w.data>0&&(r.value=1,s.chat_room=w.data)})},v=()=>{if(!s.message){alert("\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435");return}s.chat_room?n():k()},n=()=>{s.post(route("messenger.store.profile"),{onSuccess:()=>{m(),s.message="",_()}})},k=()=>{s.post(route("messenger.create.room"),{onSuccess:()=>{m(),r.value=1,s.message="",_()}})},_=()=>{L.Inertia.visit(`/messenger?user=${c.value.username}`,{method:"get"})};return F(e),t({openAction:g}),{form:s,textarea:e,open:f,closeAction:m,user:c,showDialogLink:r,submit:v,linkTo:_}}},P={class:"flex items-center justify-center min-h-screen pt-4 px-4 pb-4 text-center sm:block sm:p-0"},G=o("span",{class:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true"},"\u200B",-1),J={class:"inline-block align-bottom bg-indigo-300 rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle w-full sm:max-w-lg sm:w-full sm:p-6"},K={class:"sm:flex sm:items-center"},Q={class:"mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-orange sm:mx-0 sm:h-10 sm:w-10"},U={class:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left"},W=R(" \u041D\u043E\u0432\u043E\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435 "),X={key:0,class:"ml-auto"},Y={class:"mt-5"},Z={class:"mt-5 sm:mt-4 sm:flex sm:flex-row space-x-3 justify-end"};function $(a,t,s,e,c,f){const h=l("DialogOverlay"),r=l("TransitionChild"),g=l("ChatIcon"),m=l("DialogTitle"),x=l("Dialog"),v=l("TransitionRoot");return y(),b(v,{as:"template",show:e.open},{default:u(()=>[i(x,{as:"div",static:"",class:"fixed z-[1000] inset-0 overflow-y-auto",open:e.open,onClose:e.closeAction},{default:u(()=>[o("div",P,[i(r,{as:"template",enter:"ease-out duration-300","enter-from":"opacity-0","enter-to":"opacity-100",leave:"ease-in duration-200","leave-from":"opacity-100","leave-to":"opacity-0"},{default:u(()=>[i(h,{class:"fixed inset-0 bg-indigo-200 bg-opacity-75 transition-opacity"})]),_:1}),G,i(r,{as:"template",enter:"ease-out duration-300","enter-from":"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95","enter-to":"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200","leave-from":"opacity-100 translate-y-0 sm:scale-100","leave-to":"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"},{default:u(()=>[o("div",J,[o("div",K,[o("div",Q,[i(g,{class:"h-6 w-6 text-red-600","aria-hidden":"true"})]),o("div",U,[i(m,{as:"h3",class:"text-lg leading-6 font-medium text-gray-light"},{default:u(()=>[W]),_:1})]),e.showDialogLink?(y(),D("div",X,[o("a",{href:"#",class:"underline text-gray text-xs",onClick:t[0]||(t[0]=j((...n)=>e.linkTo&&e.linkTo(...n),["prevent"]))},"\u043F\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u0447\u0430\u0442")])):M("",!0)]),o("div",Y,[A(o("textarea",{ref:"textarea","onUpdate:modelValue":t[1]||(t[1]=n=>e.form.message=n),rows:"3",name:"comment",class:"outline-none focus:ring-orange-dark focus:border-transparent focus:ring-offset-0 bg-indigo-200 text-white max-h-56 block w-full py-3 border-0 resize-none sm:text-sm",placeholder:"\u0421\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435 ..."},null,512),[[z,e.form.message]])]),o("div",Z,[o("button",{type:"button",class:"my-1 transition shadow-none hover:shadow-classic inline-flex items-center px-6 py-2 justify-center text-base rounded-md text-white bg-indigo-300 focus:outline-none",onClick:t[2]||(t[2]=(...n)=>e.closeAction&&e.closeAction(...n))}," \u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C "),o("button",{type:"button",class:"my-1 transition shadow-none hover:shadow-classic inline-flex items-center px-6 py-2 justify-center text-base rounded-md text-white bg-green focus:outline-none",onClick:t[3]||(t[3]=(...n)=>e.submit&&e.submit(...n))}," \u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C ")])])]),_:1})])]),_:1},8,["open","onClose"])]),_:1},8,["show"])}var oe=V(H,[["render",$]]);export{oe as M,F as u};