1import{_ as B}from"./p3FtAbDA.js";import{p as J,u as L}from"./C08vpPe5.js";import{f as $}from"./DPHYhnq-.js";import{e as C,i as D,c as s,a,g as l,F as v,q as x,t as _,l as P,x as N,r as m,o as t}from"./xfVehKZX.js";import"./qmOa38vS.js";import"./wOgYbbjH.js";async function R(b,h,f=20){const o=[];let n=h,r=!1;do{const i=await b(n),c=i?.data??i??{};o.push(...c.job_forms??[]),r=c.has_more===!0,r&&o.length<f&&n++}while(r&&o.length<f);return{items:o,hasMore:r,lastRawPage:n}}const E={key:0,class:"space-y-3"},O={key:1,class:"bg-white rounded-xl p-8 shadow-sm text-center"},S={class:"text-sm text-gray-600"},T={key:2,class:"space-y-4"},V={class:"flex flex-wrap items-start justify-between gap-2 mb-4"},F={class:"text-base font-semibold text-gray-800"},j={key:0,class:"text-sm text-gray-500 mt-1"},q={class:"text-xs text-gray-400"},G={key:0,class:"grid grid-cols-2 sm:grid-cols-3 gap-3"},I=["src","alt"],Y={key:1,class:"text-sm text-gray-400"},z={key:0,class:"text-center pt-2"},H=["disabled"],tt=C({__name:"index",setup(b){const{getPortalIds:h,companyData:f}=L(),o=m([]),n=m(1),r=m(!1),i=m(!0),c=m(!1),p=m("");D(()=>y(!0));async function y(g=!1){const d=h();if(!d){p.value="Session not found. Please log in again.",i.value=!1;return}g?(n.value=1,i.value=!0,p.value=""):c.value=!0;try{const u=await R(e=>J.GET_PORTAL_JOB_FORMS({...d,page:e}),n.value);o.value=g?u.items:[...o.value,...u.items],n.value=u.lastRawPage,r.value=u.hasMore}catch{p.value="Failed to load job forms. Please try again."}finally{i.value=!1,c.value=!1}}async function M(){n.value+=1,await y()}function A(g){return $(g,"medium",f.value?.date_display_format)}return(g,d)=>{const u=B;return t(),s("div",null,[d[1]||(d[1]=a("div",{class:"mb-6"},[a("h1",{class:"text-2xl font-bold text-gray-800"}," Job Forms "),a("p",{class:"text-sm text-gray-500 mt-1"}," View completed job records and attached photos ")],-1)),l(i)?(t(),s("div",E,[(t(),s(v,null,x(3,e=>a("div",{key:e,class:"h-48 bg-white rounded-xl shadow-sm animate-pulse"})),64))])):l(p)?(t(),s("div",O,[a("p",S,_(l(p)),1),a("button",{class:"btn btn-sm mt-4 bg-[#1A2B55] text-white hover:bg-[#37475A] border-none",onClick:d[0]||(d[0]=e=>y(!0))}," Try Again ")])):l(o).length?(t(),s("div",T,[(t(!0),s(v,null,x(l(o),e=>(t(),s("article",{key:e.id,class:"bg-white rounded-xl p-5 shadow-sm"},[a("div",V,[a("div",null,[a("h2",F,_(e.title||"Job Form"),1),e.property_address?(t(),s("p",j,_(e.property_address),1)):P("",!0)]),a("time",q,_(A(e.date)),1)]),e.image_urls.length?(t(),s("div",G,[(t(!0),s(v,null,x(e.image_urls,(w,k)=>(t(),s("img",{key:`${w}-${k}`,src:w,alt:`${e.title||"Job form"} photo ${k+1}`,class:"w-full aspect-[4/3] rounded-lg object-cover",loading:"lazy"},null,8,I))),128))])):(t(),s("p",Y," No photos attached. "))]))),128)),l(r)?(t(),s("div",z,[a("button",{class:"btn btn-sm bg-[#1A2B55] text-white hover:bg-[#37475A] border-none",disabled:l(c),onClick:M},_(l(c)?"Loadingâ¦":"Load More"),9,H)])):P("",!0)])):(t(),N(u,{key:3,icon:"document",title:"No job forms found",message:"You don't have any job forms yet."}))])}}});export{tt as default}; 2//# sourceMappingURL=BiN1pdrq.js.map
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.