1var xe=Object.defineProperty,Ae=Object.defineProperties;var Se=Object.getOwnPropertyDescriptors;var me=Object.getOwnPropertySymbols;var Ee=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable;var pe=(g,f,t)=>f in g?xe(g,f,{enumerable:!0,configurable:!0,writable:!0,value:t}):g[f]=t,T=(g,f)=>{for(var t in f||(f={}))Ee.call(f,t)&&pe(g,t,f[t]);if(me)for(var t of me(f))je.call(f,t)&&pe(g,t,f[t]);return g},B=(g,f)=>Ae(g,Se(f));var ce=(g,f,t)=>new Promise((k,h)=>{var n=A=>{try{d(t.next(A))}catch(m){h(m)}},b=A=>{try{d(t.throw(A))}catch(m){h(m)}},d=A=>A.done?k(A.value):Promise.resolve(A.value).then(n,b);d((t=t.apply(g,f)).next())});import{b1 as _e,b9 as qe,b2 as ze,r as z,e as W,l as y,o as u,p as j,n as Ie,g as _,B as Y,i as l,j as F,t as v,bl as Oe,F as ee,m as te,S as G,f as C,bm as Pe,h as c,w as O,s as be,aT as De,W as Le,X as Ne,K as Fe,bn as J,b as Q,Y as R,z as Me,I as Re,an as Ge,ac as We,_ as oe,bj as Te,D as Be}from"./index-DkHxERqz.js";import{U as Ye}from"./Uploader-sX7X5YRQ.js";import{_ as U}from"./FormControl.vue_vue_type_script_setup_true_lang-Dc-cNXff.js";import{a as Z,_ as P,c as fe,i as X,v as se,b as He}from"./validationUtils-BL8DjRrf.js";import{L as D,_ as Ke}from"./MultiSelect-zLHG9oJW.js";import"./form-mfsyIw-y.js";import"./sanitizeHtml-BbWx3ulo.js";const Je={class:"space-y-2"},Qe=["for"],Ze={key:0,class:"text-red-600"},Xe=["id","placeholder","aria-label"],et=["id","value","checked","onChange"],tt=["for"],ye={__name:"CheckableListSelect",props:_e({label:String,size:{type:String,default:"sm"},options:{type:Array,required:!0},validate:{type:Function,default:null},errorMessage:{type:Function,default:g=>`${g} is an invalid value`},required:Boolean,cols:{type:Number,default:2}},{modelValue:{},modelModifiers:{}}),emits:_e(["change"],["update:modelValue"]),setup(g,{emit:f}){const t=g,k=qe(),h=f,n=ze(g,"modelValue"),b=z(""),d=z(null),A=W(()=>t.options.map(a=>typeof a=="string"?{label:a,value:a}:a)),m=W(()=>b.value?A.value.filter(a=>{var s;return(s=a.label)==null?void 0:s.toLowerCase().includes(b.value.toLowerCase())}):A.value);function i(a){if(d.value=null,n.value||(n.value=[]),n.value.includes(a))n.value=n.value.filter(s=>s!==a);else{if(t.validate&&!t.validate(a)){d.value=t.errorMessage(a);return}n.value.push(a)}h("change",n.value)}const o=W(()=>[{sm:"text-sm",md:"text-base"}[t.size||"sm"],"text-gray-600"]);return(a,s)=>(u(),y("div",Je,[g.label?(u(),y("label",{key:0,for:l(k),class:Y([o.value,"block font-medium text-gray-700"])},[F(v(a.__(g.label))+" ",1),g.required?(u(),y("span",Ze,"*")):j("",!0)],10,Qe)):j("",!0),Ie(_("input",{id:l(k),"onUpdate:modelValue":s[0]||(s[0]=V=>b.value=V),type:"text",placeholder:a.__(t.label)||a.__("Select..."),"aria-label":g.label?void 0:a.__("Select..."),autocomplete:"off",class:"form-input w-full rounded-md border-gray-300 px-3 py-2 text-sm focus:border-red-500 focus:ring focus:ring-red-200"},null,8,Xe),[[Oe,b.value]]),_("div",{class:Y([`grid gap-1 grid-cols-${g.cols}`,"border rounded-md bg-white p-1"])},[(u(!0),y(ee,null,te(m.value,V=>(u(),y("div",{key:V.value,class:Y(["flex items-center gap-2 rounded-md p-2 transition cursor-pointer",n.value.includes(V.value)?"bg-red-50 border border-red-200":"hover:bg-gray-50"])},[_("input",{type:"checkbox",id:V.value,value:V.value,checked:n.value.includes(V.value),onChange:S=>i(V.value),class:"h-4 w-4 text-red-600 border-gray-300 rounded focus:ring-red-500 cursor-pointer"},null,40,et),_("label",{for:V.value,class:"flex-1 text-sm font-medium text-gray-800 cursor-pointer"},v(a.__(V.label)),9,tt)],2))),128))],2)]))}},lt={class:"space-y-8"},ot={class:"flex justify-between items-start mb-2"},at={class:"font-medium text-gray-800"},nt={key:0,class:"text-red-500"},it={key:0,class:"text-sm text-gray-500 mb-2"},st={class:"mt-2"},rt={key:5,class:"flex gap-3 mt-1"},ut=["onClick"],dt={key:8},mt={class:"rounded-xl border p-5 bg-white shadow-sm"},pt={class:"font-semibold text-gray-800 mb-3"},ct={class:"grid grid-cols-1 md:grid-cols-2 gap-5"},_t={class:"block text-sm font-medium text-gray-700 mb-1"},ft={class:"block text-sm font-medium text-gray-700 mb-1"},bt={__name:"AdditionalInformation",props:{form:{type:Object,required:!0},job:{type:Object,required:!0}},setup(g){var n,b,d,A;const f=g,t=z({});function k(m){return m?m.split(/\r?\n|,/).map(i=>i.trim()).filter(i=>i):[]}(b=(n=f.job)==null?void 0:n.screening_questions)!=null&&b.length&&f.job.screening_questions.forEach(m=>{var a;const i=(a=f.form.screening_question_responses)==null?void 0:a.find(s=>s.question_id===m.question_id);let o=(i==null?void 0:i.answer)||"";
1m.question_type==="MultiSelect"&&typeof o=="string"&&o?o=o.split(` 2`).map(s=>s.trim()).filter(s=>s):m.question_type==="MultiSelect"&&!Array.isArray(o)&&(o=[]),t.value[m.question_id]={question_id:m.question_id,question:m.question,answer:o,attachment:(i==null?void 0:i.attachment)||null}}),G(t,m=>{f.form.screening_question_responses=Object.values(m).map(i=>{let o=i.answer;return Array.isArray(o)&&(o=o.join(` 3`)),{question_id:i.question_id,question:i.question,answer:o||"",attachment:i.attachment||null}}).filter(i=>Array.isArray(i.answer)?i.answer.length>0||i.attachment:i.answer||i.attachment)},{deep:!0,immediate:!0});const h=W(()=>{var m,i;return(i=(m=f.job)==null?void 0:m.screening_questions)==null?void 0:i.filter(o=>{if(!o.depends_on_question||!o.show_if_answer_is)return!0;const a=t.value[o.depends_on_question];return a?Array.isArray(a.answer)?a.answer.includes(o.show_if_answer_is):a.answer===o.show_if_answer_is:!1})});return(A=(d=f.job)==null?void 0:d.screening_questions)!=null&&A.length&&f.job.screening_questions.forEach(m=>{m.depends_on_question&&G(()=>{var i;return(i=t.value[m.depends_on_question])==null?void 0:i.answer},()=>{h.value.includes(m)||(t.value[m.question_id].answer=m.question_type==="MultiSelect"?[]:"",t.value[m.question_id].attachment=null)})}),(m,i)=>(u(),y("div",lt,[(u(!0),y(ee,null,te(h.value,(o,a)=>(u(),y("div",{key:o.question_id,class:Y(["rounded-xl border p-5 bg-white shadow-sm transition-all",{"ml-8 border-blue-300 bg-blue-50":o.depends_on_question}])},[_("div",ot,[_("label",at,[F(v(a+1)+". "+v(m.__(o.question))+" ",1),o.is_required?(u(),y("span",nt,"*")):j("",!0)])]),o.help_text?(u(),y("p",it,v(m.__(o.help_text)),1)):j("",!0),_("div",st,[o.question_type==="Yes/No"?(u(),C(l(U),{key:0,modelValue:t.value[o.question_id].answer,"onUpdate:modelValue":s=>t.value[o.question_id].answer=s,type:"select",options:[{label:m.__("Yes"),value:"Yes"},{label:m.__("No"),value:"No"}]},null,8,["modelValue","onUpdate:modelValue","options"])):o.question_type==="Text"?(u(),C(l(U),{key:1,modelValue:t.value[o.question_id].answer,"onUpdate:modelValue":s=>t.value[o.question_id].answer=s,type:"textarea",rows:12},null,8,["modelValue","onUpdate:modelValue"])):o.question_type==="Date"?(u(),C(l(U),{key:2,modelValue:t.value[o.question_id].answer,"onUpdate:modelValue":s=>t.value[o.question_id].answer=s,type:"date"},null,8,["modelValue","onUpdate:modelValue"])):o.question_type==="Email"?(u(),C(l(U),{key:3,modelValue:t.value[o.question_id].answer,"onUpdate:modelValue":s=>t.value[o.question_id].answer=s,type:"email"},null,8,["modelValue","onUpdate:modelValue"])):o.question_type==="Phone"?(u(),C(l(U),{key:4,modelValue:t.value[o.question_id].answer,"onUpdate:modelValue":s=>t.value[o.question_id].answer=s,type:"text",inputmode:"tel"},null,8,["modelValue","onUpdate:modelValue"])):o.question_type==="Rating"?(u(),y("div",rt,[(u(!0),y(ee,null,te(o.max_score,s=>(u(),y("button",{key:s,type:"button",class:Y(["px-3 py-1.5 border rounded-full text-sm",{"bg-blue-600 text-white":t.value[o.question_id].answer>=s,"hover:bg-blue-50":!0}]),onClick:V=>t.value[o.question_id].answer=s},v(m.__(s)),11,ut))),128))])):o.question_type==="MultiSelect"?(u(),C(ye,{key:6,modelValue:t.value[o.question_id].answer,"onUpdate:modelValue":s=>t.value[o.question_id].answer=s,options:k(o.options).map(s=>({label:m.__(s),value:s}))},null,8,["modelValue","onUpdate:modelValue","options"])):o.question_type==="Select"?(u(),C(Pe,{key:7,modelValue:t.value[o.question_id].answer,"onUpdate:modelValue":s=>t.value[o.question_id].answer=s,options:k(o.options).map(s=>({label:m.__(s),value:s}))},null,8,["modelValue","onUpdate:modelValue","options"])):o.question_type==="Upload"?(u(),y("div",dt,[c(Ye,{modelValue:t.value[o.question_id].attachment,"onUpdate:modelValue":s=>t.value[o.question_id].attachment=s,label:m.__("Upload File")},null,8,["modelValue","onUpdate:modelValue","label"])])):(u(),C(l(U),{key:9,modelValue:t.value[o.question_id].answer,"onUpdate:modelValue":s=>t.value[o.question_id].answer=s,type:"text"},null,8,["modelValue","onUpdate:modelValue"]))])],2))),128)),_("div",mt,[_("h3",pt,v(m.__("Professional Profiles")),1),_("div",ct,[_("div",null,[_("label",_t,v(m.__("LinkedIn Profile")),1),c(l(U),{modelValue:f.form.linkedin,"onUpdate:modelValue":i[0]||(i[0]=o=>f.form.linkedin=o),type:"url",placeholder:"https://linkedin.com/in/your-profile"},null,8,["modelValue"])]),_("div",null,[_("label",ft,v(m.__("GitHub Profile")),1),c(l(U),{modelValue:f.form.github,"onUpdate:modelValue":i[1]||(i[1]=o=>f.form.github=o),type:"url",placeholder:"https://github.com/username"},null,8,["modelValue"])])])])]))}},yt={class:"space-y-6"},vt={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"},ht={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"},gt={class:"grid grid-cols-1 gap-6"},Vt={class:"grid grid-cols-1 gap-6"},wt={class:"space-y-8"},kt={class:"flex justify-between items-start mb-2"},Ut={class:"font-medium text-gray-800"},$t={key:0,class:"text-red-500"},Ct={key:0,class:"text-sm text-gray-500 mb-2"},xt={class:"mt-2"},At={key:5,class:"flex gap-3 mt-1"},St={class:"text-lg font-bold"},Et={key:0,class:"text-gray-500"},jt={key:7},qt=["href"],zt={key:1,class:"text-gray-500"},It={__name:"ApplicationReview",props:{form:{type:Object,required:!0},job:{type:Object,required:!0}},setup(g){var b,d,A,m;const f=g,t=z({});function k(i){return i?i.split(/\r?\n|,/).map(o=>o.trim()).filter(o=>o):[]}(d=(b=f.job)==null?void 0:b.screening_questions)==null||d.forEach(i=>
3{var a;const o=(a=f.form.screening_question_responses)==null?void 0:a.find(s=>s.question_id===i.question_id);t.value[i.question_id]={question_id:i.question_id,question:i.question,answer:(o==null?void 0:o.answer)||"",attachment:(o==null?void 0:o.attachment)||null}}),G(t,i=>{f.form.screening_question_responses=Object.values(i).map(o=>{let a=o.answer;return Array.isArray(a)&&(a=a.join(` 4`)),{question_id:o.question_id,question:o.question,answer:a||"",attachment:o.attachment||null}}).filter(o=>o.answer||o.attachment)},{deep:!0,immediate:!0});const h=W(()=>{var i,o;return(o=(i=f.job)==null?void 0:i.screening_questions)==null?void 0:o.filter(a=>{if(!a.depends_on_question||!a.show_if_answer_is)return!0;const s=t.value[a.depends_on_question];return s?Array.isArray(s.answer)?s.answer.includes(a.show_if_answer_is):s.answer===a.show_if_answer_is:!1})});(m=(A=f.job)==null?void 0:A.screening_questions)==null||m.forEach(i=>{i.depends_on_question&&G(()=>{var o;return(o=t.value[i.depends_on_question])==null?void 0:o.answer},()=>{h.value.includes(i)||(t.value[i.question_id].answer="",t.value[i.question_id].attachment=null)})});const n=f.form;return(i,o)=>(u(),y("div",yt,[c(Z,{title:i.__("Personal Details")},{default:O(()=>[_("div",vt,[c(l(U),{modelValue:l(n).citizenship,"onUpdate:modelValue":o[0]||(o[0]=a=>l(n).citizenship=a),label:i.__("Citizenship"),type:"text",readonly:!0,required:""},null,8,["modelValue","label"]),l(n).citizenship==="Citizen"?(u(),C(l(U),{key:0,modelValue:l(n).id_number,"onUpdate:modelValue":o[1]||(o[1]=a=>l(n).id_number=a),label:i.__("ID Number"),readonly:!0},null,8,["modelValue","label"])):j("",!0),l(n).citizenship!=="Citizen"?(u(),C(D,{key:1,doctype:"Country",modelValue:l(n).country_of_citizenship,"onUpdate:modelValue":o[2]||(o[2]=a=>l(n).country_of_citizenship=a),label:i.__("Country of Citizenship"),readOnly:!0},null,8,["modelValue","label"])):j("",!0),l(n).citizenship!=="Citizen"?(u(),C(l(U),{key:2,modelValue:l(n).passport_number,"onUpdate:modelValue":o[3]||(o[3]=a=>l(n).passport_number=a),label:i.__("Passport Number"),readonly:!0},null,8,["modelValue","label"])):j("",!0),c(l(U),{modelValue:l(n).birth_date,"onUpdate:modelValue":o[4]||(o[4]=a=>l(n).birth_date=a),label:i.__("Date of Birth"),type:"date",readonly:!0},null,8,["modelValue","label"]),c(l(U),{modelValue:l(n).marital_status,"onUpdate:modelValue":o[5]||(o[5]=a=>l(n).marital_status=a),label:i.__("Marital Status"),type:"text",readonly:!0},null,8,["modelValue","label"]),c(l(U),{modelValue:l(n).number_of_dependants,"onUpdate:modelValue":o[6]||(o[6]=a=>l(n).number_of_dependants=a),label:i.__("Number of Dependants"),readonly:!0},null,8,["modelValue","label"]),c(Ke,{modelValue:l(n).languages,"onUpdate:modelValue":o[7]||(o[7]=a=>l(n).languages=a),doctype:"Volunteer Language",label:i.__("Languages"),readOnly:!0},null,8,["modelValue","label"])])]),_:1},8,["title"]),c(Z,{title:i.__("Contact & Location")},{default:O(()=>[_("div",ht,[c(D,{doctype:"County",modelValue:l(n).county,"onUpdate:modelValue":o[8]||(o[8]=a=>l(n).county=a),label:i.__("County"),readOnly:!0},null,8,["modelValue","label"]),l(n).county?(u(),C(D,{key:0,doctype:"Sub County",modelValue:l(n).sub_county,"onUpdate:modelValue":o[9]||(o[9]=a=>l(n).sub_county=a),label:i.__("Sub County"),filters:{county:l(n).county},readOnly:!0},null,8,["modelValue","label","filters"])):j("",!0),c(l(U),{modelValue:l(n).ward,"onUpdate:modelValue":o[10]||(o[10]=a=>l(n).ward=a),label:i.__("Ward"),type:"text",readonly:!0},null,8,["modelValue","label"]),l(n).sub_county?(u(),C(D,{key:1,doctype:"Administrative Location",modelValue:l(n).administrative_location,"onUpdate:modelValue":o[11]||(o[11]=a=>l(n).administrative_location=a),label:i.__("Location"),filters:{sub_county:l(n).sub_county},readOnly:!0},null,8,["modelValue","label","filters"])):j("",!0),c(l(U),{modelValue:l(n).access_to_internet,"onUpdate:modelValue":o[12]||(o[12]=a=>l(n).access_to_internet=a),label:i.__("Access to Internet"),type:"text",readonly:!0},null,8,["modelValue","label"])])]),_:1},8,["title"]),c(Z,{title:i.__("Education & Qualifications")},{default:O(()=>[_("div",gt,[c(D,{doctype:"Profession",modelValue:l(n).profession,"onUpdate:modelValue":o[13]||(o[13]=a=>l(n).profession=a),label:i.__("Profession"),class:"mt-4",readOnly:!0},null,8,["modelValue","label"]),c(P,{modelValue:l(n).education,"onUpdate:modelValue":o[14]||(o[14]=a=>l(n).education=a),doctype:"Employee Education",label:i.__("Education History"),autoEditGrid:!1,readOnly:!0},null,8,["modelValue","label"]),c(P,{modelValue:l(n).certification,"onUpdate:modelValue":o[15]||(o[15]=a=>l(n).certification=a),doctype:"Certification",label:i.__("Certifications"),autoEditGrid:!1,readOnly:!0},null,8,["modelValue","label"]),c(P,{modelValue:l(n).additional_skills,"onUpdate:modelValue":o[16]||(o[16]=a=>l(n).additional_skills=a),doctype:"Additional Skill",label:i.__("Skills"),autoEditGrid:!1,readOnly:!0},null,8,["modelValue","label"]),c(P,{modelValue:l(n).courses,"onUpdate:modelValue":o[17]||(o[17]=a=>
4l(n).courses=a),doctype:"User External Course",label:i.__("Courses"),autoEditGrid:!1,readOnly:!0},null,8,["modelValue","label"]),c(P,{modelValue:l(n).licences,"onUpdate:modelValue":o[18]||(o[18]=a=>l(n).licences=a),doctype:"Personnel Licence",label:i.__("Professional Licences"),autoEditGrid:!1,readOnly:!0},null,8,["modelValue","label"])])]),_:1},8,["title"]),c(Z,{title:i.__("Work Experience & References")},{default:O(()=>[_("div",Vt,[c(P,{modelValue:l(n).work_experience,"onUpdate:modelValue":o[19]||(o[19]=a=>l(n).work_experience=a),doctype:"Work Experience",label:i.__("Work Experience"),autoEditGrid:!1,readOnly:!0},null,8,["modelValue","label"]),c(P,{modelValue:l(n).work_references,"onUpdate:modelValue":o[20]||(o[20]=a=>l(n).work_references=a),doctype:"Professional Reference",label:i.__("Work References"),autoEditGrid:!1,readOnly:!0},null,8,["modelValue","label"])])]),_:1},8,["title"]),c(Z,{title:i.__("Additional Questions")},{default:O(()=>[_("div",wt,[(u(!0),y(ee,null,te(h.value,(a,s)=>(u(),y("div",{key:a.question_id,class:Y(["rounded-xl border p-5 bg-white shadow-sm transition-all",{"ml-8 border-blue-300 bg-blue-50":a.depends_on_question}])},[_("div",kt,[_("label",Ut,[F(v(s+1)+". "+v(i.__(a.question))+" ",1),a.is_required?(u(),y("span",$t,"*")):j("",!0)])]),a.help_text?(u(),y("p",Ct,v(i.__(a.help_text)),1)):j("",!0),_("div",xt,[a.question_type==="Yes/No"?(u(),C(l(U),{key:0,modelValue:t.value[a.question_id].answer,"onUpdate:modelValue":V=>t.value[a.question_id].answer=V,type:"select",options:[{label:i.__("Yes"),value:"Yes"},{label:i.__("No"),value:"No"}],readonly:!0},null,8,["modelValue","onUpdate:modelValue","options"])):a.question_type==="Text"?(u(),C(l(U),{key:1,modelValue:t.value[a.question_id].answer,"onUpdate:modelValue":V=>t.value[a.question_id].answer=V,type:"textarea",rows:12,readonly:!0},null,8,["modelValue","onUpdate:modelValue"])):a.question_type==="Date"?(u(),C(l(U),{key:2,modelValue:t.value[a.question_id].answer,"onUpdate:modelValue":V=>t.value[a.question_id].answer=V,type:"date",readonly:!0},null,8,["modelValue","onUpdate:modelValue"])):a.question_type==="Email"?(u(),C(l(U),{key:3,modelValue:t.value[a.question_id].answer,"onUpdate:modelValue":V=>t.value[a.question_id].answer=V,type:"email",readonly:!0},null,8,["modelValue","onUpdate:modelValue"])):a.question_type==="Phone"?(u(),C(l(U),{key:4,modelValue:t.value[a.question_id].answer,"onUpdate:modelValue":V=>t.value[a.question_id].answer=V,type:"text",inputmode:"tel",readonly:!0},null,8,["modelValue","onUpdate:modelValue"])):a.question_type==="Rating"?(u(),y("div",At,[_("span",St,v(t.value[a.question_id].answer||i.__("N/A")),1),t.value[a.question_id].answer?(u(),y("span",Et," / "+v(i.__(a.max_score)),1)):j("",!0)])):a.question_type==="MultiSelect"?(u(),C(ye,{key:6,modelValue:t.value[a.question_id].answer,"onUpdate:modelValue":V=>t.value[a.question_id].answer=V,options:k(a.options).map(V=>B(T({},V),{label:i.__(V.label)})),readOnly:!0},null,8,["modelValue","onUpdate:modelValue","options"])):a.question_type==="Upload"?(u(),y("div",jt,[t.value[a.question_id].attachment?(u(),y("a",{key:0,href:t.value[a.question_id].attachment,target:"_blank",class:"text-blue-600 hover:underline font-medium"},v(i.__("View Uploaded File")),9,qt)):(u(),y("span",zt,v(i.__("No file uploaded")),1))])):(u(),C(l(U),{key:8,modelValue:t.value[a.question_id].answer,"onUpdate:modelValue":V=>t.value[a.question_id].answer=V,type:"text",readonly:!0},null,8,["modelValue","onUpdate:modelValue"]))])],2))),128))])]),_:1},8,["title"])]))}},Ot={class:"space-y-6"},Pt={class:"grid grid-cols-1 gap-6"},Dt={__name:"EducationBackground",props:{form:{type:Object,required:!0}},setup(g){const t=g.form;return(k,h)=>(u(),y("div",Ot,[_("div",Pt,[c(D,{doctype:"Profession",modelValue:l(t).profession,"onUpdate:modelValue":h[0]||(h[0]=n=>l(t).profession=n),label:k.__("Profession"),class:"mt-4",required:!0},null,8,["modelValue","label"]),c(P,{modelValue:l(t).education,"onUpdate:modelValue":h[1]||(h[1]=n=>l(t).education=n),doctype:"Employee Education",label:k.__("Education History"),required:"",autoEditGrid:!1},null,8,["modelValue","label"]),c(P,{modelValue:l(t).courses,"onUpdate:modelValue":h[2]||(h[2]=n=>l(t).courses=n),doctype:"User External Course",label:k.__("Certifications and Trainings"),autoEditGrid:!1},null,8,["modelValue","label"]),c(P,{modelValue:l(t).additional_skills,"onUpdate:modelValue":h[3]||(h[3]=n=>l(t).additional_skills=n),doctype:"Additional Skill",label:k.__("Skills"),autoEditGrid:!1},null,8,["modelValue","label"]),c(P,{modelValue:l(t).licences,"onUpdate:modelValue":h[4]||(h[4]=n=>l(t).licences=n),doctype:"Personnel Licence",label:k.__("Professional Licences"),autoEditGrid:!1},null,8,["modelValue","label"])])]))}},Lt={class:"space-y-6"},Nt={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-6"},Ft={class:"text-xl font-semibold border-t pt-6 mt-6"},Mt={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"},Rt={__name:"PersonalInfo",props:{form:{type:Object,required:!0}},setup(g){const t=g.form,k=[{label:"Citizen",value:"Citizen"},{label:"Non-citizen",value:"Non-citizen"},{label:"Refugee",value:"Refugee"},{label:"Migrant",value:"Migrant"},{label:"Other",value:"Other"}],h=[{label:"Yes",value:"Yes"},{label:"No",value:"No"},{label:"Sometimes",value:"Sometimes"}];return G(()=>t.county,()=>{t.sub_county=null,t.administrative_location=null,t.ward=null}),G(()=>t.sub_county,()=>{t.administrative_location=null}),G(()=>t.citizenship,()=>{t.country_of_citizenship=null}),be(()=>ce(this,null,function*(){yield De(),t.county&&(t.county=t.county),t.sub_county&&(t.sub_county=t.sub_county),t.ward&&(t.ward=t.ward),t.country_of_citizenship&&(t.country_of_citizenship=t.country_of_citizenship),t.identification_type&&(t.identification_type=t.identification_type),t.gender&&(t.gender=t.gender)})),(n,b)=>(u(),y("div",Lt,[_("div",Nt,[c(l(U),{modelValue:l(t).phone_number,"onUpdate:modelValue":b[0]||(b[0]=d=>l(t).phone_number=d),label:n.__("Phone Number"),type:"tel",required:""},null,8,["modelValue","label"]),c(l(U),{modelValue:l(t).email_id,"onUpdate:modelValue":b[1]||(b[1]=d=>l(t).email_id=d),label:n.__("Email Address"),required:""},null,8,["modelValue","label"]),c(l(U),{modelValue:l(t).citizenship,"onUpdate:modelValue":b[2]||(b[2]=d=>l(t).citizenship=d),label:n.__("Citizenship"),type:"select",options:k.map(d=>B(T({},d),{label:n.__(d.label)})),required:""},null,8,["modelValue","label","options"]),c(D,{doctype:"Country",modelValue:l(t).country_of_citizenship,"onUpdate:modelValue":b[3]||(b[3]=d=>
4l(t).country_of_citizenship=d),label:n.__("Country of Citizenship"),filters:l(t).citizenship==="Citizen"?[["name","=","Kenya"]]:[["name","!=","Kenya"]],required:!0},null,8,["modelValue","label","filters"]),c(D,{doctype:"Identification Document Type",modelValue:l(t).identification_type,"onUpdate:modelValue":b[4]||(b[4]=d=>l(t).identification_type=d),label:n.__("Identification Document Type"),required:!0},null,8,["modelValue","label"]),c(l(U),{modelValue:l(t).id_number,"onUpdate:modelValue":b[5]||(b[5]=d=>l(t).id_number=d),label:n.__("ID Number")},null,8,["modelValue","label"]),c(D,{modelValue:l(t).gender,"onUpdate:modelValue":b[6]||(b[6]=d=>l(t).gender=d),label:n.__("Gender"),doctype:"Gender",required:!0},null,8,["modelValue","label"])]),_("h2",Ft,v(n.__("Contact & Location")),1),_("div",Mt,[c(D,{doctype:"County",modelValue:l(t).county,"onUpdate:modelValue":b[7]||(b[7]=d=>l(t).county=d),label:n.__("County")},null,8,["modelValue","label"]),l(t).county?(u(),C(D,{key:0,doctype:"Sub County",modelValue:l(t).sub_county,"onUpdate:modelValue":b[8]||(b[8]=d=>l(t).sub_county=d),label:n.__("Sub County"),filters:{county:l(t).county}},null,8,["modelValue","label","filters"])):j("",!0),c(D,{doctype:"Ward",modelValue:l(t).ward,"onUpdate:modelValue":b[9]||(b[9]=d=>l(t).ward=d),label:n.__("Ward"),filters:{county:l(t).county}},null,8,["modelValue","label","filters"]),l(t).sub_county?(u(),C(D,{key:1,doctype:"Administrative Location",modelValue:l(t).administrative_location,"onUpdate:modelValue":b[10]||(b[10]=d=>l(t).administrative_location=d),label:n.__("Location"),filters:{sub_county:l(t).sub_county}},null,8,["modelValue","label","filters"])):j("",!0),c(l(U),{modelValue:l(t).access_to_internet,"onUpdate:modelValue":b[11]||(b[11]=d=>l(t).access_to_internet=d),label:n.__("Access to Internet"),type:"select",options:h.map(d=>B(T({},d),{label:n.__(d.label)}))},null,8,["modelValue","label","options"])])]))}},Gt={class:"space-y-6"},Wt={class:"grid grid-cols-1 gap-6"},Tt={__name:"WorkExperience",props:{form:{type:Object,required:!0}},setup(g){const t=g.form;return(k,h)=>(u(),y("div",Gt,[_("div",Wt,[c(P,{modelValue:l(t).work_experience,"onUpdate:modelValue":h[0]||(h[0]=n=>l(t).work_experience=n),doctype:"Work Experience",label:k.__("Work Experience"),autoEditGrid:!1},null,8,["modelValue","label"]),c(P,{modelValue:l(t).work_references,"onUpdate:modelValue":h[1]||(h[1]=n=>l(t).work_references=n),doctype:"Professional Reference",label:k.__("Work References"),autoEditGrid:!1},null,8,["modelValue","label"])])]))}},Bt={class:"max-w-5xl mx-auto py-10 space-y-8"},Yt={key:0,class:"p-6 rounded-xl shadow-sm border border-gray-200 bg-gradient-to-r from-red-50 to-white"},Ht={class:"flex items-start gap-4"},Kt=["src","alt"],Jt={key:1,class:"w-16 h-16 flex items-center justify-center rounded-lg bg-red-100 text-red-700 font-semibold text-xl cursor-default"},Qt={class:"text-3xl font-bold text-gray-900 mb-1"},Zt={class:"text-lg font-medium text-red-600"},Xt={key:0,class:"text-sm text-gray-500 mt-1"},el={key:0},tl={key:1,class:"bg-white rounded-xl shadow-sm p-6 border border-gray-200"},ll={class:"text-2xl font-bold text-red-700 mb-6"},ol={class:"flex overflow-x-auto border-b border-gray-200 whitespace-nowrap mb-8 -mx-6 px-6 sm:mx-0 sm:px-0"},al=["onClick","disabled"],nl={key:0,class:"w-4 h-4 text-green-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},il={class:"space-y-10 min-h-[300px] bg-gray-50 rounded-xl p-6 border border-gray-200"},sl={key:0,class:"flex justify-between mt-6 pt-4 border-t border-gray-100"},rl={key:1,class:"mt-6 pt-4 border-t border-gray-100 text-lg font-medium text-gray-700"},ul={class:"text-center py-4"},dl={class:"mb-2 text-emerald-600 font-semibold flex items-center justify-center"},ml={class:"text-gray-600"},pl={key:2,class:"text-center py-20 text-gray-500"},cl={class:"text-lg font-bold text-gray-900"},_l={class:"text-gray-700 leading-relaxed"},fl={class:"mt-2 text-sm text-red-600 font-medium"},bl={class:"flex flex-col gap-3 sm:flex-row sm:justify-end"},$l={__name:"JobApplicationDetail",setup(g){var de;const f=Le(),t=Ne();Fe("$user");const k=((de=f.params)==null?void 0:de.id)||"",h=z(!0),n=z(0),b=z(-1),d=z(!1),A=z(!1),m=z(!1),i=z([]),o=W(()=>
4i.value.length?i.value.flatMap(e=>typeof e=="string"?[e]:Object.values(e).flat()):[]),a=[{step:0,formChecks:{requiredFields:["surname","email_id","phone_number","identification_type","citizenship","country_of_citizenship","id_number","gender"],customChecks:[e=>{const r=[];if(!e.identification_type||!e.id_number)return r;const p=String(e.id_number).trim(),$=e.identification_type.toLowerCase(),I={"national id":{pattern:/^\d{7,9}$/,error:"National Identity Card must be 7â9 digits."},passport:{pattern:/^[A-Z0-9]{6,9}$/i,error:"Passport number must be 6â9 characters (letters and numbers)."},"military id":{pattern:/^[A-Z0-9\-]{5,20}$/i,error:"Military ID must be 5â20 characters (letters, numbers, hyphens allowed)."},"alien id":{pattern:/^[A-Z0-9\-]{5,20}$/i,error:"Alien ID must be 5â20 characters (letters, numbers, hyphens allowed)."},"birth certificate":{pattern:/^[A-Z0-9\-]{6,20}$/i,error:"Birth Certificate number must be 6â20 characters."},"nemis number":{pattern:/^\d{8,14}$/,error:"NEMIS Number must be 8â14 digits."}}[$]||{pattern:/^[A-Z0-9\-]{5,20}$/i,error:"Identification Number must be 5â20 characters (letters, numbers, hyphens allowed)."};return I.pattern.test(p)||r.push(I.error),r}]}},{step:1,formChecks:{requiredFields:["profession"],customChecks:[e=>{var r;return(r=e.education)!=null&&r.length?[]:["Education History is required."]}]},tableChecks:{education:{label:"Education History",requiredFields:["school_univ","level","year_of_passing"],dateChecks:[{field:"year_of_passing",validation:X,error:"must be a past date."}]},additional_skills:{label:"Skills",requiredFields:["additional_skill"]},courses:{label:"Certifications",requiredFields:["course_name","institution","start_date","date_completed"],dateChecks:[{field:"start_date",validation:X,error:"must be a past date."},{field:"date_completed",validation:X,error:"must be a past date.",condition:e=>e.date_completed},{field:"date_completed",validation:(e,r)=>new Date(e)>=new Date(r.start_date),error:e=>`cannot be before Start Date (${e.start_date}).`,condition:e=>e.start_date&&e.date_completed}]},licences:{label:"Professional Licences",requiredFields:["license_type","institution","qualification","valid_from",{field:"license_name",condition:e=>e.license_type==="Other"},{field:"valid_to",condition:e=>!e.does_not_expire}],dateChecks:[{field:"valid_from",validation:fe,error:"is not valid."},{field:"valid_to",validation:fe,error:"is not valid.",condition:e=>e.valid_to&&e.does_not_expire!==1},{field:"valid_to",validation:(e,r)=>new Date(e)>new Date(r.valid_from),error:e=>`must be after Valid From (${e.valid_from}).`,condition:e=>e.valid_from&&e.valid_to&&e.does_not_expire!==1}]}}},{step:2,tableChecks:{work_experience:{label:"Work Experience",requiredFields:["title","company","location","from_date",{field:"to_date",condition:e=>!e.current}],dateChecks:[{field:"from_date",validation:X,error:"must be a past date."},{field:"to_date",validation:X,error:"must be a past date.",condition:e=>e.to_date&&!e.current},{field:"to_date",validation:(e,r)=>new Date(e)>=new Date(r.from_date),error:e=>`cannot be before From Date (${e.from_date}).`,condition:e=>e.from_date&&e.to_date&&!e.current}]},work_references:{label:"Work References",requiredFields:["reference_name","position","organization","email","phone_number"],emailChecks:[{field:"email",error:"is invalid."}],phoneChecks:[{field:"phone_number",error:"is invalid."}]}}},{step:3,validate:e=>!0}],s=[{hash:"#info",title:"Personal Info",component:J(Rt),validate:e=>{const r=a.find($=>$.step===0),p=se(e,r);return p.length?p:!0}},{hash:"#education",title:"Education & Qualifications",component:J(Dt),validate:e=>{const r=a.find($=>$.step===1),p=se(e,r);return p.length?p:!0}},{hash:"#experience",title:"Work Experience",component:J(Tt),validate:e=>{const r=a.find($=>$.step===2),p=se(e,r);return p.length?p:!0}},{hash:"#additional",title:"Additional Information",component:J(bt),validate:e=>V(e)},{hash:"#review",title:"Review & Submit",component:J(It),validate:e=>{const r=[];for(let p=0;p<s.length-1;p++){const $=s[p].validate(e);Array.isArray($)&&r.push(...$.map(L=>`[${s[p].title}] ${L}`))}return r.length?r:!0}}];function V(e){var L;const r=e.screening_question_responses||{},p=((L=q.data)==null?void 0:L.screening_questions)||[],$=[];return p.length&&p.forEach(I=>{var w;const K=Object.values(r).find(E=>E.question===I.question);let M=(w=K==null?void 0:K.answer)!=null?w:"";
4if(I.question_type==="MultiSelect"&&typeof M=="string"){const E=M.split(` 5`).map(x=>x.trim()).filter(x=>x);M=E.length>0?E:""}I.is_required&&(!M||Array.isArray(M)&&M.length===0)&&$.push(`"${I.question}" is required.`)}),e.linkedin&&(/^https?:\/\/(www\.)?linkedin\.com\/.*$/i.test(e.linkedin)||$.push("LinkedIn URL is invalid.")),e.github&&(/^https?:\/\/(www\.)?github\.com\/.*$/i.test(e.github)||$.push("GitHub URL is invalid.")),$.length?$:!0}const S=z({}),ae=z(null),re=z([]),le=z({}),H=W(()=>{var e;return((e=ne.data)==null?void 0:e.docstatus)&&ne.data.docstatus!==0}),ve=W(()=>{if(H.value){const e=s.findIndex(p=>p.hash==="#review"),r=s[e];return[B(T({},r),{originalIndex:e})]}return s.map((e,r)=>B(T({},e),{originalIndex:r}))});Q({url:"onerc_vmms.volunteer_and_member_management.api.user.get_user_details",auto:!0,onSuccess(e){e&&(le.value=e,ue(e)),h.value=!1},onError(e){R.error(e.message||"Failed to fetch user details"),h.value=!1}});const ne=Q({url:"onerc_vmms.volunteer_and_member_management.api.application.get_job_application",params:{name:k},auto:!0,onSuccess(e){if(e&&(ue(e,!0),S.value.job_application_id=e.name,ae.value=e.resume||null,re.value=e.documents||[],e.job_title&&q.update({params:{job:e.job_title}}),e.docstatus&&e.docstatus!==0)){const r=s.findIndex(p=>p.hash==="#review");r!==-1&&(n.value=r,t.replace({hash:s[r].hash}))}},onError(e){R.error(e.message||"Failed to fetch application details"),h.value=!1}}),q=Q({url:"onerc_vmms.volunteer_and_member_management.api.application.get_job_details",params:{job:k},cache:["job",k],onSuccess(e){e||(R.error("Job not found"),t.replace({name:"JobListings"}))},onError(e){R.error(e.message||"Failed to fetch job details"),t.replace({name:"JobListings"})},auto:!1}
5),he=Q({url:"onerc_vmms.volunteer_and_member_management.api.application.update_job_application"}),ge=Q({url:"onerc_vmms.volunteer_and_member_management.api.application.submit_job_application",makeParams(){return{id:k}}});function ue(e={},r=!1){const p=r?"application":"user",$=le.value||{},L={surname:["surname","last_name"],other_names:["other_names","first_name"],email_id:["email_id","email"],phone:["phone","mobile","contact"],cover_letter:["cover_letter"]},I={date_of_birth:["birth_date"],phone_number:["phone","mobile_no","mobile","contact"]};for(const w in L){let E=e[w]||L[w].map(x=>e[x]).find(x=>x!=null)||S.value[w];(E==null||E==="")&&p==="user"&&(E=$[w]||L[w].map(x=>$[x]).find(x=>x!=null)||""),S.value[w]=Array.isArray(E)?[...E]:E}const K=p==="user"?$:e;for(const w in I){if(S.value[w]!==void 0&&S.value[w]!==null&&S.value[w]!==""&&!(Array.isArray(S.value[w])&&S.value[w].length===0))continue;const E=I[w];let x=null;x=E.map(N=>K[N]).find(N=>N!=null&&N!==""),(x==null||x==="")&&r&&(x=E.map(N=>$[N]).find(N=>N!=null&&N!=="")),x!=null&&(S.value[w]=x)}const M=p==="user"?$:e;for(const w in M){const E=M[w];(L[w]||I[w]||S.value[w]===void 0||S.value[w]===null||S.value[w]===""||Array.isArray(S.value[w])&&S.value[w].length===0)&&!L[w]&&!I[w]&&(S.value[w]=Array.isArray(E)?[...E]:E)}}const ie=e=>{if(H.value){const r=s.findIndex(p=>p.hash==="#review");e===r?(n.value=e,t.replace({hash:s[e].hash})):R.error("This submitted application is read-only and can only view the Review tab.");return}if(e<=n.value){n.value=e,t.replace({hash:s[e].hash}),d.value=!1;return}if(e>b.value+1){R.error("Please complete the previous step first.");return}n.value=e,t.replace({hash:s[e].hash}),d.value=!1},Ve=()=>{n.value>0&&ie(n.value-1)};be(()=>{const e=f.hash||"#info",r=s.findIndex(p=>p.hash===e);n.value=r>=0?r:0,(!f.hash||f.hash!==s[n.value].hash)&&t.replace({hash:s[n.value].hash})}),G(()=>f.hash,e=>{const r=s.findIndex(p=>p.hash===e);r>=0&&(n.value=r)}),G(()=>ne.data,e=>{e&&e.job_title&&(q.update({params:{job:e.job_title}}),q.reload())},{deep:!0});const we=()=>{const r=s[n.value].validate(S.value,ae.value,le.value);if(r!==!0){i.value=Array.isArray(r)?r:[r],A.value=!0;return}n.value<s.length-1?ke():m.value=!0},ke=()=>{d.value=!0,he.submit(B(T({id:k},S.value),{resume:ae.value,documents:re.value}),{onSuccess:e=>{S.value.job_application_id=(e==null?void 0:e.name)||(e==null?void 0:e.application_id),b.value=Math.max(b.value,n.value),R.success("Application stage saved successfully."),ie(n.value+1)},onError:e=>{var r;return R.error(((r=e.messages)==null?void 0:r[0])||"Failed to save application stage.")},onSettled:()=>d.value=!1})},Ue=()=>{d.value=!0,ge.submit({id:k},{onSuccess:e=>{e!=null&&e.error,window.location.reload()},onError:e=>{var r;R.error(((r=e.messages)==null?void 0:r[0])||"Failed to submit application."),window.location.reload()},onSettled:()=>d.value=!1})},$e=e=>window.open(e,"_blank"),Ce=e=>e?e.split(" ").map(r=>r[0]).join("").slice(0,2).toUpperCase():"NA";return Me({title:"Job Application Details | Kenya Red Cross ",meta:[{name:"description",content:"View and manage your job application details for Kenya Red Cross opportunities. Track your application status and updates."}]}),(e,r)=>(u(),y("div",Bt,[l(q).data?(u(),y("div",Yt,[_("div",Ht,[_("div",null,[l(q).data.company_logo?(u(),y("img",{key:0,src:l(q).data.company_logo,class:"w-16 h-16 rounded-lg object-contain cursor-pointer bg-gray-50 border",alt:e.__(l(q).data.company),onClick:r[0]||(r[0]=p=>$e(l(q).data.company_website))},null,8,Kt)):(u(),y("div",Jt,v(e.__(Ce(l(q).data.company))),1))]),_("div",null,[_("h1",Qt,v(e.__(l(q).data.job_title)),1),_("div",Zt,v(e.__(l(q).data.company)),1),l(q).data.location||l(q).data.country?(u(),y("div",Xt,[F(v(e.__(l(q).data.location)),1),l(q).data.country?(u(),y("span",el,v(e.__(", "))+v(e.__(l(q).data.country)),1)):j("",!0)])):j("",!0)])])])):j("",!0),h.value?(u(),y("div",pl,v(e.__("Loading application details...")),1)):(u(),y("div",tl,[_("h2",ll,v(e.__("Apply for this Opportunity")),1),_("div",ol,[(u(!0),y(ee,null,te(ve.value,(p,$)=>(u(),y("button",{key:$,onClick:L=>ie(p.originalIndex),disabled:p.originalIndex>b.value+1&&p.originalIndex>n.value&&!H.value,class:Y(["py-3 px-3 sm:px-5 text-sm sm:text-base font-semibold transition-all duration-200 ease-in-out flex-shrink-0 flex items-center gap-2 border-b-4",n.value===p.originalIndex?"border-red-600 text-red-700 bg-red-50/50":p.originalIndex<n.value?"border-green-600 text-green-600 hover:text-red-500 hover:border-red-200":p.originalIndex<=b.value+1?"border-gray-200 text-gray-600 hover:text-red-600 hover:border-red-300":"border-gray-100 text-gray-400 cursor-not-allowed"])},[p.originalIndex<n.value&&!H.value?(u(),y("svg",nl,[...r[4]||(r[4]=[_("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1)])])):j("",!0),F(" "+v(e.__(p.title)),1)],10,al))),128))]),_("div",il,[(u(),C(We(s[n.value].component),Re(Ge({form:S.value,
5job:l(q).data,user:le.value,isReadonly:H.value})),null,16))]),H.value?(u(),y("div",rl,[_("div",ul,[_("div",dl,[r[6]||(r[6]=_("svg",{class:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[_("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"})],-1)),F(" "+v(e.__("Application Successfully Submitted")),1)]),_("p",ml,v(e.__("Thank you for your application. You can review your submitted details here.")),1)])])):(u(),y("div",sl,[n.value>0?(u(),C(l(oe),{key:0,variant:"subtle",onClick:Ve,class:"text-gray-700 hover:bg-gray-100"},{default:O(()=>[F(v(e.__("â Back")),1)]),_:1})):j("",!0),r[5]||(r[5]=_("div",{class:"flex-grow"},null,-1)),c(l(oe),{variant:"solid",loading:d.value,onClick:we,class:"!bg-red-700 hover:bg-red-800 text-white px-6 py-3 rounded-lg ml-auto"},{default:O(()=>[F(v(n.value<s.length-1?e.__("Save & Continue"):e.__("Submit Application")),1)]),_:1},8,["loading"])]))])),c(l(Be),{modelValue:m.value,"onUpdate:modelValue":r[2]||(r[2]=p=>m.value=p)},{"body-title":O(()=>[_("h2",cl,v(e.__("Confirm Submission")),1)]),"body-content":O(()=>[_("p",_l,v(e.__("Are you sure you want to submit this application?")),1),_("p",fl,v(e.__("You won't be able to make further edits after submission.")),1)]),actions:O(()=>[_("div",bl,[c(l(oe),{variant:"outline",class:"w-full sm:w-auto py-3",onClick:r[1]||(r[1]=p=>m.value=!1)},{default:O(()=>[F(v(e.__("Cancel")),1)]),_:1}),c(l(oe),{variant:"solid",class:"w-full sm:w-auto bg-red-700 hover:bg-red-800 text-white py-3",loading:d.value,onClick:Ue},{prefix:O(()=>[c(l(Te),{name:"check-circle",class:"w-4"})]),default:O(()=>[F(" "+v(d.value?e.__("Submitting..."):e.__("Submit")),1)]),_:1},8,["loading"])])]),_:1},8,["modelValue"]),c(He,{modelValue:A.value,"onUpdate:modelValue":r[3]||(r[3]=p=>A.value=p),errors:o.value},null,8,["modelValue","errors"])]))}};export{$l as default}; 6//# sourceMappingURL=JobApplicationDetail-BVMQqMsM.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.