1import{be as z,bi as E,bb as u,br as N,b6 as m,ba as i,b8 as t,bk as e,bl as Y,bc as n,b9 as l,b7 as D,bm as g,bs as d,bq as p,bp as O,bh as y}from"./CD8oQ7AZ.js";import{_ as G}from"./CMTMJ6nt.js";import{_ as K}from"./CRAC5zGE.js";import{_ as Q}from"./Di0rw2u0.js";import{_ as W}from"./CQMKV1PJ.js";import"./BssC0sOH.js";import"./DF2kBRz_.js";import"./CXnJhRUq.js";import"./BHPkSAoS.js";import"./Cw6puH6y.js";import"./Da4ad1Ms.js";import"./C95wgz8y.js";import"./GG7MkQ3J.js";import"./GzjcjP7-.js";import"./DeDVspXl.js";import"./s-nsCn8Q.js";import"./CXMSRPOl.js";import"./DlIl8fmw.js";import"./B07KVaxb.js";import"./D3tkQlft.js";import"./Cl9Xm-9P.js";import"./D_cHTrS6.js";import"./fq1F-5J2.js";import"./Dtk6rzKv.js";import"./DZ5RN4mv.js";import"./BtqN2xrr.js";import"./DYY23RCn.js";import"./DToRgbhx.js";import"./DJbUtNJ-.js";import"./QRb2k-vU.js";(function(){try{var f=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};f.SENTRY_RELEASE={id:"d723bf7123738f121b047ced4516ac233a1cce14"};var o=new f.Error().stack;o&&(f._sentryDebugIds=f._sentryDebugIds||{},f._sentryDebugIds[o]="abc7733c-b91f-4da0-ad5b-a4b89691eb5a",f._sentryDebugIdIdentifier="sentry-dbid-abc7733c-b91f-4da0-ad5b-a4b89691eb5a")}catch{}})();const X={class:"max-w-2xl mx-auto space-y-6 py-8"},Z={class:"bg-white rounded-lg border border-border p-5 space-y-3"},ee={class:"flex items-center gap-2"},te={key:0,class:"rounded-lg bg-gray-50 border border-border p-4 space-y-2 text-sm font-mono"},se={class:"flex gap-2"},oe={class:"break-all"},le={class:"flex gap-2"},ne={class:"break-all"},ae={class:"flex gap-2"},re={class:"flex gap-2"},ie={class:"flex gap-2"},de={class:"flex items-center gap-2"},pe={class:"flex items-center gap-2"},ce={class:"font-mono text-xs space-y-1"},ue={class:"flex items-center gap-2"},be={class:"flex items-center gap-2"},me={class:"font-mono text-xs space-y-1"},fe={key:0,class:"bg-white rounded-lg border border-dashed border-gray-300 p-5 space-y-3"},ze=z({__name:"multi-hire-test",setup(f){const o=p(null),c=p(null),a=p(null),b=p(null),r=p(null),k=p(!1),S=p(!1),w=p(!1),R=p(!1),j=p(!1),U=p(!1),C=p(null),h=O(()=>a.value?.status==="hiring"&&a.value?.freeReplacementSlots===1),P=O(()=>r.value?.status==="filled"&&(r.value?.freeReplacementSlots??0)===0),v=async B=>{C.value=null;try{await B()}catch(s){C.value=s instanceof Error?s.message:String(s),console.error(s)}},$=()=>v(async()=>{k.value=!0,c.value=null,a.value=null,b.value=null,r.value=null;try{o.value=await y("/api/admin/seed/multi-hire-test",{method:"POST"})}finally{k.value=!1}}),I=()=>v(async()=>{if(o.value){S.value=!0;try{c.value=await y(`/api/hire/${o.value.ids.hireUid}/cancel`,{method:"POST",body:{pioneerId:o.value.ids.pioneer1.id}})}finally{S.value=!1}}}),J=()=>v(async()=>{if(o.value){w.value=!0;try{a.value=await y(`/api/job/${o.value.ids.jobUid}`)}finally{w.value=!1}}}),V=()=>v(async()=>{if(o.value){R.value=!0;try{b.value=await y("/api/hire/free-replacement",{method:"POST",body:{jobUid:o.value.ids.jobUid,pioneerUids:[o.value.ids.pioneer1.id]}})}finally{R.value=!1}}}),F=()=>v(async()=>{if(o.value){j.value=!0;try{r.value=await y(`/api/job/${o.value.ids.jobUid}`)}finally{j.value=!1}}}),A=()=>v(async()=>{if(o.value){U.value=!0;try{await y("/api/admin/seed/multi-hire-test",{method:"DELETE",body:{jobUid:o.value.ids.jobUid,hireUid:o.value.ids.hireUid}}),o.value=null,c.value=null,a.value=null,b.value=null,r.value=null}finally{U.value=!1}}});return(B,s)=>{const _=N("StepBadge"),x=Y,T=N("ResultBlock"),H=G,L=K,M=Q,q=W;return m(),E(q,{class:"min-h-page"},{default:u(()=>[i(M,null,{default:u(()=>[i(L,null,{default:u(()=>[t("div",X,[s[22]||(s[22]=t("div",null,[t("h1",{class:"text-2xl font-bold text-pioneering-purple"},"Multi-hire withdrawal test"),t("p",{class:"text-sm text-gray-500 mt-1"},"Dev only â seeds and exercises the pioneer withdrawal + free replacement flow.")],-1)),t("div",Z,[t("div",ee,[i(_,{step:1,done:!!e(o)},null,8,["done"]),s[0]||(s[0]=t("h2",{class:"font-semibold text-pioneering-purple"},"Seed test data",-1))]),s[6]||(s[6]=t("p",{class:"text-sm text-gray-600"}," Creates a filled 2-worker job with both test pioneers hired. Shift is 7 days out so the cancellation fee path is never triggered. ",-1)),i(x,{color:"pioneering-purple",loading:e(k),disabled:e(k),class:"rounded-3xl",onClick:$},{default:u(()=>[n(l(e(o)?"Re-seed (creates new job)":"Seed test data"),1)]),_:1},8,["loading","disabled"]),e(o)?(m(),D("div",te,[t("div",se,[s[1]||(s[1]=t("span",{class:"text-gray-500 shrink-0"},"Job:",-1)),t("span",oe,l(e(o).ids.jobUid),1)]),t("div",le,[s[2]||(s[2]=t("span",{class:"text-gray-500 shrink-0"},"Hire:",-1)),t("span",ne,l(e(o).ids.hireUid),1)]),t("div",ae,[s[3]||(s[3]=t("span",{class:"text-gray-500 shrink-0"},"Pioneer 1:",-1)),t("span",null,l(e(o).ids.pioneer1.name)+" ("+l(e(o).ids.pioneer1.id)+")",1)]),t("div",re,[s[4]||(s[4]=t("span",{class:"text-gray-500 shrink-0"},"Pioneer 2:",-1)),t("span",null,l(e(o).ids.pioneer2.name)+" ("+l(e(o).ids.pioneer2.id)+")",1)]),t("div",ie,[s[5]||(s[5]=t("span",{class:"text-gray-500 shrink-0"},"Shift:",-1)),t("span",null,l(e(o).shiftDate),1)])])):g("",!0)]),t("div",{class:d(["bg-white rounded-lg border p-5 space-y-3",e(o)?"border-border":"border-border opacity-40 pointer-events-none"])},[t("div",de,[i(_,{step:2,done:!!e(c)},null,8,["done"]),s[7]||(s[7]=t("h2",{class:"font-semibold text-pioneering-purple"},"Cancel pioneer 1's shift",-1))]),s[9]||(s[9]=t("p",{class:"text-sm text-gray-600"},[n(" Simulates pioneer 1 withdrawing. Expects: job â "),t("code",{class:"bg-gray-100 px-1 rounded"},"hiring"),n(", "),t("code",{class:"bg-gray-100 px-1 rounded"},"freeReplacementSlots: 1"),n(", no Stripe refund. ")],-1)),i(x,{color:"pioneering-magenta",loading:e(S),disabled:!e(o)||e(S),class:"rounded-3xl",onClick:I},{default:u(()=>[...s[8]||(s[8]=[n(" Cancel pioneer 1 ",-1)])]),_:1},8,["loading","disabled"]),e(c)?(m(),E(T,{key:0,data:e(c)},null,8,["data"])):g("",!0)],2),t("div",{class:d(["bg-white rounded-lg border p-5 space-y-3",e(c)?"border-border":"border-border opacity-40 pointer-events-none"])},[t("div",pe,[i(_,{step:3,done:!!e(a)},null,8,["done"]),s[10]||(s[10]=t("h2",{class:"font-semibold text-pioneering-purple"}
1,"Verify job state",-1))]),s[12]||(s[12]=t("p",{class:"text-sm text-gray-600"},[n(" Fetches the job and checks "),t("code",{class:"bg-gray-100 px-1 rounded"},"status === 'hiring'"),n(" and "),t("code",{class:"bg-gray-100 px-1 rounded"},"freeReplacementSlots === 1"),n(". ")],-1)),i(x,{color:"pioneering-purple",variant:"outline",loading:e(w),disabled:!e(c)||e(w),class:"rounded-3xl",onClick:J},{default:u(()=>[...s[11]||(s[11]=[n(" Check job state ",-1)])]),_:1},8,["loading","disabled"]),e(a)?(m(),D("div",{key:0,class:d(["rounded-lg p-4 space-y-2 text-sm border",e(h)?"bg-mint-50 border-mint-200":"bg-red-50 border-red-200"])},[t("div",{class:d(["font-semibold",e(h)?"text-mint-700":"text-red-700"])},l(e(h)?"â Job state looks correct":"â Unexpected job state"),3),t("div",ce,[t("div",{class:d(e(a).status==="hiring"?"text-mint-700":"text-red-600")}," status: "+l(e(a).status)+" "+l(e(a).status==="hiring"?"â":"â expected hiring"),3),t("div",{class:d(e(a).freeReplacementSlots===1?"text-mint-700":"text-red-600")}," freeReplacementSlots: "+l(e(a).freeReplacementSlots??0)+" "+l(e(a).freeReplacementSlots===1?"â":"â expected 1"),3),t("div",null,"chosenPioneerUids: "+l(JSON.stringify(e(a).chosenPioneerUids)),1)])],2)):g("",!0)],2),t("div",{class:d(["bg-white rounded-lg border p-5 space-y-3",e(h)?"border-border":"border-border opacity-40 pointer-events-none"])},[t("div",ue,[i(_,{step:4,done:!!e(b)},null,8,["done"]),s[13]||(s[13]=t("h2",{class:"font-semibold text-pioneering-purple"},"Hire replacement (free slot)",-1))]),s[15]||(s[15]=t("p",{class:"text-sm text-gray-600"},[n(" Re-hires pioneer 1 via "),t("code",{class:"bg-gray-100 px-1 rounded"},"/api/hire/free-replacement"),n(" â no Stripe checkout. Expects: job â "),t("code",{class:"bg-gray-100 px-1 rounded"},"filled"),n(", "),t("code",{class:"bg-gray-100 px-1 rounded"},"freeReplacementSlots: 0"),n(". ")],-1)),s[16]||(s[16]=t("p",{class:"text-xs text-amber-600 font-medium"}," â Must be logged in as the company ([email protected]). ",-1)),i(x,{color:"pioneering-purple",loading:e(R),disabled:!e(h)||e(R),class:"rounded-3xl",onClick:V},{default:u(()=>[...s[14]||(s[14]=[n(" Hire replacement (free) ",-1)])]),_:1},8,["loading","disabled"]),e(b)?(m(),E(T,{key:0,data:e(b)},null,8,["data"])):g("",!0)],2),t("div",{class:d(["bg-white rounded-lg border p-5 space-y-3",e(b)?"border-border":"border-border opacity-40 pointer-events-none"])},[t("div",be,[i(_,{step:5,done:!!e(r)},null,8,["done"]),s[17]||(s[17]=t("h2",{class:"font-semibold text-pioneering-purple"},"Verify final job state",-1))]),i(x,{color:"pioneering-purple",variant:"outline",loading:e(j),disabled:!e(b)||e(j),class:"rounded-3xl",onClick:F},{default:u(()=>[...s[18]||(s[18]=[n(" Check final state ",-1)])]),_:1},8,["loading","disabled"]),e(r)?(m(),D("div",{key:0,class:d(["rounded-lg p-4 space-y-2 text-sm border",e(P)?"bg-mint-50 border-mint-200":"bg-red-50 border-red-200"])},[t("div",{class:d(["font-semibold",e(P)?"text-mint-700":"text-red-700"])},l(e(P)?"â All checks passed":"â Unexpected final state"),3),t("div",me,[t("div",{class:d(e(r).status==="filled"?"text-mint-700":"text-red-600")}," status: "+l(e(r).status)+" "+l(e(r).status==="filled"?"â":"â expected filled"),3),t("div",{class:d((e(r).freeReplacementSlots??0)===0?"text-mint-700":"text-red-600")}," freeReplacementSlots: "+l(e(r).freeReplacementSlots??0)+" "+l((e(r).freeReplacementSlots??0)===0?"â":"â expected 0"),3),t("div",null,"chosenPioneerUids: "+l(JSON.stringify(e(r).chosenPioneerUids)),1)])],2)):g("",!0)],2),e(o)?(m(),D("div",fe,[s[20]||(s[20]=t("h2",{class:"font-semibold text-gray-600"},"Cleanup",-1)),s[21]||(s[21]=t("p",{class:"text-sm text-gray-500"},"Deletes the seeded job and hire from the database.",-1)),i(x,{color:"error",variant:"outline",loading:e(U),disabled:e(U),class:"rounded-3xl",onClick:A},{default:u(()=>[...s[19]||(s[19]=[n(" Delete seed data ",-1)])]),_:1},8,["loading","disabled"])])):g("",!0),e(C)?(m(),E(H,{key:1,color:"error",variant:"soft",icon:"i-heroicons-exclamation-circle",title:e(C),class:"mt-2"},null,8,["title"])):g("",!0)])]),_:1})]),_:1})]),_:1})}}});
1export{ze 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.