PageSourceSearch

https://bankruptcy.manus.space/assets/AdminGooglePlaces-Ci1tAS8O.js

js bankruptcy.manus.space collected 2026-10-03 05:00:48 UTC 11,960 bytes, 1 lines download raw bytes

1import{r as A,j as e}from"./vendor-BMTqjksT.js";import{A as C}from"./AdminLayout-Cd2syILU.js";import{t as i,i as d,a8 as k,B as g,ay as L,C as x,c as G,d as f,v as j,f as p,aZ as E,w as M}from"./index-C0VezhcQ.js";import{S as D}from"./square-X-Re3KTf.js";import{P as I}from"./play-CRe2O03a.js";import{C as R}from"./chart-no-axes-column-D7MgvIiw.js";import"./sparkles-D2L2V_UA.js";import"./trpc-c2OaEmLI.js";import"./d3-ngNJxV2x.js";function y(t){switch(t){case"running":return"bg-blue-100 text-blue-800";case"completed":return"bg-green-100 text-green-800";case"failed":return"bg-red-100 text-red-800";case"cancelled":return"bg-gray-100 text-gray-700";default:return"bg-gray-100 text-gray-700"}}function h(t){return t?new Date(t).toLocaleString():"—"}function N(t,l){if(!t)return"—";const o=new Date(t).getTime(),c=l?new Date(l).getTime():Date.now(),s=Math.floor((c-o)/1e3);return s<60?`${s}s`:`${Math.floor(s/60)}m ${s%60}s`}function Z(){const[t,l]=A.useState(!1),[o,c]=A.useState(!1),{data:s,refetch:n}=i.googlePlaces.adminGetGooglePlacesSyncStatus.useQuery(void 0,{refetchInterval:a=>a.state.data?.status==="running"?5e3:!1}),{data:r,refetch:m}=i.googlePlaces.adminGetGooglePlacesSyncHistory.useQuery(),b=i.googlePlaces.adminStartGooglePlacesSync.useMutation({onSuccess:()=>{d.success("Google Places sync started"),n(),m()},onError:a=>d.error(a.message)}),v=i.googlePlaces.adminCancelGooglePlacesSync.useMutation({onSuccess:()=>{d.success("Sync cancelled"),n(),m()},onError:a=>d.error(a.message)}),S=async()=>{l(!0);try{await b.mutateAsync()}finally{l(!1)}},w=async()=>{if(s?.id){c(!0);try{await v.mutateAsync({jobId:s.id})}finally{c(!1)}}},u=s?.status==="running",P=s&&s.totalAttorneys>0?Math.round(s.processed/s.totalAttorneys*100):0;return e.jsx(C,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:81",title:"Google Places Enrichment",breadcrumb:"Admin",children:e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:82",className:"max-w-5xl mx-auto space-y-6",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:83",className:"flex items-center justify-between",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:84",className:"flex items-center gap-3",children:[e.jsx(k,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:85",className:"h-7 w-7 text-green-600"}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:86",children:[e.jsx("h1",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:87",className:"text-2xl font-bold",children:"Google Places Enrichment"}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:88",className:"text-sm text-muted-foreground",children:"Enrich attorney profiles with phone, address, website, rating, and review count from Google Places."})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:91",className:"flex gap-2",children:[e.jsxs(g,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:92",variant:"outline",size:"sm",onClick:()=>{n(),m()},children:[e.jsx(L,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:93",className:"h-4 w-4 mr-1"})," Refresh"]}),u?e.jsxs(g,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:96",variant:"destructive",size:"sm",onClick:w,disabled:o,children:[e.jsx(D,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:97",className:"h-4 w-4 mr-1"})," Cancel Sync"]}):e.jsxs(g,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:100",size:"sm",onClick:S,disabled:t,className:"bg-green-600 hover:bg-green-700",children:[e.jsx(I,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:101",className:"h-4 w-4 mr-1"})," ",t?"Starting…":"Start Enrichment"]})]})]}),s&&e.jsxs(x,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:109",children:[e.jsx(G,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:110",className:"pb-2",children:e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:111",className:"flex items-center justify-between",children:[e.jsx(f,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:112",className:"text-base",children:"Current Job"}),e.jsx(j,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:113",className:y(s.status),children:s.status})]})}),e.jsxs(p,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:116",className:"space-y-4",children:[u&&e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:118",className:"space-y-1",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:119",className:"flex justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:120",children:[s.processed.toLocaleStr
1ing()," / ",s.totalAttorneys.toLocaleString()," attorneys processed"]}),e.jsxs("span",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:121",children:[P,"%"]})]}),e.jsx(E,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:123",value:P,className:"h-2"})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:126",className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:127",className:"text-center p-3 bg-muted/30 rounded-lg",children:[e.jsx("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:128",className:"text-2xl font-bold text-blue-600",children:s.processed.toLocaleString()}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:129",className:"text-xs text-muted-foreground",children:"Processed"})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:131",className:"text-center p-3 bg-muted/30 rounded-lg",children:[e.jsx("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:132",className:"text-2xl font-bold text-green-600",children:s.enriched.toLocaleString()}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:133",className:"text-xs text-muted-foreground",children:"Enriched"})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:135",className:"text-center p-3 bg-muted/30 rounded-lg",children:[e.jsx("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:136",className:"text-2xl font-bold text-yellow-600",children:s.skipped.toLocaleString()}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:137",className:"text-xs text-muted-foreground",children:"Skipped"})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:139",className:"text-center p-3 bg-muted/30 rounded-lg",children:[e.jsx("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:140",className:"text-2xl font-bold text-red-600",children:s.failed.toLocaleString()}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:141",className:"text-xs text-muted-foreground",children:"Failed"})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:144",className:"flex gap-6 text-sm text-muted-foreground",children:[e.jsxs("span",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:145",children:[e.jsx(M,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:145",className:"inline h-3 w-3 mr-1"}),"Started: ",h(s.startedAt)]}),s.completedAt&&e.jsxs("span",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:146",children:["Completed: ",h(s.completedAt)]}),e.jsxs("span",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:147",children:["Duration: ",N(s.startedAt,s.completedAt)]})]}),s.errorMessage&&e.jsx("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:150",className:"text-sm text-red-600 bg-red-50 p-2 rounded",children:s.errorMessage})]})]}),e.jsx(x,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:157",className:"border-green-200 bg-green-50/30",children:e.jsx(p,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:158",className:"pt-4",children:e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:159",className:"flex gap-3",children:[e.jsx(R,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:160",className:"h-5 w-5 text-green-600 mt-0.5 shrink-0"}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:161",className:"text-sm text-green-800 space-y-1",children:[e.jsx("p",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:162",className:"font-medium",children:"How enrichment works"}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:163",children:"For each attorney without Google Places data, the sync searches Google Places by firm name + city, fetches place details (phone, address, website, rating, review count), and updates the profile. Missing contact fields are auto-filled from Google data. Rate: ~5 requests/second."}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:164",className:"text-xs text-green-700",children:"Note: Attorneys already enriched (with a Google Places ID) are skipped. Re-enrichment can be triggered by clearing the googlePlacesId field."})]})]})})}),r&&r.length>0&&e.jsxs(x,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:172",children:[e.jsx(G,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:173",className:"pb-2",children:e.jsx(f,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:174",className:"text-base",children:"Sync History"})}),e.jsx(p,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:176",children:e.jsx("div",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:177",className:"overflow-x-auto",children:e.jsxs("table",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:178",className:"w-full text-sm",children:[e.jsx("thead",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:179",children:e.jsxs("tr",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:180",className:"border-b text-muted-foreground",children:[e.jsx("th",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:181",className:"text-left py-2 pr-4",children:"Started"}),e.jsx("th",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:182",className:"text-left py-2 pr-4",children:"Status"}),e.jsx("th",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:183",className:"text-right py-2 pr-4",children:"Processed"}),e.jsx("th",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:184",className:"text-right py-2 pr-4",children:"Enriched"}),e.jsx("th",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:185",className:"text-right py-2 pr-4",children:"Skipped"}),e.jsx("th",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:186",className:"text-right py-2",children:"Duration"})]})}),e.jsx("tbody",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:189",children:r.map(a=>e.jsxs("tr",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:191",className:"border-b last:border-0 hover:bg-muted/20",children:[e.jsx("td",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:192",className:"py-2 pr-4",children:h(a.startedAt)}),e.jsx("td",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:193",className:"py-2 pr-4",children:e.jsx(j,{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:194",className:`text-xs ${y(a.status)}`,children:a.status})}),e.jsx("td",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:196",className:"py-2 pr-4 text-right",children:a.processed.toLocaleStr
1ing()}),e.jsx("td",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:197",className:"py-2 pr-4 text-right text-green-600 font-medium",children:a.enriched.toLocaleString()}),e.jsx("td",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:198",className:"py-2 pr-4 text-right text-yellow-600",children:a.skipped.toLocaleString()}),e.jsx("td",{"data-loc":"client/src/pages/admin/AdminGooglePlaces.tsx:199",className:"py-2 text-right text-muted-foreground",children:N(a.startedAt,a.completedAt)})]},a.id))})]})})})]})]})})}export{Z 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.