PageSourceSearch

https://mediumspringgreen-oyster-710225.hostingersite.com/build/assets/Index-Cf1RVgZH.js

js mediumspringgreen-oyster-710225.hostingersite.com collected 2026-10-03 04:41:39 UTC 6,925 bytes, 1 lines download raw bytes

1import{a as i,j as e,H as N,L as n,r as c}from"./app-BaCFBhvp.js";import{A as w}from"./AuthenticatedLayout-B0R_nv0X.js";import"./transition-D682H2UK.js";function k({location:r,reviews:d,minRating:h}){const[u,g]=i.useState(h||""),[p,a]=i.useState(!1),[m,o]=i.useState(""),x=i.useRef(null),v=s=>{confirm("¿Estás seguro de eliminar esta reseña?")&&c.delete(route("locations.reviews.destroy",[r.id,s]))},j=s=>{g(s),c.get(route("locations.reviews.index",r.id),s?{min_rating:s}:{},{preserveState:!0,replace:!0})},f=()=>{try{const s=JSON.parse(m),l=Array.isArray(s)?s:s.reviews||[];c.post(route("locations.reviews.import",r.id),{reviews:l.map(t=>({reviewer_display_name:t.reviewer_display_name||t.reviewerDisplayName||t.author||"Anónimo",reviewer_profile_photo_url:t.reviewer_profile_photo_url||t.reviewerProfilePhotoUrl||t.profilePhotoUrl||null,rating:parseFloat(t.rating)||5,comment:t.comment||t.text||t.content||null,review_create_time:t.review_create_time||t.createTime||t.publishTime||null,review_update_time:t.review_update_time||t.updateTime||null}))},{onSuccess:()=>{a(!1),o("")}})}catch(s){alert("Error al parsear JSON: "+s.message)}},b=s=>{const l=s.target.files[0];if(l){const t=new FileReader;t.onload=y=>{o(y.target.result)},t.readAsText(l)}};return e.jsxs(w,{header:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx(n,{href:route("locations.index"),className:"text-gray-500 hover:text-gray-700 mr-2",children:"← Volver"}),e.jsxs("h2",{className:"text-xl font-semibold leading-tight text-gray-800",children:["Reviews: ",r.title]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>a(!0),className:"px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition",children:"Importar JSON"}),e.jsx(n,{href:route("locations.reviews.create",r.id),className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition",children:"+ Nueva Reseña"})]})]}),children:[e.jsx(N,{title:`Reviews: ${r.title}`}),e.jsx("div",{className:"py-12",children:e.jsxs("div",{className:"mx-auto max-w-7xl sm:px-6 lg:px-8",children:[e.jsx("div",{className:"bg-white overflow-hidden shadow-sm sm:rounded-lg p-4 mb-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium text-gray-900",children:r.title}),r.address&&e.jsx("p",{className:"text-sm text-gray-500",children:r.address})]}),e.jsxs("div",{className:"text-right",children:[r.rating&&e.jsxs("div",{className:"text-yellow-500 text-lg",children:["⭐ ",parseFloat(r.rating).toFixed(1)]}),e.jsxs("div",{className:"text-sm text-gray-500",children:[d.length," reviews"]})]})]})}),e.jsx("div",{className:"bg-white overflow-hidden shadow-sm sm:rounded-lg p-4 mb-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-sm text-gray-600",children:"Filtrar por rating mínimo:"}),e.jsxs("select",{value:u,onChange:s=>j(s.target.value),className:"border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring-blue-500",children:[e.jsx("option",{value:"",children:"Todas"}),e.jsx("option",{value:"5",children:"⭐⭐⭐⭐⭐ (5)"}),e.jsx("option",{value:"4",children:"⭐⭐⭐⭐ (4+)"}),e.jsx("option",{value:"3",children:"⭐⭐⭐ (3+)"})]})]})}),d.length===0?e.jsxs("div",{className:"bg-white overflow-hidden shadow-sm sm:rounded-lg p-12 text-center",children:[e.jsx("div",{className:"text-6xl mb-4",children:"⭐"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No hay reviews"}),e.jsx("p",{className:"text-gray-500 mb-4",children:"Crea o importa tu primera reseña"}),e.jsxs("div",{className:"flex justify-center gap-4",children:[e.jsx("button",{onClick:()=>a(!0),className:"px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition",children:"Importar JSON"}),e.jsx(n,{href:route("locations.reviews.create",r.id),className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition",children:"Crear manualmente"})]})]}):e.jsx("div",{className:"space-y-4",children:d.map(s=>e.jsx("div",{className:"bg-white overflow-hidden shadow-sm sm:rounded-lg p-6",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0 mr-4",children:s.reviewer_profile_photo_url?e.jsx("img",{src:s.reviewer_profile_photo_url,alt:s.reviewer_display_name,className:"w-12 h-12 rounded-full object-cover"}):e.jsx("div",{className:"w-12 h-12 rounded-full bg-gray-200 flex items-center justify-center text-gray-500 text-lg",children:s.reviewer_display_name.charAt(0)})}),e.jsxs("div",{className:"flex-grow",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900",children:s.reviewer_display_name}),e.jsxs("span",{className:"ml-2 text-yellow-500",children:["★".repeat(Math.round(s.rating)),"☆".repeat(5-Math.round(s.rating))]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(n,{href:route("locations.reviews.edit",[r.id,s.id]),className:"px-3 py-1 bg-blue-100 text-blue-700 rounded hover:bg-blue-200 transition text-sm",children:"Editar"}),e.jsx("button",{onClick:()=>v(s.id),className:"px-3 py-1 bg-red-100 text-red-700 rounded hover:bg-red-200 transition text-sm",children:"Eliminar"})]})]}),e.jsx("p",{className:"text-gray-600 mb-2",children:s.comment||e.jsx("em",{className:"text-gray-400",children:"Sin comentario"})}),e.jsx("p",{className:"text-xs text-gray-400",children:new Date(s.review_create_time).toLocaleDateString("es-ES",{year:"numeric",month:"long",day:"numeric"})})]})]})},s.id))})]})}),p&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white rounded-lg p-6 w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Importar Reviews desde JSON"}),e.jsxs("div",{className:"mb-4",children:[e.jsx("input",{type:"file",ref:x,onChange:b,accept:".json",className:"hidden"}),e.jsx("button",{onClick:()=>x.current?.click(),className:"px-4 py-2 bg-gray-100 text-gray-700 rounded hover:bg-gray-200 transition",children:"Cargar ar
1chivo JSON"})]}),e.jsx("textarea",{value:m,onChange:s=>o(s.target.value),className:"w-full h-64 border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring-blue-500 font-mono text-sm",placeholder:'[{"reviewer_display_name": "Juan", "rating": 5, "comment": "Excelente!"}]'}),e.jsxs("div",{className:"flex justify-end gap-4 mt-4",children:[e.jsx("button",{onClick:()=>a(!1),className:"px-4 py-2 text-gray-600 hover:text-gray-800",children:"Cancelar"}),e.jsx("button",{onClick:f,className:"px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition",children:"Importar"})]})]})})]})}export{k 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.