1import{u as E,y as J,X as K,b as q,S as G,r as Q,e as z,z as ee,A as te,l as g,o as _,i as M,h as Y,g as f,L as ne,t as l,w as F,j as p,_ as se,p as C,F as re,m as ae,f as oe,B as ie}from"./index-DkHxERqz.js";import{T as le}from"./TabButtons-BAUbJQbv.js";import{a as ce}from"./sanitizeHtml-BbWx3ulo.js";import{t as N,c as V,n as A,g as ue,e as de,a as R,m as X,b as j,d as B,h as P,f as fe}from"./format-BkWISJ_x.js";import"./form-mfsyIw-y.js";function L(n,e){const t=+N(n)-+N(e);return t<0?-1:t>0?1:t}function me(n){return V(n,Date.now())}function _e(n,e,t){const[a,r]=A(t==null?void 0:t.in,n,e),u=a.getFullYear()-r.getFullYear(),c=a.getMonth()-r.getMonth();return u*12+c}function ge(n){return e=>{const a=(n?Math[n]:Math.trunc)(e);return a===0?0:a}}function he(n,e){return+N(n)-+N(e)}function ye(n,e){const t=N(n,e==null?void 0:e.in);return t.setHours(23,59,59,999),t}function be(n,e){const t=N(n,e==null?void 0:e.in),a=t.getMonth();return t.setFullYear(t.getFullYear(),a+1,0),t.setHours(23,59,59,999),t}function De(n,e){const t=N(n,e==null?void 0:e.in);return+ye(t,e)==+be(t,e)}function ve(n,e,t){const[a,r,u]=A(t==null?void 0:t.in,n,n,e),c=L(r,u),o=Math.abs(_e(r,u));if(o<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-c*o);let b=L(r,u)===-c;De(a)&&o===1&&L(a,u)===1&&(b=!1);const v=c*(o-+b);return v===0?0:v}function xe(n,e,t){const a=he(n,e)/1e3;return ge(t==null?void 0:t.roundingMethod)(a)}function Me(n,e,t){var s,d;const a=ue(),r=(d=(s=t==null?void 0:t.locale)!=null?s:a.locale)!=null?d:de,u=2520,c=L(n,e);if(isNaN(c))throw new RangeError("Invalid time value");const o=Object.assign({},t,{addSuffix:t==null?void 0:t.addSuffix,comparison:c}),[b,v]=A(t==null?void 0:t.in,...c>0?[e,n]:[n,e]),m=xe(v,b),x=(R(v)-R(b))/1e3,y=Math.round((m-x)/60);let w;if(y<2)return t!=null&&t.includeSeconds?m<5?r.formatDistance("lessThanXSeconds",5,o):m<10?r.formatDistance("lessThanXSeconds",10,o):m<20?r.formatDistance("lessThanXSeconds",20,o):m<40?r.formatDistance("halfAMinute",0,o):m<60?r.formatDistance("lessThanXMinutes",1,o):r.formatDistance("xMinutes",1,o):y===0?r.formatDistance("lessThanXMinutes",1,o):r.formatDistance("xMinutes",y,o);if(y<45)return r.formatDistance("xMinutes",y,o);if(y<90)return r.formatDistance("aboutXHours",1,o);if(y<X){const D=Math.round(y/60);return r.formatDistance("aboutXHours",D,o)}else{if(y<u)return r.formatDistance("xDays",1,o);if(y<j){const D=Math.round(y/X);return r.formatDistance("xDays",D,o)}else if(y<j*2)return w=Math.round(y/j),r.formatDistance("aboutXMonths",w,o)}if(w=ve(v,b),w<12){const D=Math.round(y/j);return r.formatDistance("xMonths",D,o)}else{const D=w%12,T=Math.trunc(w/12);return D<3?r.formatDistance("aboutXYears",T,o):D<9?r.formatDistance("overXYears",T,o):r.formatDistance("almostXYears",T+1,o)}}function H(n,e){return Me(n,me(n),e)}function O(n,e){var v;const t=()=>V(e==null?void 0:e.in,NaN),a=(v=e==null?void 0:e.additionalDigits)!=null?v:2,r=Ce(n);let u;if(r.date){const m=ke(r.date,a);u=pe(m.restDateString,m.year)}if(!u||isNaN(+u))return t();const c=+u;let o=0,b;if(r.time&&(o=Se(r.time),isNaN(o)))return t();if(r.timezone){if(b=je(r.timezone),isNaN(b))return t()}else{const m=new Date(c+o),x=N(0,e==null?void 0:e.in);return x.setFullYear(m.getUTCFullYear(),m.getUTCMonth(),m.getUTCDate()),x.setHours(m.getUTCHours(),m.getUTCMinutes(),m.getUTCSeconds(),m.getUTCMilliseconds()),x}return N(c+o+b,e==null?void 0:e.in)}const I={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},we=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Te=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Ne=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Ce(n){const e={},t=n.split(I.dateTimeDelimiter);let a;if(t.length>2)return e;if(/:/.test(t[0])?a=t[0]:(e.date=t[0],a=t[1],I.timeZoneDelimiter.test(e.date)&&(e.date=n.split(I.timeZoneDelimiter)[0],a=n.substr(e.date.length,n.length))),a){const r=I.timezone.exec(a);r?(e.time=a.replace(r[1],""),e.timezone=r[1]):e.time=a}return e}function ke(n,e){const t=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),a=n.match(t);if(!a)return{year:NaN,restDateString:""};const r=a[1]?parseInt(a[1]):null,u=a[2]?parseInt(a[2]):null;return{year:u===null?r:u*100,restDateString:n.slice((a[1]||a[2]).length)}}function pe(n,e){if(e===null)return new Date(NaN);const t=n.match(we);if(!t)return new Date(NaN);const a=!!t[4],r=S(t[1]),u=S(t[2])-1,c=S(t[3]),o=S(t[4]),b=S(t[5])-1;if(a)return Ue(e,o,b)?Ie(e,o,b):new Date(NaN);{const v=new Date(0);return!Ye(e,u,c)||!Oe(e,r)?new Date(NaN):(v.setUTCFullYear(e,u,Math.max(r,c)),v)}}function S(n){return n?parseInt(n):1}function Se(n){const e=n.match(Te);if(!e)return NaN;const t=U(e[1]),a=U(e[2]),r=U(e[3]);return Ae(t,a,r)?t*B+a*P+r*1e3:NaN}function U(n){return n&&parseFloat(n.replace(",","."))||0}function je(n){if(n==="Z")return 0;const e=n.match(Ne);if(!e)return 0;const t=e[1]==="+"?-1:1,a=parseInt(e[2]),r=e[3]&&parseInt(e[3])||0;return ze(a,r)?t*(a*B+r*P):NaN}function Ie(n,e,t){const a=new Date(0);a.setUTCFullYear(n,0,4);const r=a.getUTCDay()||7,u=(e-1)*7+t+1-r;
1return a.setUTCDate(a.getUTCDate()+u),a}const Le=[31,null,31,30,31,30,31,31,30,31,30,31];function Z(n){return n%400===0||n%4===0&&n%100!==0}function Ye(n,e,t){return e>=0&&e<=11&&t>=1&&t<=(Le[e]||(Z(n)?29:28))}function Oe(n,e){return e>=1&&e<=(Z(n)?366:365)}function Ue(n,e,t){return e>=1&&e<=53&&t>=0&&t<=6}function Ae(n,e,t){return n===24?e===0&&t===0:t>=0&&t<60&&e>=0&&e<60&&n>=0&&n<25}function ze(n,e){return e>=0&&e<=59}const Fe={class:"w-full mx-auto py-2 px-1"},Re={key:0,class:"text-center py-20"},Xe={class:"text-3xl font-bold text-gray-900 mb-4"},He={class:"text-gray-600 mb-8"},Ve={key:1},Be={class:"text-3xl font-bold text-gray-900 mb-8"},Pe={key:0,class:"text-center py-20"},Ze={class:"text-gray-500"},$e={key:1,class:"text-center py-20"},We={class:"text-gray-500"},Ee={key:2},Je={key:0,class:"mb-6"},Ke={key:1,class:"grid grid-cols-1 md:grid-cols-2 gap-6"},qe={class:"flex items-start gap-4"},Ge=["src"],Qe={key:1,class:"w-14 h-14 flex items-center justify-center rounded-lg bg-red-100 text-red-700 font-bold"},et={class:"flex-1"},tt={class:"flex justify-between items-start"},nt={class:"text-xl font-bold text-gray-900"},st={class:"text-red-700 font-medium"},rt={key:0,class:"text-gray-500 text-sm"},at={class:"mt-4 text-sm text-gray-600"},ot={class:"mt-1 text-sm text-gray-600"},it={key:0,class:"mt-4 p-3 bg-gray-50 rounded-lg text-sm text-gray-700"},lt=["innerHTML"],ct={key:1,class:"mt-4 border-t pt-4 text-sm text-gray-700"},ut={key:0},dt={key:1},ft={key:2},mt={key:3,class:"mt-2"},_t={key:2,class:"text-center py-20 text-gray-500"},vt={__name:"JobApplication",setup(n){const e=s=>{if(!s)return"";const d=s.substring(0,150)+(s.length>150?"...":"");return ce(d)},{userResource:t}=E(),{isLoggedIn:a}=J(),r=t,u=K(),c=q({url:"onerc_vmms.volunteer_and_member_management.api.application.fetch_applications",makeParams(){var s;return{email:(s=r.data)==null?void 0:s.email}},auto:!1});G(()=>{var s;return(s=r.data)==null?void 0:s.email},s=>{s&&c.reload()},{immediate:!0});const o=()=>u.push({name:"Login"}),b=s=>s?s.split(" ").map(d=>d[0]).join("").slice(0,2).toUpperCase():"NA",v=(s,d)=>{if(d===0)return"bg-gray-200 text-gray-800";if(d===2)return"bg-red-200 text-red-800";switch(s==null?void 0:s.toLowerCase()){case"open":return"bg-green-100 text-green-700";case"accepted":return"bg-blue-100 text-blue-700";case"closed":return"bg-red-100 text-red-700";case"in progress":case"under review":return"bg-yellow-100 text-yellow-700";default:return"bg-gray-100 text-gray-700"}},m=s=>{try{return fe(O(s),"PPP")}catch(d){return s}},x=Q(null),y=z(()=>{if(!c.data)return[];const s=[];c.data.some(h=>h.docstatus===0)&&s.push({label:"Draft",value:"Draft"});const d=c.data.filter(h=>h.docstatus===1),D=[...new Set(d.map(h=>h.status).filter(Boolean))],T={open:1,"in progress":2,"under review":3,accepted:4,closed:5};return D.sort((h,k)=>{const $=h==null?void 0:h.toLowerCase(),W=k==null?void 0:k.toLowerCase();return(T[$]||99)-(T[W]||99)}).forEach(h=>{s.push({label:h.charAt(0).toUpperCase()+h.slice(1),value:h})}),c.data.some(h=>h.docstatus===2)&&s.push({label:"Cancelled",value:"Cancelled"}),!x.value&&s.length&&(x.value=s[0].value),s}),w=z(()=>{if(!c.data||!x.value)return[];const s=x.value.toLowerCase();return s==="draft"?c.data.filter(d=>d.docstatus===0):s==="cancelled"?c.data.filter(d=>d.docstatus===2):c.data.filter(d=>{var D;return d.docstatus===1&&((D=d.status)==null?void 0:D.toLowerCase())===s})});return ee({title:"My Applications | Kenya Red Cross VMMS",meta:[{name:"description",content:"Track and manage all your applications for Kenya Red Cross job and volunteer opportunities. View application status, details, and history."}]}),(s,d)=>{var T;const D=te("router-link");return _(),g("div",Fe,[M(a)?(_(),g("div",Ve,[f("h1",Be,l(s.__("My Applications")),1),M(c).loading?(_(),g("div",Pe,[f("p",Ze,l(s.__("Loading applications...")),1)])):(T=M(c).data)!=null&&T.length?(_(),g("div",Ee,[y.value.length?(_(),g("div",Je,[Y(M(le),{modelValue:x.value,"onUpdate:modelValue":d[0]||(d[0]=i=>x.value=i),buttons:y.value,class:"w-full sm:w-auto","active-class":"bg-red-600 text-white","inactive-class":"text-gray-700 hover:bg-gray-100"},null,8,["modelValue","buttons"])])):C("",!0),w.value.length?(_(),g("div",Ke,[(_(!0),g(re,null,ae(w.value,i=>(_(),oe(D,{key:i.name,to:{name:"JobApplicationDetail",params:{id:i.name}},class:"flex flex-col bg-gradient-to-br from-white via-red-50 to-red-100 border border-red-200 rounded-2xl p-6 h-full shadow-md hover:shadow-lg transition-all duration-300"},{default:F(()=>{var h,k;return[f("div",qe,[f("div",null,[(h=i.job_opening_details)!=null&&h.company_logo?(_(),g("img",{key:0,src:i.job_opening_details.company_logo,class:"w-14 h-14 roun
1ded-lg object-contain bg-gray-50 border"},null,8,Ge)):(_(),g("div",Qe,l(s.__(b(i.company))),1))]),f("div",et,[f("div",tt,[f("h2",nt,l(s.__(((k=i==null?void 0:i.job_opening_details)==null?void 0:k.job_title)||i.job_title)),1),f("span",{class:ie(["px-3 py-1 text-xs font-semibold rounded-full",v(i.status,i.docstatus)])},l(i.docstatus===2?s.__("Cancelled"):i.docstatus===0?s.__("Draft"):s.__(i.status)),3)]),f("p",st,l(s.__(i.company)),1),i.designation?(_(),g("p",rt,[f("strong",null,l(s.__("Designation"))+":",1),p(" "+l(s.__(i.designation)),1)])):C("",!0)])]),f("div",at,l(s.__("Applied"))+" "+l(M(H)(M(O)(i.creation),{addSuffix:!0})),1),f("div",ot,l(s.__("Modified"))+" "+l(M(H)(M(O)(i.modified),{addSuffix:!0})),1),i.cover_letter?(_(),g("div",it,[f("strong",null,l(s.__("Cover Letter"))+":",1),f("div",{innerHTML:e(i.cover_letter)},null,8,lt)])):C("",!0),i.job_opening_details?(_(),g("div",ct,[i.job_opening_details.job_status?(_(),g("p",ut,[f("strong",null,l(s.__("Opportunity Status"))+":",1),p(" "+l(s.__(i.job_opening_details.job_status)),1)])):C("",!0),i.job_opening_details.posted_on?(_(),g("p",dt,[f("strong",null,l(s.__("Posted On"))+":",1),p(" "+l(m(i.job_opening_details.posted_on)),1)])):C("",!0),i.job_opening_details.closes_on?(_(),g("p",ft,[f("strong",null,l(s.__("Closes On"))+":",1),p(" "+l(m(i.job_opening_details.closes_on)),1)])):C("",!0),i.job_opening_details.job_description?(_(),g("p",mt,[f("strong",null,l(s.__("Description"))+":",1),p(" "+l(s.__(i.job_opening_details.job_description)),1)])):C("",!0)])):C("",!0)]}),_:2},1032,["to"]))),128))])):(_(),g("div",_t,l(s.__("No applications found under"))+' "'+l(s.__(x.value))+'" '+l(s.__("status.")),1))])):(_(),g("div",$e,[f("p",We,l(s.__("You haven't applied for any opportunities yet.")),1)]))])):(_(),g("div",Re,[Y(M(ne),{class:"w-16 h-16 text-gray-500 mx-auto mb-4"}),f("h2",Xe,l(s.__("Authentication Required")),1),f("p",He,l(s.__("Please log in to access your opportunity application details. Your application information is protected and only available to authenticated users.")),1),Y(M(se),{variant:"solid",class:"bg-red-700 hover:bg-red-800 text-white px-6 py-3 rounded-lg",onClick:o},{default:F(()=>[p(l(s.__("Log In")),1)]),_:1})]))])}}};export{vt as default}; 2//# sourceMappingURL=JobApplication-BHLpc75k.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.