PageSourceSearch

https://bafreinmobiliaria.es/assets/admin.incidencias._id-BJgKnE4N.js

js bafreinmobiliaria.es collected 2026-10-04 17:52:29 UTC 7,035 bytes, 1 lines download raw bytes

1import{ah as $,r,u as B,a as M,j as e,L as K,B as T,aj as P,J as l,ae as J}from"./index-DFhUiiAX.js";import{i as V,a as g}from"./incidentsService-BfBFUxrj.js";import{f as b}from"./format-CsqaNbnV.js";import{S as W,P as _}from"./pills-Ck1QeFlb.js";import{u as G,a as f,c as H}from"./useWebAdminPermissions-BoShnI_b.js";import{A as O}from"./attachments-picker-Dzu9ajmY.js";import{c as Q,A as z}from"./closure-C_hQaeMu.js";import{A as U}from"./arrow-left-DPk5D9KF.js";import{C as X}from"./circle-check-Snc1Fnbz.js";import"./hoursBankAdapter-BmeMS6Ex.js";function oe(){const{id:h}=$({from:"/admin/incidencias/$id"}),[n,m]=r.useState(null),[c,j]=r.useState(!0),[p,y]=r.useState(""),[u,N]=r.useState([]),[i,k]=r.useState(!1),[o,v]=r.useState(""),[w,A]=r.useState(!1),[E,x]=r.useState(!1),[d,S]=r.useState(null),{t}=B(),q=G(),F=Q(n),{user:D}=M(),R=D?.role==="admin",I=()=>(j(!0),g.get(h).then(s=>{S(null),s?(x(!1),m(s)):x(!0)}).catch(s=>{if(H(s)==="not_found"){x(!0);return}S(f(s,"No se ha podido cargar la incidencia."))}).finally(()=>j(!1)));r.useEffect(()=>{I()},[h]);const C=n?.status==="closed",L=q.allow("web.incidents.reply",n?.capabilities.canReply??null);return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs(K,{to:"/admin/incidencias",search:{status:"",priority:"",category:"",q:"",page:1},className:"inline-flex items-center gap-2 text-xs uppercase tracking-widest text-muted-foreground hover:text-foreground",children:[e.jsx(U,{size:14})," Volver al listado"]}),c&&e.jsx("div",{className:"border border-border bg-background p-10 text-center text-sm text-muted-foreground",children:e.jsx(T,{size:"md",showLabel:!0,label:"Cargando…"})}),!c&&d&&e.jsx("div",{className:"border border-bafre-red/40 bg-bafre-red/5 p-6 text-sm text-bafre-red",children:d}),!c&&!d&&E&&e.jsx("div",{className:"border border-border bg-background p-12 text-center",children:e.jsx("div",{className:"font-display text-lg",children:"Incidencia no encontrada"})}),!c&&!d&&n&&e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"border border-border bg-background p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:n.code}),e.jsx(W,{status:n.status}),e.jsx(_,{priority:n.priority}),e.jsxs("span",{className:"ml-auto text-xs text-muted-foreground",children:["Actualizada ",b(n.updatedAt)]})]}),e.jsx("h1",{className:"mt-3 font-display text-3xl",children:n.subject}),e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[t(V(n.category))," · Abierta el"," ",b(n.createdAt)]}),e.jsx(z,{attachments:n.attachments,compact:!0})]}),e.jsx("section",{className:"flex flex-col gap-3",children:n.messages.map(s=>{const a=s.id===F;return e.jsxs("article",{className:`border p-5 ${a?"border-success/50 bg-success/5":`border-border ${s.author.role==="customer"?"bg-background":"bg-secondary/40"}`}`,children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold",children:s.author.name||t("content.admin.incidencias.author.unknown")}),e.jsx("span",{className:"border border-border px-1.5 py-0.5 text-[9px] uppercase tracking-widest text-muted-foreground",children:t(`content.admin.incidencias.author.${s.author.role}`)}),a&&e.jsxs("span",{className:"inline-flex items-center gap-1 border border-success/50 bg-success/10 px-2 py-0.5 text-[9px] uppercase tracking-widest text-success",children:[e.jsx(X,{size:10})," ",t("content.admin.incidencias.close.badge")]})]}),e.jsx("span",{className:"text-muted-foreground",children:b(s.createdAt)})]}),e.jsx("p",{className:"mt-2 whitespace-pre-line text-sm",children:s.message}),e.jsx(z,{attachments:s.attachments,compact:!0})]},s.id)})}),n.capabilities.canReopen&&e.jsxs("section",{className:"flex flex-col gap-3 border border-success/50 bg-success/5 p-5",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-[11px] uppercase tracking-[0.22em] text-success",children:[e.jsx(P,{size:14})," ",t("content.admin.incidencias.reopen.title")]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("content.admin.incidencias.reopen.description")}),e.jsx("textarea",{rows:3,required:!0,maxLength:2e3,value:o,onChange:s=>v(s.target.value),className:"border border-border bg-background p-3 text-sm focus:border-ink focus:outline-none",placeholder:t("content.admin.incidencias.reopen.reasonPlaceholder")}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[o.trim().length===0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:t("content.admin.incidencias.reopen.reasonRequired")}),e.jsxs("button",{type:"button",disabled:w||o.trim().length===0,onClick:async()=>{const s=o.trim();if(!s){l.error(t("content.admin.incidencias.reopen.reasonRequired"));return}A(!0);try{const{incident:a}=await g.reopen(n.id,{comment:s});m(a),v(""),l.success(t("content.admin.incidencias.reopen.success"))}catch(a){l.error(f(a,t("content.admin.incidencias.reopen.error")))}finally{A(!1)}},className:"inline-flex items-center gap-2 border border-success bg-success/10 px-5 py-2.5 text-[11px] font-semibold uppercase tracking-[0.22em] text-success hover:bg-success/20 disabled:opacity-50",children:[e.jsx(P,{size:14})," ",t(w?"content.admin.incidencias.reopen.sending":"content.admin.incidencias.reopen.action")]})]})]}),!C&&L?e.jsxs("form",{className:"flex flex-col gap-3 border border-border bg-background p-5",onSubmit:async s=>{if(s.preventDefault(),!(p.trim().length<2||i)){k(!0);try{const{incident:a}=await g.addMessage(n.id,{message:p.trim(),attachments:u});m(a),y(""),N([])}
1catch(a){l.error(f(a,"No se ha podido enviar la respuesta."))}finally{k(!1)}}},children:[e.jsxs("label",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] uppercase tracking-[0.22em] text-muted-foreground",children:t("content.admin.incidencias.reply.label")}),e.jsx("textarea",{required:!0,minLength:2,maxLength:4e3,rows:5,value:p,onChange:s=>y(s.target.value),className:"border border-border bg-background p-3 text-sm focus:border-ink focus:outline-none",placeholder:t(R?"content.admin.incidencias.reply.placeholderAdmin":"content.admin.incidencias.reply.placeholder")})]}),e.jsx(O,{id:"incident-user-reply-attachments",files:u,onChange:N,disabled:i,uploading:i&&u.length>0}),e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{type:"submit",disabled:i,className:"inline-flex items-center gap-2 bg-ink px-5 py-2.5 text-[11px] font-semibold uppercase tracking-[0.22em] text-bone hover:bg-ink/85 disabled:opacity-50",children:[e.jsx(J,{size:14})," ",t(i?"content.admin.incidencias.reply.sending":R?"content.admin.incidencias.reply.sendComment":"content.admin.incidencias.reply.sendReply")]})})]}):null,!C&&!L&&e.jsx("div",{className:"border border-border bg-secondary/40 p-5 text-sm text-muted-foreground",children:"No tienes permisos para responder a esta incidencia."})]})]})}export{oe as component};

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.