PageSourceSearch

https://redgo.in/assets/js/OutletInfo-B642ZDTi.js

js redgo.in collected 2026-09-24 15:05:52 UTC 11,202 bytes, 1 lines download raw bytes

1import{b as Y,u as Z,r as s,j as e,t as c}from"./index-Cf_ajVON.js";import{u as ee}from"./useRestaurantBackNavigation-DqFrvG5I.js";import{L as te}from"./lenis-DhnUlvj-.js";import{D as ae,a as se,d as re,b as oe,c as ne,e as ie}from"./dialog-CrMXwKWe.js";import{B as C}from"./button-B3Z62-N_.js";import{I as le}from"./input-B3lgn3HG.js";import{r as d}from"./index-BZFWozEr.js";import{f as L}from"./restaurantLocation-Du8Hbwol.js";import{I as ce}from"./ImageSourcePicker-37e9jziE.js";import{B as de}from"./BottomNavOrders-BjK6vb2N.js";import{A as me}from"./arrow-left-1EukSswS.js";import{S as ue}from"./star-B2ou6rgX.js";import{P}from"./pencil-u9GUEip8.js";import{m as O}from"./proxy-C1jOxt1V.js";import{M as pe}from"./map-pin-7Ib88_8s.js";import"./index-BH0fEq1S.js";import"./index-DvNrSChk.js";import"./index-BLHo7-Gi.js";import"./index-Bkla0msJ.js";import"./tslib.es6-CwyXKlH1.js";import"./index-BgkASZz5.js";import"./x-BzwCsDoT.js";import"./index-Bx4n9Pg3.js";import"./index-D2QmRZ8G.js";import"./imageUploadUtils-Cpbprjjy.js";import"./camera-DxcqLYyr.js";import"./upload-BhkmleXG.js";import"./useNotificationInbox-VAdTR4w4.js";import"./useRestaurantNotifications-DGH1NFFl.js";import"./index-BkL6vOXg.js";import"./routes-B2m2vR37.js";import"./trash-2-B1Y_baWX.js";import"./circle-check-CLROJLC6.js";import"./bell-DTCvULxx.js";import"./index.esm-BzR8oUpF.js";import"./restaurantOrderPricing-mzi3IFXw.js";import"./file-text-CrVJUl_B.js";import"./package-DB_WzaDM.js";import"./message-square-SH8cX_Q0.js";function rt(){const T=Y(),g=Z(),U=ee(),[j,D]=s.useState(null),[h,R]=s.useState(!0),[B,k]=s.useState(""),[ge,F]=s.useState(""),[M,A]=s.useState(""),[$,y]=s.useState("https://images.unsplash.com/photo-1568901346375-23c9450c58cd?w=800&h=400&fit=crop"),[q,w]=s.useState("https://images.unsplash.com/photo-1565299624946-b28f40a0ae38?w=200&h=200&fit=crop"),[he,f]=s.useState([]),[z,v]=s.useState(!1),[N,V]=s.useState(""),[W,_]=s.useState(""),[I,G]=s.useState(""),[fe,x]=s.useState(!1),[xe,b]=s.useState(null),[be,S]=s.useState(0);s.useRef(null);const H=s.useRef(null),[m,K]=s.useState(null);s.useEffect(()=>{const a=t=>{t&&(D(t),k(t.name||""),_(t.restaurantId||t.id||""),G(String(t.id||t._id||"")),A(L(t.location,t)),t.cuisines&&Array.isArray(t.cuisines)&&t.cuisines.length>0&&F(t.cuisines.join(", ")),t.profileImage?.url&&w(t.profileImage.url),t.coverImages&&Array.isArray(t.coverImages)&&t.coverImages.length>0?(f(t.coverImages.map(l=>({url:l.url||l,publicId:l.publicId}))),y(t.coverImages[0].url||t.coverImages[0])):t.menuImages&&Array.isArray(t.menuImages)&&t.menuImages.length>0?(f(t.menuImages.map(l=>({url:l.url,publicId:l.publicId}))),y(t.menuImages[0].url)):f([]))},n=async()=>{try{R(!0);const t=await d.refreshCurrentRestaurant(),l=t?.data?.data?.restaurant||t?.data?.restaurant;a(l)}catch(t){t.code!=="ERR_NETWORK"&&t.code!=="ECONNABORTED"&&t.message?.includes("timeout")}finally{R(!1)}},r=g.state?.savedLocation;r&&A(L(r)),n();const i=()=>{n()};return window.addEventListener("cuisinesUpdated",i),window.addEventListener("addressUpdated",i),window.addEventListener("ownerDataUpdated",i),()=>{window.removeEventListener("cuisinesUpdated",i),window.removeEventListener("addressUpdated",i),window.removeEventListener("ownerDataUpdated",i)}},[g.pathname,g.state?.savedLocation]),s.useEffect(()=>{const a=new te({duration:1.2,easing:r=>Math.min(1,1.001-Math.pow(2,-10*r)),smoothWheel:!0});function n(r){a.raf(r),requestAnimationFrame(n)}return requestAnimationFrame(n),()=>{a.destroy()}},[]);const J=async a=>{if(a)try{x(!0),b("profile");const r=(await d.uploadProfileImage(a))?.data?.data?.profileImage;if(r){r.url&&w(r.url);const i=await d.getCurrentRestaurant(),t=i?.data?.data?.restaurant||i?.data?.restaurant;t&&(D(t),t.profileImage?.url&&w(t.profileImage.url))}}catch{c.error("Failed to upload image. Please try again.")}finally{x(!1),b(null)}},E=async a=>{if(!a||Array.isArray(a)&&a.length===0)return;const n=Array.isArray(a)?a:[a];try{x(!0),b("menu"),S(n.length);const r=await d.getCurrentRestaurant(),i=r?.data?.data?.restaurant||r?.data?.restaurant,t=i?.menuImages&&Array.isArray(i.menuImages)?i.menuImages.map(o=>({url:o.url,publicId:o.publicId})):[],l=[],X=[];for(let o=0;o<n.length;o++)try{const p=(await d.uploadMenuImage(n[o]))?.data?.data?.menuImage;p?.url&&l.push({url:p.url,publicId:p.publicId||null})}
1catch(u){X.push({fileName:n[o]?.name||"image",error:u.message})}if(l.length>0){const o=[...t];l.forEach(u=>{o.find(p=>p.url===u.url)||o.push(u)});try{await d.updateProfile({menuImages:o}),c.success(`Successfully uploaded ${l.length} image(s)`)}catch{c.error("Images uploaded but failed to save.")}f(o),o.length>0&&y(o[0].url)}}catch{c.error("Failed to upload images.")}finally{x(!1),b(null),S(0)}},Q=async()=>{const a=N.trim();if(a){if(/[\/-]/.test(a)){c.error("Name cannot contain slashes (/) or hyphens (-)");return}try{await d.updateProfile({name:a}),k(a),v(!1),c.success("Name updated successfully")}catch{c.error("Failed to update name")}}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"min-h-screen bg-white overflow-x-hidden pb-24",children:[e.jsx("div",{className:"bg-white/80 backdrop-blur-md border-b border-gray-100 px-4 py-3 sticky top-0 z-50 shadow-sm",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[e.jsx("button",{onClick:U,className:"p-2 hover:bg-gradient-to-br from-[#B80B3D] to-[#66001D]/5 rounded-xl transition-all active:scale-95",children:e.jsx(me,{className:"w-5 h-5 text-[#B80B3D]"})}),e.jsx("h1",{className:"text-[17px] font-bold text-gray-900 tracking-tight",children:"Outlet Information"})]}),e.jsx("div",{className:"bg-gradient-to-br from-[#B80B3D] to-[#66001D] px-3 py-1.5 rounded-full shadow-sm",children:e.jsxs("p",{className:"text-[11px] font-black text-white uppercase tracking-wider",children:["ID: ",h?"...":I&&I.length>=5?I.slice(-5):W||"N/A"]})})]})}),e.jsxs("div",{className:"px-4 pt-4",children:[e.jsxs("div",{className:"relative w-full h-[180px] rounded-[2rem] overflow-hidden shadow-xl ring-1 ring-black/5",children:[e.jsx("img",{src:$,alt:"Restaurant banner",className:"w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-trans
1parent to-transparent"}),e.jsx("input",{ref:H,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:a=>E(Array.from(a.target.files||[]))})]}),e.jsx("div",{className:"relative z-10 px-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"relative -mt-12 group inline-block w-fit",children:e.jsx("div",{className:"w-24 h-24 rounded-[2rem] bg-white p-1.5 shadow-2xl ring-1 ring-black/5 shrink-0",children:e.jsx("img",{src:q,alt:"Restaurant thumbnail",className:"w-full h-full rounded-[1.6rem] object-cover"})})}),e.jsxs("div",{className:"pb-1",children:[e.jsx("h2",{className:"text-2xl font-black text-gray-900 leading-tight",children:h?"Loading...":B||"My Restaurant"}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsxs("div",{className:"bg-green-600 px-2.5 py-1 rounded-lg flex items-center gap-1 shrink-0 shadow-sm",children:[e.jsx("span",{className:"text-white text-xs font-black",children:j?.rating?.toFixed(1)||"0.0"}),e.jsx(ue,{className:"w-3 h-3 text-white fill-white"})]}),e.jsxs("span",{className:"text-gray-400 text-xs font-bold uppercase tracking-widest",children:[j?.totalRatings||0," Reviews"]})]}),e.jsxs("button",{onClick:()=>T("/food/restaurant/edit-owner",{state:{from:g.pathname,activeTab:"restaurant"}}),className:"mt-4 bg-gradient-to-br from-[#B80B3D] to-[#66001D] text-white px-5 py-2.5 rounded-xl text-xs font-bold flex items-center gap-2 shadow-lg shadow-[#B80B3D]/20 active:scale-95 transition-all w-fit",children:[e.jsx(P,{className:"w-3.5 h-3.5"}),"Edit Outlet Info"]})]})]})})]}),e.jsx("div",{className:"px-5 pt-8 pb-12 space-y-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs(O.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"bg-gradient-to-br from-blue-50/40 to-blue-50/80 rounded-[1.5rem] p-5 border border-blue-100/50 shadow-sm relative",children:[e.jsxs("p",{className:"text-[10px] text-[#B80B3D] font-black uppercase tracking-widest mb-1.5 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 bg-gradient-to-br from-[#B80B3D] to-[#66001D] rounded-full"}),"Restaurant Name"]}),e.jsx("p",{className:"text-lg font-black text-gray-900 group-hover:text-[#B80B3D] transition-colors",children:h?"Loading...":B||"N/A"})]}),e.jsxs(O.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2},className:"bg-gradient-to-br from-gray-50 to-gray-100/50 rounded-[1.5rem] p-5 border border-gray-200/50 shadow-sm relative",children:[e.jsxs("p",{className:"text-[10px] text-gray-500 font-black uppercase tracking-widest mb-2 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 bg-gray-500 rounded-full"}),"Location Address"]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"bg-white p-2 rounded-xl shadow-sm border border-gray-100 shrink-0",children:e.jsx(pe,{className:"w-5 h-5 text-[#B80B3D]"})}),e.jsx("p",{className:"text-[15px] font-bold text-gray-700 leading-snug",children:h?"Loading...":M||"No address found"})]})]})]})})]}),e.jsx(ae,{open:z,onOpenChange:v,children:e.jsxs(se,{className:"sm:max-w-md p-0 overflow-hidden rounded-[2.5rem] w-[92%] border-none shadow-2xl",children:[e.jsxs(re,{className:"p-6 bg-gradient-to-br from-white to-gray-50 border-b border-gray-100",children:[e.jsx(oe,{className:"text-xl font-black text-gray-900 tracking-tight",children:"Rename Outlet"}),e.jsx(ne,{className:"text-xs font-bold text-gray-400 uppercase tracking-widest mt-1",children:"Update official restaurant name"})]}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"relative group",children:[e.jsx(le,{value:N,onChange:a=>V(a.target.value.replace(/[\/-]/g,"")),placeholder:"Ex: RedGo Express",className:"w-full h-14 px-5 rounded-2xl border-2 border-gray-100 focus:border-[#B80B3D] focus:ring-0 transition-all font-bold text-lg bg-gray-50 group-hover:bg-white"}),e.jsx(P,{className:"absolute right-5 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-300 group-hover:text-[#B80B3D] transition-colors"})]}),e.jsx("p",{className:"text-[10px] font-bold text-gray-400 px-1 italic",children:"* This will be visible to all customers on the app."})]}),e.jsxs(ie,{className:"p-6 bg-gray-50/50 flex flex-row gap-3",children:[e.jsx(C,{variant:"ghost",onClick:()=>v(!1),className:"flex-1 h-12 rounded-2xl font-bold text-gray-500",children:"Discard"}),e.jsx(C,{onClick:Q,disabled:!N.trim(),className:"flex-[2] h-12 bg-gradient-to-br from-[#B80B3D] to-[#66001D] text-white hover:bg-[#6a2f56] rounded-2xl font-bold shadow-lg shadow-[#B80B3D]/20 transition-all active:scale-95 disabled:opacity-50",children:"Save Changes"})]})]})}),e.jsx(ce,{isOpen:!!m,onClose:()=>K(null),onFileSelect:a=>{m?.type==="profile"?J(a):E(a)}
1,title:m?.title,description:`Choose how to upload your ${m?.type} photo`,fileNamePrefix:`outlet-${m?.type}`,galleryInputRef:m?.ref}),e.jsx(de,{activeTabOverride:"explore"})]})}export{rt as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.