PageSourceSearch

https://logivo.ai/build/assets/Index-CgtoR0tJ.js

js logivo.ai collected 2026-10-05 12:14:28 UTC 41,622 bytes, 2 lines download raw bytes

vendor: 4,372 bytes, line 1
1import{q as I,p as ht,u as U,c as a,a as kt,b as d,h as ae,w as Dt,d as s,t as l,n as L,o as r,F as _,r as v,i,e as C,f as m,g as p,j as R,v as k,A as wt,k as St,l as re,m as P,x as ie,s as Lt}from"./app-CwJyEnkI.js";import{A as ce}from"./AppLayout-D9Iyjoll.js";/* empty css            */import"./FeedbackIdeaWidget-CGfZ10N4.js";const de={class:"border-b border-slate-200 pb-6"},ue={class:"text-sm font-bold uppercase text-ocean"},pe={class:"mt-2 text-3xl font-black text-ink"},be={class:"mt-2 text-sm text-slate-600"},me={class:"mt-7 grid gap-4 md:grid-cols-3 lg:grid-cols-6"},xe={class:"panel p-5"},_e={class:"mt-2 text-3xl font-black text-ink"},fe={class:"panel p-5"},ye={class:"mt-2 text-3xl font-black text-ink"},ve={class:"mt-1 text-xs text-slate-500"},ge={class:"panel p-5"},he={class:"mt-2 text-3xl font-black text-ink"},ke={class:"mt-1 text-xs text-slate-500"},we={class:"panel p-5"},Se={class:"mt-2 text-3xl font-black text-ink"},Ce={class:"panel p-5"},Oe={class:"mt-2 text-3xl font-black text-ink"},je={class:"panel p-5"},Ve={class:"mt-2 text-3xl font-black text-ink"},$e={class:"panel mt-5 p-4"},Ue={class:"flex flex-wrap items-center gap-3"},Pe=["onClick"],Me={class:"flex flex-wrap items-center gap-3"},Ae=["onClick"],Ie={key:0,class:"mt-3 text-xs text-slate-500"},Re={class:"mt-4 flex flex-wrap items-center gap-3 border-t border-slate-100 pt-4"},qe=["onClick"],Ee={key:1,class:"mt-3 text-xs text-slate-500"},Ne={class:"mt-4 flex flex-wrap items-center gap-3 border-t border-slate-100 pt-4"},De=["onClick"],Le={key:2,class:"mt-3 text-xs text-slate-500"},Te={class:"text-sm font-semibold text-slate-700"},Fe={class:"text-sm font-semibold text-slate-700"},Be={class:"text-xs text-rose-600"},ze={key:0,class:"text-sm font-semibold text-slate-700"},We=["value"],Je={class:"text-xs text-rose-600"},Xe={class:"text-sm font-semibold text-slate-700"},Qe=["disabled"],Ge={key:1,class:"mt-5 rounded-md border border-amber-200 bg-amber-50 p-4 text-sm text-amber-900"},Ke={class:"mt-2 break-all"},Ye={class:"flex flex-wrap items-center gap-2 border-b border-slate-200 bg-slate-50 p-3"},He={class:"flex min-w-64 flex-1 items-center gap-2 text-xs font-black uppercase text-slate-500"},Ze={class:"text-xs font-bold uppercase text-slate-500"},ts=["value"],es=["value"],ss={key:1,class:"w-full rounded border border-slate-200 bg-slate-50 p-3 text-xs"},os={class:"mb-2 flex flex-wrap items-center justify-between gap-2"},ns={class:"font-bold uppercase text-slate-500"},ls={class:"flex flex-wrap gap-3"},as=["checked","onChange"],rs={key:0,class:"font-semibold text-slate-500"},is={class:"w-max min-w-full table-fixed text-left text-sm"},cs={class:"bg-slate-50 text-xs uppercase text-slate-500"},ds=["onClick"],us={class:"truncate"},ps=["onMousedown"],bs={class:"divide-y divide-slate-100"},ms=["onContextmenu"],xs=["onClick"],_s={key:1},fs={class:"px-4 py-3"},ys={class:"flex flex-wrap gap-2"},vs=["onClick"],gs=["onClick"],hs={key:0},ks=["colspan"],ws={class:"flex flex-wrap items-center justify-between gap-3 border-t border-slate-200 bg-slate-50 px-3 py-2 text-xs text-slate-600"},Ss={class:"flex items-center gap-2"},Cs=["disabled"],Os={class:"font-bold"},js=["disabled"],Vs={key:2,class:"fixed inset-0 z-[80] flex items-center justify-center bg-slate-950/50 p-4"},$s={class:"w-full max-w-lg overflow-hidden rounded-xl bg-white shadow-xl"},Us={class:"flex items-start justify-between bg-slate-900 px-5 py-4 text-white"},Ps={class:"mt-1 text-xl font-black"},Ms={class:"mt-1 text-sm text-slate-300"},As={class:"text-sm font-semibold text-slate-700"},Is={key:0,class:"text-xs text-rose-600"},Rs={class:"text-sm font-semibold text-slate-700"},qs={key:0,class:"text-xs text-rose-600"},Es={class:"text-sm font-semibold text-slate-700"},Ns={key:0,class:"text-xs text-rose-600"},Ds={class:"flex flex-wrap justify-end gap-3 border-t border-slate-100 pt-4"},Ls=["disabled"],Ts={key:3,class:"fixed inset-0 z-[80] flex items-start justify-center overflow-y-auto bg-slate-950/50 p-4"},Fs=["id"],Bs={class:"flex flex-wrap items-start justify-between gap-3 border-b border-slate-200 pb-4"},zs={class:"text-xs font-black uppercase text-ocean"},Ws={class:"mt-1 text-xl font-black text-ink"},Js=["onSubmit"],Xs={class:"text-sm font-semibold text-slate-700"},Qs=["onUpdate:modelValue","placeholder"],Gs={key:0,class:"text-xs text-rose-600"},Ks={class:"text-sm font-semibold text-slate-700"}
1,Ys=["onUpdate:modelValue"],Hs={key:0,class:"text-xs text-rose-600"},Zs={class:"text-sm font-semibold text-slate-700"},to=["onUpdate:modelValue"],eo={key:0,class:"text-xs text-rose-600"},so=["disabled"],oo=["onSubmit"],no={class:"flex gap-3 text-sm font-semibold text-slate-700"},lo=["onUpdate:modelValue"],ao={class:"flex gap-3 text-sm font-semibold text-slate-700"},ro=["onUpdate:modelValue"],io={key:0,class:"text-xs text-rose-600 md:col-span-2"},co=["disabled"],uo=["onSubmit"],po={class:"flex flex-wrap items-start justify-between gap-3"},bo={class:"mt-1 text-xs text-slate-500"},mo=["disabled"],xo={class:"mt-4 grid gap-3 md:grid-cols-2 xl:grid-cols-3"},_o=["onUpdate:modelValue"],fo={key:0,class:"mt-2 text-xs text-rose-600"},yo={class:"mt-4 grid gap-5 lg:grid-cols-2"},vo=["onSubmit"],go=["onUpdate:modelValue"],ho=["onUpdate:modelValue"],ko=["onUpdate:modelValue"],wo=["disabled"],So={class:"font-semibold text-ink"},Co={key:0,class:"ml-2 rounded bg-amber-100 px-2 py-1 text-[10px] font-bold uppercase text-amber-800"},Oo={class:"mt-1"},jo={key:0,class:"mt-1 text-amber-700"},Vo=["onClick"],$o=["onSubmit"],Uo=["onUpdate:modelValue"],Po=["value"],Mo=["disabled"],Ao={key:2,class:"space-y-3"},Io={class:"font-bold text-ink"},Ro={key:0,class:"ml-2 rounded bg-amber-50 px-2 py-1 text-[10px] font-bold uppercase text-amber-800"},qo={class:"mt-1"},Eo={class:"mt-1"},No={key:0,class:"mt-1 whitespace-pre-line"},Do={key:1,class:"mt-1"},Lo={key:2,class:"mt-2"},To=["onSubmit"],Fo=["onUpdate:modelValue"],Bo=["onUpdate:modelValue"],zo={key:0,class:"text-xs text-rose-600"},Wo=["disabled"],Jo={key:4,class:"mt-2"},Xo={key:0,class:"text-xs text-slate-500"},Qo=["onSubmit"],Go=["onUpdate:modelValue"],Ko=["value"],Yo={class:"grid gap-3 sm:grid-cols-2"},Ho=["onUpdate:modelValue"],Zo=["onUpdate:modelValue"],tn=["onUpdate:modelValue"],en={class:"block text-sm font-semibold text-slate-700"},sn=["onUpdate:modelValue"],on={key:0,class:"text-xs text-rose-600"},nn={key:1,class:"text-xs text-rose-600"},ln=["disabled"],an={key:2,class:"grid gap-3"},rn={class:"font-bold text-ink"},cn={key:0,class:"ml-2 rounded bg-amber-50 px-2 py-1 text-[10px] font-bold uppercase text-amber-800"},dn={class:"mt-1"},un={key:0,class:"mt-1 text-amber-700"},pn={key:1,class:"mt-1"},bn={key:0},mn={key:2,class:"mt-3 grid gap-2"},xn={class:"font-bold uppercase text-slate-700"},_n={class:"mt-1"},fn={key:0,class:"mt-1 whitespace-pre-line"},yn={key:1,class:"mt-1"},vn=["onSubmit"],gn=["onUpdate:modelValue"],hn=["onUpdate:modelValue"],kn={key:0,class:"text-xs text-rose-600"},wn=["disabled"],Vn={__name:"Index",props:{organisations:Array,customers:Array,jobs:Array,bookingRequestMetrics:Object,bookingRequestStatusCounts:Object,bookingRequestStatuses:Array,filters:Object,invitationStateCounts:Object,invitationStates:Array,portalInvitationMetrics:Object,subcontractorOfferMetrics:Object,subcontractorOfferStatusCounts:Object,subcontractorOfferStatuses:Array},setup(f){const Y=f,O=ie(),T=I({visible:!1,x:0,y:0,organisation:null}),st=I(!1),ot=I(""),J=I(""),q=ht({key:"name",direction:"asc",columns:[{key:"name",direction:"asc"}]}),nt=I(!1),B=I(null),lt=I(!1),at=I(""),V=ht({page:1,perPage:20}),Tt=[10,20,50,100],z=[{key:"name",label:"Organisation",width:260},{key:"type",label:"Type",width:130},{key:"customer",label:"Customer",width:240},{key:"members_count",label:"Members",width:110},{key:"status",label:"Status",width:130},{key:"brand",label:"Portal brand",width:240}],j=I(z.map(n=>n.key)),rt=P(()=>{const n=ot.value.trim().toLowerCase();return n?z.filter(t=>`${t.label||""} ${t.key||""}`.toLowerCase().includes(n)):z}),Ft=(()=>{try{return JSON.parse(localStorage.getItem("logivo.portalOrganisations.columnWidths")||"{}")}catch{return{}}})(),H=ht(Object.fromEntries(z.map(n=>[n.key,Number(Ft[n.key]||n.width)]))),w=U({type:"customer",name:"",customer_public_id:"",status:"active"}),y=U({name:"",email:"",role:"member"}),it={},ct={},dt={},ut={},pt={},bt={},mt={},xt={},Bt=[["job_list","Job list"],["job_detail","Job detail"],["collection_delivery_info","Collection/delivery info"],["tracking_status","Tracking/status"],["documents","Documents"],["pods","PODs"],["
1invoices","Invoices"],["destin8_status","Destin8 container status"],["finance_balance_info","Finance/balance info"],["notes","Notes"],["references","References"],["contact_details","Contact details"],["booking_requests","Booking requests"],["document_uploads","Document uploads"],["comments_messages","Comments/messages"],["callovers","Daily callovers"]],zt=[["assigned_jobs","Assigned jobs"],["job_detail","Job detail"],["collection_delivery_info","Collection/delivery info"],["customer_details","Customer details"],["rate_payment_info","Rate/payment info"],["documents","Documents"],["pod_upload","POD upload"],["status_update","Status updates"],["notes","Notes"],["contact_details","Contact details"],["invoice_payment_status","Invoice/payment status"]],M=n=>{var t;return it[t=n.public_id]||(it[t]=U({name:"",email:"",role:"member"}))},Wt=(n,t)=>{Lt.post(`/app/portal-organisations/${n.public_id}/invitations/${t.public_id}/resend`,{},{preserveScroll:!0})},X=n=>{var t;return ct[t=n.public_id]||(ct[t]=U({job_public_id:""}))},h=n=>{var t;return dt[t=n.public_id]||(dt[t]=U({job_public_id:"",rate_amount:"",rate_currency:"GBP",instructions:"",expires_at:""}))},A=n=>{var t;return ut[t=n.public_id]||(ut[t]=U({decision:"accepted",decision_note:""}))},$=n=>{var t;return pt[t=n.public_id]||(pt[t]=U({status:"accepted",decision_note:""}))},S=n=>{var t,c,u,e;return bt[e=n.public_id]||(bt[e]=U({display_name:((t=n.branding)==null?void 0:t.display_name)||"",accent_color:((c=n.branding)==null?void 0:c.accent_color)||"#0b7285",support_email:((u=n.branding)==null?void 0:u.support_email)||""}))},E=n=>{var t,c,u;return mt[u=n.public_id]||(mt[u]=U({subcontractor_offer_notifications_enabled:((t=n.notification_preferences)==null?void 0:t.subcontractor_offer_notifications_enabled)??!0,subcontractor_update_notifications_enabled:((c=n.notification_preferences)==null?void 0:c.subcontractor_update_notifications_enabled)??!0}))},Jt=n=>n.type==="subcontractor"?zt:Bt,W=n=>{var t;return xt[t=n.public_id]||(xt[t]=U({visibility_settings:{...n.visibility_settings||{}}}))};function Ct(n){return n?new Date(n).toLocaleString():"-"}const N=n=>n?n.replaceAll("_"," "):"-",g=n=>{var t;return((t=Y.filters)==null?void 0:t[n])||""},Z=n=>{const t={...Y.filters||{},...n};Object.keys(t).forEach(c=>{t[c]||delete t[c]}),Lt.get("/app/portal-organisations",t,{preserveScroll:!0})},Ot=n=>Z({booking_status:n}),jt=n=>Z({invitation_state:n}),Vt=n=>Z({subcontractor_offer_status:n}),$t=n=>Z({type:n}),tt=n=>z.find(t=>t.key===n),Xt=n=>{j.value=j.value.includes(n)?j.value.filter(t=>t!==n):[...j.value,n]},Q=(n,t)=>{var c,u;return{name:n.name,type:N(n.type),customer:((c=n.customer)==null?void 0:c.name)||"-",members_count:n.members_count,status:n.status,brand:((u=n.branding)==null?void 0:u.display_name)||"-"}[t]??"-"},Qt=P(()=>g("type")==="subcontractor"?"Subcontractor organisations":g("type")==="customer"?"Customer organisations":"Portal organisations"),Gt=P(()=>g("type")==="subcontractor"?"Manage subcontractor portal access, offers, POD permissions, and visibility from one clean list.":"Define customer and subcontractor boundaries before inviting portal users or sharing operational records."),Ut=P(()=>(Y.organisations||[]).find(n=>n.public_id===at.value)||null),et=()=>{V.page=1},_t=n=>n==null?"":Array.isArray(n)?n.map(_t).join(" "):typeof n=="object"?Object.values(n).map(_t).join(" "):String(n).toLowerCase(),Kt=n=>_t([z.map(t=>Q(n,t.key)),n.invitations,n.job_grants,n.booking_requests,n.subcontractor_offers,n.visibility_settings]),Pt=n=>{if(n==null||n==="-")return"";if(typeof n=="number")return n;const t=String(n).trim(),c=t.replace(/[?$,]/g,"");return/^-?\d+(\.\d+)?$/.test(c)?Number(c):t.toLowerCase()},D=P(()=>{const n=J.value.trim().toLowerCase();return[...(Y.organisations||[]).filter(c=>!n||n==="*"||Kt(c).includes(n))].sort((c,u)=>{for(const e of ft()){const o=Pt(Q(c,e.key)),x=Pt(Q(u,e.key)),b=e.direction==="asc"?1:-1,K=o===x?0:o>x?b:-b;if(K!==0)return K}return String(c.name||"").localeCompare(String(u.name||""),void 0,{numeric:!0,sensitivity:"base"})})}),G=P(()=>Math.max(1,Math.ceil(D.value.length/V.perPage))),F=P(()=>Math.min(V.page,G.value)),Yt=P(()=>{const t=(Math.min(V.page,G.value)-1)*V.perPage;return D.value.slice(t,t+V.perPage)}),Mt=P(()=>D.value.length===0?0:(F.value-1)*V.perPage+1),At=P(()=>Math.min(D.value.length,F.value*V.perPage)),Ht=n=>{V.perPage=Number(n),et()},It=n=>{V.page=Math.max(1,Math.min(G.value,n))},ft=()=>{const n=(Array.isArray(q.columns)?q.columns:[]).map(t=>({key:(t==null?void 0:t.key)||q.key,direction:(t==null?void 0:t.direction)==="desc"?"desc":"asc"})).filter(t=>t.key);return n.length?n:[{key:q.key||"name",direction:q.direction==="desc"?"desc":"asc"}]},Zt=n=>{const t=n.length?n:[{key:"name",direction:"asc"}],c=t[0];q.key=c.key,q.direction=c.direction,q.columns=t},te=(n,t=null)=>{const c=ft(),u=c.findIndex(o=>o.key===n);let e;t!=null&&t.shiftKey?(e=[...c],u>=0?e[u]={...e[u],direction:e[u].direction==="asc"?"desc":"asc"}:e.push({key:n,direction:"asc"})):c.length===1&&u===0?e=[{key:n,direction:c[0].direction==="asc"?"desc":"asc"}]:e=[{key:n,direction:"asc"}],Zt(e),et()},ee=n=>{const t=ft(),c=t.findIndex(u=>u.key===n);
1return c<0?"":`${t[c].direction==="asc"?"↑":"↓"}${t.length>1?c+1:""}`},Rt=n=>{var c;const t=H[n]||((c=tt(n))==null?void 0:c.width)||160;return{width:`${t}px`,minWidth:`${t}px`,maxWidth:`${t}px`}},se=(n,t)=>{var x;const c=t.clientX,u=H[n]||((x=tt(n))==null?void 0:x.width)||160,e=b=>{H[n]=Math.max(90,Math.min(520,u+b.clientX-c))},o=()=>{localStorage.setItem("logivo.portalOrganisations.columnWidths",JSON.stringify(H)),window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",o)};window.addEventListener("mousemove",e),window.addEventListener("mouseup",o)},qt=()=>{const n=[j.value.map(u=>{var e;return((e=tt(u))==null?void 0:e.label)||u}),...D.value.map(u=>j.value.map(e=>Q(u,e)))].map(u=>u.map(e=>`"${String(e??"").replaceAll('"','""')}"`).join(",")).join(`
2`),t=new Blob([n],{type:"text/csv;charset=utf-8;"}),c=document.createElement("a");c.href=URL.createObjectURL(t),c.download=`logivo-portal-organisations-${new Date().toISOString().slice(0,10)}.csv`,c.click(),URL.revokeObjectURL(c.href)},oe=(n,t)=>{T.value={visible:!0,x:t.clientX,y:t.clientY,organisation:n}},yt=()=>{T.value.visible=!1},vt=n=>{yt(),at.value=n.public_id,lt.value=!0},ne=()=>{lt.value=!1,at.value=""},Et=n=>{yt(),B.value=n,y.defaults({name:n.name||"",email:"",role:"member"}),y.reset(),y.clearErrors(),nt.value=!0},gt=()=>{nt.value=!1,B.value=null,y.reset(),y.clearErrors()},le=()=>{B.value&&y.post(`/app/portal-organisations/${B.value.public_id}/invitations`,{preserveScroll:!0,onSuccess:gt})};return(n,t)=>(r(),a(_,null,[kt(d(ae),{title:"Portal organisations"}),kt(ce,null,{default:Dt(()=>{var c,u;return[s("section",de,[s("p",ue,l(g("type")==="subcontractor"?"Subcontractors":"Portals"),1),s("h1",pe,l(Qt.value),1),s("p",be,l(Gt.value),1)]),s("section",me,[s("article",xe,[t[22]||(t[22]=s("p",{class:"text-sm font-semibold text-slate-500"},"Requested bookings",-1)),s("p",_e,l(f.bookingRequestMetrics.requested),1),t[23]||(t[23]=s("p",{class:"mt-1 text-xs text-slate-500"},"Customer portal requests awaiting workspace review.",-1))]),s("article",fe,[t[24]||(t[24]=s("p",{class:"text-sm font-semibold text-slate-500"},"Stale booking requests",-1)),s("p",ye,l(f.bookingRequestMetrics.stale_requested),1),s("p",ve,"Awaiting review for "+l(f.bookingRequestMetrics.stale_hours)+"h.",1)]),s("article",ge,[t[25]||(t[25]=s("p",{class:"text-sm font-semibold text-slate-500"},"Pending invites",-1)),s("p",he,l(f.portalInvitationMetrics.pending),1),s("p",ke,"Signed portal activation links expire after "+l(f.portalInvitationMetrics.expiry_days)+" days.",1)]),s("article",we,[t[26]||(t[26]=s("p",{class:"text-sm font-semibold text-slate-500"},"Expired invites",-1)),s("p",Se,l(f.portalInvitationMetrics.stale_pending),1),t[27]||(t[27]=s("p",{class:"mt-1 text-xs text-slate-500"},"Pending portal access links that need reissue or review.",-1))]),s("article",Ce,[t[28]||(t[28]=s("p",{class:"text-sm font-semibold text-slate-500"},"Open offers",-1)),s("p",Oe,l(f.subcontractorOfferMetrics.open),1),t[29]||(t[29]=s("p",{class:"mt-1 text-xs text-slate-500"},"Offered or countered subcontractor work awaiting a decision.",-1))]),s("article",je,[t[30]||(t[30]=s("p",{class:"text-sm font-semibold text-slate-500"},"Expired offers",-1)),s("p",Ve,l(f.subcontractorOfferMetrics.expired_open),1),t[31]||(t[31]=s("p",{class:"mt-1 text-xs text-slate-500"},"Open subcontractor offers past their expiry time.",-1))])]),s("section",$e,[s("div",Ue,[t[32]||(t[32]=s("p",{class:"w-full text-xs font-bold uppercase text-slate-500 sm:w-auto"},"Portal type",-1)),s("button",{class:L(["rounded border px-3 py-2 text-xs font-bold uppercase transition",g("type")?"border-slate-200 bg-white text-slate-600 hover:border-ocean":"border-ocean bg-cyan-50 text-ocean"]),onClick:t[0]||(t[0]=e=>$t(null))}," All ",2),(r(),a(_,null,v(["customer","subcontractor"],e=>s("button",{key:e,class:L(["rounded border px-3 py-2 text-xs font-bold uppercase transition",g("type")===e?"border-ocean bg-cyan-50 text-ocean":"border-slate-200 bg-white text-slate-600 hover:border-ocean"]),onClick:o=>$t(e)},l(N(e)),11,Pe)),64))]),s("div",Me,[t[33]||(t[33]=s("p",{class:"w-full text-xs font-bold uppercase text-slate-500 sm:w-auto"},"Booking request filter",-1)),s("button",{class:L(["rounded border px-3 py-2 text-xs font-bold uppercase transition",g("booking_status")?"border-slate-200 bg-white text-slate-600 hover:border-ocean":"border-ocean bg-cyan-50 text-ocean"]),onClick:t[1]||(t[1]=e=>Ot(null))}," All ",2),(r(!0),a(_,null,v(f.bookingRequestStatuses,e=>(r(),a("button",{key:e,class:L(["rounded border px-3 py-2 text-xs font-bold uppercase transition",g("booking_status")===e?"border-ocean bg-cyan-50 text-ocean":"border-slate-200 bg-white text-slate-600 hover:border-ocean"]),onClick:o=>Ot(e)},l(N(e))+" ("+l(f.bookingRequestStatusCounts[e]||0)+") ",11,Ae))),128))]),g("booking_status")?(r(),a("p",Ie,"Showing "+l(N(g("booking_status")))+" booking requests inside each customer portal. Summary counters above remain tenant-wide.",1)):i("",!0),s("div",Re,[t[34]||(t[34]=s("p",{class:"w-full text-xs font-bold uppercase text-slate-500 sm:w-auto"},"Invitation filter",-1)),s("button",{class:L(["rounded border px-3 py-2 text-xs font-bold uppercase transition",g("invitation_state")?"border-slate-200 bg-white text-slate-600 hover:border-ocean":"border-ocean bg-cyan-50 text-ocean"]),onClick:t[2]||(t[2]=e=>jt(null))}," All ",2),(r(!0),a(_,null,v(f.invitationStates,e=>(r(),a("button",{key:e,class:L(["rounded border px-3 py-2 text-xs font-bold uppercase transition",g("invitation_state")===e?"border-ocean bg-cyan-50 text-ocean":"border-slate-200 bg-white text-slate-600 hover:border-ocean"]),onClick:o=>jt(e)},l(N(e))+" ("+l(f.invitationStateCounts[e]||0)+") ",11,qe))),128))]),g("invitation_state")?(r(),a("p",Ee,"Showing "+l(N(g("invitation_state")))+" portal invitations inside each organisation. Summary counters above remain tenant-wide.",1)):i("",!0),s("div",Ne,[t[35]||(t[35]=s("p",{class:"w-full text-xs font-bold uppercase text-slate-500 sm:w-auto"},"Subcontractor offer filter",-1)),s("button",{class:L(["rounded border px-3 py-2 text-xs font-bold uppercase transition",g("subcontractor_offer_status")?"border-slate-200 bg-white text-slate-600 hover:border-ocean":"border-ocean bg-cyan-50 text-ocean"]),onClick:t[3]||(t[3]=e=>Vt(null))}," All ",2),(r(!0),a(_,null,v(f.subcontractorOfferStatuses,e=>(r(),a("button",{key:e,class:L(["rounded border px-3 py-2 text-xs font-bold uppercase transition",g("subcontractor_offer_status")===e?"border-ocean bg-cyan-50 text-ocean":"border-slate-200 bg-white text-slate-600 hover:border-ocean"]),onClick:o=>Vt(e)},l(N(e))+" ("+l(f.subcontractorOfferStatusCounts[e]||0)+") ",11,De))),128))]),g("subcontractor_offer_status")?(r(),a("p",Le,"Showing "+l(N(g("subcontractor_offer_status")))+" subcontractor offers inside each subcontractor portal. Summary counters remain tenant-wide.",1)):i("",!0)]),d(O).props.auth.permissions.portal_organisations_manage?(r(),a("form",{key:0,class:"panel mt-7 grid gap-4 p-5 md:grid-cols-2",onSubmit:t[8]||(t[8]=C(e=>d(w).post("/app/portal-organisations",{onSuccess:()=>d(w).reset()}),["prevent"]))},[t[43]||(t[43]=s("h2",{class:"text-lg font-black text-ink md:col-span-2"},"Add organisation",-1)),s("label",Te,[t[37]||(t[37]=m("Type",-1)),p(s("select",{"onUpdate:modelValue":t[4]||(t[4]=e=>d(w).type=e),class:"field"},[...t[36]||(t[36]=[s("option",{value:"customer"},"Customer",-1),s("option",{value:"subcontractor"},"Subcontractor",-1)])],512),[[R,d(w).type]])]),s("label",Fe,[t[38]||(t[38]=m("Name",-1)),p(s("input",{"onUpdate:modelValue":t[5]||(t[5]=e=>d(w).name=e),required:"",class:"field"},null,512),[[k,d(w).name]]),s("span",Be,l(d(w).errors.name),1)]),d(w).type==="customer"?(r(
2),a("label",ze,[t[40]||(t[40]=m("Customer account",-1)),p(s("select",{"onUpdate:modelValue":t[6]||(t[6]=e=>d(w).customer_public_id=e),required:"",class:"field"},[t[39]||(t[39]=s("option",{value:""},"Select customer",-1)),(r(!0),a(_,null,v(f.customers,e=>(r(),a("option",{key:e.public_id,value:e.public_id},l(e.account_reference)+" / "+l(e.name),9,We))),128))],512),[[R,d(w).customer_public_id]]),s("span",Je,l(d(w).errors.customer_public_id),1)])):i("",!0),s("label",Xe,[t[42]||(t[42]=m("Status",-1)),p(s("select",{"onUpdate:modelValue":t[7]||(t[7]=e=>d(w).status=e),class:"field"},[...t[41]||(t[41]=[s("option",{value:"active"},"Active",-1),s("option",{value:"inactive"},"Inactive",-1)])],512),[[R,d(w).status]])]),s("button",{disabled:d(w).processing,class:"btn-primary self-end justify-self-start"},"Add organisation",8,Qe)],32)):i("",!0),d(O).props.flash.activation_url?(r(),a("div",Ge,[t[44]||(t[44]=s("p",{class:"font-bold"},"Signed activation link",-1)),s("p",Ke,l(d(O).props.flash.activation_url),1)])):i("",!0),s("section",{class:"panel mt-5 overflow-x-auto",onClick:yt},[s("div",Ye,[s("label",He,[t[45]||(t[45]=m(" Filter ",-1)),p(s("input",{"onUpdate:modelValue":t[9]||(t[9]=e=>J.value=e),class:"field py-1.5 text-xs font-semibold normal-case",placeholder:"Organisation, customer, email, invite, status, offer",onInput:et},null,544),[[k,J.value]])]),s("span",Ze,l(Mt.value)+"-"+l(At.value)+" shown / "+l(D.value.length)+" filtered / "+l(f.organisations.length)+" total",1),s("select",{value:V.perPage,class:"field w-auto py-1.5 text-xs",onChange:t[10]||(t[10]=e=>Ht(e.target.value))},[(r(),a(_,null,v(Tt,e=>s("option",{key:e,value:e},l(e)+" rows",9,es)),64))],40,ts),J.value?(r(),a("button",{key:0,type:"button",class:"btn-secondary px-3 py-1.5 text-xs",onClick:t[11]||(t[11]=e=>{J.value="",et()})},"Clear")):i("",!0),s("button",{type:"button",class:"btn-secondary px-3 py-1.5 text-xs",onClick:t[12]||(t[12]=e=>st.value=!st.value)},"Columns: "+l(j.value.length),1),s("button",{type:"button",class:"btn-secondary px-3 py-1.5 text-xs",onClick:qt},"Export CSV"),st.value?(r(),a("div",ss,[s("div",os,[p(s("input",{"onUpdate:modelValue":t[13]||(t[13]=e=>ot.value=e),type:"search",class:"field max-w-xs py-1 text-xs",placeholder:"Search columns"},null,512),[[k,ot.value]]),s("span",ns,l(j.value.length)+" selected / "+l(rt.value.length)+" shown",1)]),s("div",ls,[(r(!0),a(_,null,v(rt.value,e=>(r(),a("label",{key:e.key,class:"flex items-center gap-1 font-semibold text-slate-700"},[s("input",{type:"checkbox",checked:j.value.includes(e.key),onChange:o=>Xt(e.key)},null,40,as),m(" "+l(e.label),1)]))),128)),rt.value.length===0?(r(),a("p",rs,"No columns match.")):i("",!0)])])):i("",!0)]),s("table",is,[s("thead",cs,[s("tr",null,[(r(!0),a(_,null,v(j.value,e=>{var o;return r(),a("th",{key:e,class:"relative border-r border-slate-200 px-4 py-3",style:wt(Rt(e))},[s("button",{type:"button",class:"flex w-full items-center justify-between gap-2 text-left font-black hover:text-ocean",onClick:x=>te(e,x)},[s("span",us,l(((o=tt(e))==null?void 0:o.label)||e),1),s("span",null,l(ee(e)),1)],8,ds),s("span",{class:"absolute right-0 top-0 h-full w-1 cursor-col-resize hover:bg-ocean",onMousedown:C(x=>se(e,x),["prevent"])},null,40,ps)],4)}),128)),t[46]||(t[46]=s("th",{class:"px-4 py-3",style:{width:"180px","min-width":"180px"}},"Actions",-1))])]),s("tbody",bs,[(r(!0),a(_,null,v(Yt.value,e=>(r(),a("tr",{key:e.public_id,class:"hover:bg-cyan-50",onContextmenu:C(o=>oe(e,o),["prevent","stop"])},[(r(!0),a(_,null,v(j.value,o=>(r(),a("td",{key:`${e.public_id}-${o}`,class:"border-r border-slate-100 px-4 py-3",style:wt(Rt(o))},[o==="name"?(r(),a("button",{key:0,type:"button",class:"font-bold text-ocean hover:text-cyan-800",onClick:x=>vt(e)},l(e.name),9,xs)):(r(),a("span",_s,l(Q(e,o)),1))],4))),128)),s("td",fs,[s("div",ys,[s("button",{type:"button",class:"btn-primary px-3 py-1.5 text-xs",onClick:o=>vt(e)}," Manage ",8,vs),d(O).props.auth.permissions.portal_invitations_manage?(r(),a("button",{key:0,type:"button",class:"btn-secondary px-3 py-1.5 text-xs",onClick:o=>Et(e)}," Invite ",8,gs)):i("",!0)])])],40,ms))),128)),D.value.length===0?(r(),a("tr",hs,[s("td",{colspan:j.value.length+1,class:"px-4 py-10 text-center text-slate-500"},"No portal organisations match this view.",8,ks)])):i("",!0)])]),s("footer",ws,[s("span",null,"Showing "+l(Mt.value)+"-"+l(At.value)+" of "+l(D.value.length),1),s("div",Ss,[s("button",{type:"button",class:"btn-secondary px-2 py-1 text-xs",disabled:F.value<=1,onClick:t[14]||(t[14]=e=>It(F.value-1))},"Previous",8,Cs),s("span",Os,"Page "+l(F.value)+" of "+l(G.value),1),s("button",{type:"button",class:"btn-secondary px-2 py-1 text-xs",disabled:F.value>=G.value,onClick:t[15]||(t[15]=e=>It(F.value+1))},"Next",8,js)])]),T.value.visible?(r(),a("div",{key:0,class:"fixed z-[70] w-52 overflow-hidden rounded-md border border-slate-200 bg-white py-1 text-sm shadow-xl",style:wt({left:`${T.value.x}px`,top:`${T.value.y}px`}),onClick:t[18]||(t[18]=C(()=>{},["stop"]))},[s("button",{type:"button",class:"block w-full px-3 py-2 text-left hover:bg-slate-50",onClick:t[16]||(t[16]=e=>vt(T.value.organisation))},"Manage access"),d(O).props.auth.permissions.portal_invitations_manage?(r(),a("button",{key:0,t
2ype:"button",class:"block w-full px-3 py-2 text-left hover:bg-slate-50",onClick:t[17]||(t[17]=e=>Et(T.value.organisation))},"Create portal invite")):i("",!0),s("button",{type:"button",class:"block w-full px-3 py-2 text-left hover:bg-slate-50",onClick:qt},"Export grid")],4)):i("",!0)]),nt.value?(r(),a("div",Vs,[s("section",$s,[s("header",Us,[s("div",null,[t[47]||(t[47]=s("p",{class:"text-xs font-black uppercase text-cyan-200"},"Portal invitation",-1)),s("h2",Ps,l((c=B.value)==null?void 0:c.name),1),s("p",Ms," Send a signed "+l(((u=B.value)==null?void 0:u.type)==="subcontractor"?"subcontractor":"customer")+" portal activation link. ",1)]),s("button",{type:"button",class:"text-2xl leading-none",onClick:gt},"×")]),s("form",{class:"grid gap-4 p-5",onSubmit:C(le,["prevent"])},[s("label",As,[t[48]||(t[48]=m(" Contact name ",-1)),p(s("input",{"onUpdate:modelValue":t[19]||(t[19]=e=>d(y).name=e),required:"",maxlength:"255",class:"field mt-1"},null,512),[[k,d(y).name]]),d(y).errors.name?(r(),a("span",Is,l(d(y).errors.name),1)):i("",!0)]),s("label",Rs,[t[49]||(t[49]=m(" Email address ",-1)),p(s("input",{"onUpdate:modelValue":t[20]||(t[20]=e=>d(y).email=e),required:"",type:"email",maxlength:"255",class:"field mt-1",placeholder:"[email protected]"},null,512),[[k,d(y).email]]),d(y).errors.email?(r(),a("span",qs,l(d(y).errors.email),1)):i("",!0)]),s("label",Es,[t[51]||(t[51]=m(" Portal role ",-1)),p(s("select",{"onUpdate:modelValue":t[21]||(t[21]=e=>d(y).role=e),class:"field mt-1"},[...t[50]||(t[50]=[s("option",{value:"member"},"Member",-1),s("option",{value:"administrator"},"Administrator",-1)])],512),[[R,d(y).role]]),d(y).errors.role?(r(),a("span",Ns,l(d(y).errors.role),1)):i("",!0)]),s("div",Ds,[s("button",{type:"button",class:"btn-secondary",onClick:gt},"Cancel"),s("button",{class:"btn-primary",disabled:d(y).processing},"Send invitation",8,Ls)])],32)])])):i("",!0),lt.value&&Ut.value?(r(),a("div",Ts,[(r(!0),a(_,null,v([Ut.value],e=>(r(),a("section",{id:`organisation-${e.public_id}`,key:`access-${e.public_id}`,class:"panel my-4 w-full max-w-6xl p-5 shadow-2xl"},[s("div",Bs,[s("div",null,[s("p",zs,l(e.type==="subcontractor"?"Subcontractor portal":"Customer portal"),1),s("h2",Ws,l(e.name)+" access",1),t[52]||(t[52]=s("p",{class:"mt-1 text-sm text-slate-500"},"Manage branding, visibility, invitations, requests, and offers without stretching the whole organisations page.",-1))]),s("button",{type:"button",class:"btn-secondary",onClick:ne},"Close")]),d(O).props.auth.permissions.portal_organisations_manage?(r(),a("form",{key:0,class:"mt-4 grid gap-3 rounded border border-slate-200 bg-slate-50 p-4 md:grid-cols-3",onSubmit:C(o=>S(e).patch(`/app/portal-organisations/${e.public_id}/branding`,{preserveScroll:!0}),["prevent"])},[t[56]||(t[56]=s("div",{class:"md:col-span-3"},[s("h3",{class:"font-bold text-ink"},"Portal branding"),s("p",{class:"mt-1 text-xs text-slate-500"},"Applied to this organisation's portal header and signed tracking pages.")],-1)),s("label",Xs,[t[53]||(t[53]=m("Display name",-1)),p(s("input",{"onUpdate:modelValue":o=>S(e).display_name=o,maxlength:"120",class:"field mt-1",placeholder:e.name},null,8,Qs),[[k,S(e).display_name]]),S(e).errors.display_name?(r(),a("span",Gs,l(S(e).errors.display_name),1)):i("",!0)]),s("label",Ks,[t[54]||(t[54]=m("Accent colour",-1)),p(s("input",{"onUpdate:modelValue":o=>S(e).accent_color=o,required:"",pattern:"^#[0-9A-Fa-f]{6}$",class:"field mt-1",placeholder:"#0b7285"},null,8,Ys),[[k,S(e).accent_color]]),S(e).errors.accent_color?(r(),a("span",Hs,l(S(e).errors.accent_color),1)):i("",!0)]),s("label",Zs,[t[55]||(t[55]=m("Support email",-1)),p(s("input",{"onUpdate:modelValue":o=>S(e).support_email=o,type:"email",maxlength:"255",class:"field mt-1",placeholder:"[email protected]"},null,8,to),[[k,S(e).support_email]]),S(e).errors.support_email?(r(
2),a("span",eo,l(S(e).errors.support_email),1)):i("",!0)]),s("button",{class:"btn-secondary justify-self-start md:col-span-3",disabled:S(e).processing},"Save branding",8,so)],40,Js)):i("",!0),e.type==="subcontractor"&&d(O).props.auth.permissions.portal_organisations_manage?(r(),a("form",{key:1,class:"mt-4 grid gap-3 rounded border border-slate-200 bg-slate-50 p-4 md:grid-cols-2",onSubmit:C(o=>E(e).patch(`/app/portal-organisations/${e.public_id}/notification-preferences`,{preserveScroll:!0}),["prevent"])},[t[59]||(t[59]=s("div",{class:"md:col-span-2"},[s("h3",{class:"font-bold text-ink"},"Subcontractor notification preferences"),s("p",{class:"mt-1 text-xs text-slate-500"},"Tune email routing for this subcontractor without changing the shared tenant-wide planner recipients.")],-1)),s("label",no,[p(s("input",{"onUpdate:modelValue":o=>E(e).subcontractor_offer_notifications_enabled=o,type:"checkbox",class:"mt-1 h-4 w-4"},null,8,lo),[[St,E(e).subcontractor_offer_notifications_enabled]]),t[57]||(t[57]=s("span",null,[m(" Notify subcontractor members about offers "),s("span",{class:"mt-1 block text-xs font-normal text-slate-500"},"Controls new-offer and counter-decision emails to active members of this subcontractor portal.")],-1))]),s("label",ao,[p(s("input",{"onUpdate:modelValue":o=>E(e).subcontractor_update_notifications_enabled=o,type:"checkbox",class:"mt-1 h-4 w-4"},null,8,ro),[[St,E(e).subcontractor_update_notifications_enabled]]),t[58]||(t[58]=s("span",null,[m(" Notify workspace about subcontractor updates "),s("span",{class:"mt-1 block text-xs font-normal text-slate-500"},"Controls internal update and POD-return emails from this subcontractor, including shared planner routing.")],-1))]),E(e).errors.organisation?(r(),a("p",io,l(E(e).errors.organisation),1)):i("",!0),s("button",{class:"btn-secondary justify-self-start md:col-span-2",disabled:E(e).processing},"Save notification preferences",8,co)],40,oo)):i("",!0),d(O).props.auth.permissions.portal_organisations_manage?(r(),a("form",{key:2,class:"mt-4 rounded border border-slate-200 bg-slate-50 p-4",onSubmit:C(o=>W(e).patch(`/app/portal-organisations/${e.public_id}/visibility-settings`,{preserveScroll:!0}),["prevent"])},[s("div",po,[s("div",null,[t[60]||(t[60]=s("h3",{class:"font-bold text-ink"},"Portal visibility",-1)),s("p",bo,"Controls what this "+l(e.type)+" portal can see. The backend also filters protected data and blocks disabled document/invoice routes.",1)]),s("button",{class:"btn-secondary",disabled:W(e).processing},"Save visibility",8,mo)]),s("div",xo,[(r(!0),a(_,null,v(Jt(e),([o,x])=>(r(),a("label",{key:o,class:"flex gap-3 rounded border border-slate-200 bg-white px-3 py-2 text-sm font-semibold text-slate-700"},[p(s("input",{"onUpdate:modelValue":b=>W(e).visibility_settings[o]=b,type:"checkbox",class:"mt-1 h-4 w-4"},null,8,_o),[[St,W(e).visibility_settings[o]]]),s("span",null,l(x),1)]))),128))]),W(e).errors.visibility_settings?(r(),a("p",fo,l(W(e).errors.visibility_settings),1)):i("",!0)],40,uo)):i("",!0),s("div",yo,[d(O).props.auth.permissions.portal_invitations_manage?(r(),a("form",{key:0,class:"space-y-3",onSubmit:C(o=>M(e).post(`/app/portal-organisations/${e.public_id}/invitations`,{onSuccess:()=>M(e).reset()}),["prevent"])},[t[62]||(t[62]=s("h3",{class:"font-bold text-ink"},"Invite portal member",-1)),p(s("input",{"onUpdate:modelValue":o=>M(e).name=o,required:"",placeholder:"Name",class:"field"},null,8,go),[[k,M(e).name]]),p(s("input",{"onUpdate:modelValue":o=>M(e).email=o,required:"",type:"email",placeholder:"Email",class:"field"},null,8,ho),[[k,M(e).email]]),p(s("select",{"onUpdate:modelValue":o=>M(e).role=o,class:"field"},[...t[61]||(t[61]=[s("option",{value:"member"},"Member",-1),s("option",{value:"administrator"},"Administrator",-1)])],8,ko),[[R,M(e).role]]),s("button",{class:"btn-primary",disabled:M(e).processing},"Create signed invitation",8,wo),(r(!0),a(_,null,v(e.invitations,o=>(r(),a("article",{key:o.public_id,class:"rounded border border-slate-200 bg-slate-50 p-2 text-xs text-slate-600"},[s("p",So,[m(l(o.email)+" / "+l(o.status)+" ",1),o.is_stale?(r(),a("span",Co,"Expired")):i("",!0)]),s("p",Oo,"Expires "+l(Ct(o.expires_at)),1),o.stale_reason?(r(),a("p",jo,l(o.stale_reason),1)):i("",!0),o.status==="pending"?(r(),a("button",{key:1,type:"button",class:"mt-2 rounded border border-slate-300 bg-white px-2 py-1 text-[11px] font-black uppercase text-ocean hover:border-ocean hover:bg-cyan-50",onClick:x=>Wt(e,o)}," Resend invite ",8,Vo)):i("",!0)]))),128))],40,vo)):i("",!0),e.type==="customer"&&d(O).props.auth.permissions.portal_grants_manage?(r(),a("form",{key:1,class:"space-y-3",onSubmit:C(o=>X(e).post(`/app/portal-organisations/${e.public_id}/job-grants`,{onSuccess:()=>X(e).reset()}),["prevent"])},[t[64]||(t[64]=s("h3",{class:"font-bold text-ink"},"Share customer job",-1)),p(s("select",{"onUpdate:modelValue":o=>X(e).job_public_id=o,required:"",class:"field"},[t[63]||(t[63]=s("option",{value:""},"Select job",-1)),(r(!0),a(_,null,v(f.jobs.filter(o=>o.customer_id===e.customer_id),o=>(r(),a("option",{key:o.public_id,value:o.public_id},l(o.job_reference)+" / "+l(o.customer.name),9,Po))),128))],8,Uo),[[R,X(e).job_public_id]]),s("button",{class:"btn-primary",disabled:X(e).processing},"Grant portal access",8,Mo),(r(!0),a(_,null,v(e.job_grants,o=>(r(),a("p",{key:o.id,class:"text-xs text-slate-500"},l(o.job.job_reference),1))),128))],40,$o)):i("",!0),e.type==="customer"&&d(O).props.auth.permissions.portal_grants_manage?(r(),a("div",Ao,[t[67]||(t[67]=s("h3",{class:"font-bold text-ink"},"Booking requests",-1)),(r(!0),a(_,null,v(e.booking_requests,o=>(r(),a("article",{key:o.public_id,class:"rounded border border-slate-200 p-3 text-xs text-slate-600"},[s("p",Io,[m(l(o.customer_reference||"Booking request")+" / "+l(o.status)+" ",1),o.is_stale?(r(),a("span",Ro,l(o.stale_reason),1)):i("",!0)]),s("p",qo,l(o.collection_site)+" to "+l(o.delivery_site),1),s("p",Eo,l(o.requested_date||"No date requested")+" / "+l(o.load_summary||"No load summary"),1),o.notes?(r(),a("p",N
2o,l(o.notes),1)):i("",!0),o.requester?(r(),a("p",Do,"Requested by "+l(o.requester.name||o.requester.email),1)):i("",!0),o.transport_job?(r(),a("p",Lo,[t[65]||(t[65]=m(" Converted to ",-1)),kt(d(re),{href:`/app/jobs/${o.transport_job.public_id}`,class:"font-semibold text-ocean"},{default:Dt(()=>[m(l(o.transport_job.job_reference),1)]),_:2},1032,["href"]),m(" / "+l(o.transport_job.status),1)])):i("",!0),o.status==="requested"?(r(),a("form",{key:3,class:"mt-3 grid gap-2",onSubmit:C(x=>$(o).patch(`/app/portal-organisations/booking-requests/${o.public_id}`,{preserveScroll:!0,onSuccess:()=>$(o).reset("decision_note")}),["prevent"])},[p(s("select",{"onUpdate:modelValue":x=>$(o).status=x,class:"field"},[...t[66]||(t[66]=[s("option",{value:"accepted"},"Accept request",-1),s("option",{value:"rejected"},"Reject request",-1)])],8,Fo),[[R,$(o).status]]),p(s("textarea",{"onUpdate:modelValue":x=>$(o).decision_note=x,rows:"2",maxlength:"2000",class:"field",placeholder:"Optional note for the portal user"},null,8,Bo),[[k,$(o).decision_note]]),$(o).errors.booking_request||$(o).errors.status?(r(),a("p",zo,l($(o).errors.booking_request||$(o).errors.status),1)):i("",!0),s("button",{class:"btn-secondary justify-self-start",disabled:$(o).processing},"Review request",8,Wo)],40,To)):o.decision_note?(r(),a("p",Jo,"Decision note: "+l(o.decision_note),1)):i("",!0)]))),128)),e.booking_requests.length===0?(r(),a("p",Xo,"No booking requests submitted yet.")):i("",!0)])):i("",!0),e.type==="subcontractor"&&d(O).props.auth.permissions.portal_grants_manage?(r(),a("form",{key:3,class:"space-y-3",onSubmit:C(o=>h(e).post(`/app/portal-organisations/${e.public_id}/subcontractor-offers`,{onSuccess:()=>h(e).reset()}),["prevent"])},[t[71]||(t[71]=s("h3",{class:"font-bold text-ink"},"Send subcontractor offer",-1)),p(s("select",{"onUpdate:modelValue":o=>h(e).job_public_id=o,required:"",class:"field"},[t[68]||(t[68]=s("option",{value:""},"Select job",-1)),(r(!0),a(_,null,v(f.jobs,o=>(r(),a("option",{key:o.public_id,value:o.public_id},l(o.job_reference)+" / "+l(o.status),9,Ko))),128))],8,Go),[[R,h(e).job_public_id]]),s("div",Yo,[p(s("input",{"onUpdate:modelValue":o=>h(e).rate_amount=o,type:"number",step:"0.01",min:"0",placeholder:"Rate amount",class:"field"},null,8,Ho),[[k,h(e).rate_amount]]),p(s("input",{"onUpdate:modelValue":o=>h(e).rate_currency=o,maxlength:"3",required:"",class:"field uppercase"},null,8,Zo),[[k,h(e).rate_currency]])]),p(s("textarea",{"onUpdate:modelValue":o=>h(e).instructions=o,rows:"3",class:"field",placeholder:"Instructions visible to the subcontractor"},null,8,tn),[[k,h(e).instructions]]),s("label",en,[t[69]||(t[69]=m("Expires at",-1)),p(s("input",{"onUpdate:modelValue":o=>h(e).expires_at=o,type:"datetime-local",class:"field mt-1"},null,8,sn),[[k,h(e).expires_at]])]),h(e).errors.organisation?(r(),a("p",on,l(h(e).errors.organisation),1)):i("",!0),h(e).errors.job_public_id?(r(),a("p",nn,l(h(e).errors.job_public_id),1)):i("",!0),s("button",{class:"btn-primary",disabled:h(e).processing},"Send offer",8,ln),e.subcontractor_offers.length?(r(),a("div",an,[(r(!0),a(_,null,v(e.subcontractor_offers,o=>{var x;return r(),a("article",{key:o.public_id,class:"rounded border border-slate-200 p-3 text-xs text-slate-600"},[s("p",rn,[m(l(o.job.job_reference)+" / "+l(o.status)+" / "+l(o.rate_amount||"-")+" "+l(o.rate_currency)+" ",1),o.is_stale?(r(),a("span",cn,"Expired")):i("",!0)]),s("p",dn,"Expires "+l(Ct(o.expires_at)),1),o.stale_reason?(r(),a("p",un,l(o.stale_reason),1)):i("",!0),o.counter_amount?(r(),a("p",pn,[m("Counter: "+l(o.counter_amount)+" "+l(o.rate_currency)+" ",1),o.counter_note?(r(),a("span",bn,"/ "+l(o.counter_note),1)):i("",!0)])):i("",!0),(x=o.updates)!=null&&x.length?(r(),a("div",mn,[(r(!0),a(_,null,v(o.updates,b=>{var K,Nt;return r(),a("article",{key:b.public_id,class:"rounded bg-slate-50 p-2"},[s("p",xn,l(b.status_code.replaceAll("_"," ")),1),s("p",_n,l(b.submitted_at?new Date(b.submitted_at).toLocaleString():"-")+" / "+l(((K=b.submitter)==null?void 0:K.name)||((Nt=b.submitter)==null?void 0:Nt.email)||"Portal user"),1),b.note?(r(),a("p",fn,l(b.note),1)):i("",!0),b.pod?(r(),a("p",yn,"POD: "+l(b.pod.original_name)+" / "+l(b.pod.status),1)):i("",!0)])}),128))])):i("",!0),o.status==="countered"?(r(),a("form",{key:3,class:"mt-3 grid gap-2",onSubmit:C(b=>A(o).patch(`/app/portal-organisations/subcontractor-offers/${o.public_id}/counter-decision`,{onSuccess:()=>A(o).reset("decision_note")}),["prevent"])},[p(s("select",{"onUpdate:modelValue":b=>A(o).decision=b,class:"field"},[...t[70]||(t[70]=[s("option",{value:"accepted"},"Accept counter",-1),s("option",{value:"declined"},"Decline counter",-1)])],8,gn),[[R,A(o).decision]]),p(s("textarea",{"onUpdate:modelValue":b=>A(o).decision_note=b,rows:"2",class:"field",placeholder:"Optional decision note"},null,8,hn),[[k,A(o).decision_note]]),A(o).errors.decision?(r(),a("p",kn,l(A(o).errors.decision),1)):i("",!0),s("button",{class:"btn-secondary justify-self-start",disabled:A(o).processing},"Record decision",8,wn)],40,vn)):i("",!0)])}),128))])):i("",!0)],40,Qo)):i("",!0)])],8,Fs))),128))])):i("",!0)]}),_:1})],64))}};export{Vn 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.