3 lines
9.8 KiB
JavaScript
3 lines
9.8 KiB
JavaScript
import{d as B,P as J,a as S,s as F,g as L,r as d,j as s,L as $,I as n,K as g,a6 as w,B as v,T as D,l as I}from"./index-BTPmxtwM.js";import{a as M}from"./Chart-BGHtrE8S.js";import{D as R}from"./DataTable-D5imKbZq.js";import{M as E}from"./Modal-B8aWFZt2.js";const T=["Select Job","Approval","Platforms","Publish"];function K(){const{toast:c}=B(),b=J(),{data:t=[]}=S(F("publishings")),{data:f=[]}=S(F("jobs")),N=L("publishings"),[x,j]=d.useState(null);d.useEffect(()=>{var e;(e=b.state)!=null&&e.publishJob&&j({jobId:b.state.publishJob})},[b.state]);const i=d.useMemo(()=>t.reduce((e,l)=>({views:e.views+l.views,clicks:e.clicks+l.clicks,apps:e.apps+l.apps}),{views:0,clicks:0,apps:0}),[t]),u=i.views?(i.apps/i.views*100).toFixed(1):"0",m=d.useMemo(()=>{const e={};for(const l of t)e[l.platform]||(e[l.platform]={views:0,clicks:0,apps:0,jobs:0}),e[l.platform].views+=l.views,e[l.platform].clicks+=l.clicks,e[l.platform].apps+=l.apps,e[l.platform].jobs+=1;return Object.entries(e).sort((l,h)=>h[1].apps-l[1].apps)},[t]),y=d.useMemo(()=>({labels:m.map(e=>e[0]),data:m.map(e=>e[1].apps)}),[m]),r=[{key:"jobTitle",label:"Job",sortable:!0,render:e=>s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"cell-primary",children:e.jobTitle}),s.jsx("div",{className:"cell-sub",children:e.jobId})]})},{key:"platform",label:"Platform",sortable:!0,render:e=>{const l=w.find(h=>h.name===e.platform)||{};return s.jsxs("span",{className:"flex items-center gap-8",children:[s.jsx("span",{className:"platform-logo",style:{width:26,height:26,background:l.color||"#888"},children:s.jsx(n,{name:l.icon||"briefcase"})}),e.platform]})}},{key:"status",label:"Status",sortable:!0,render:e=>s.jsx(v,{className:e.status==="Live"?"b-green":e.status==="Paused"?"b-amber":"b-blue",children:e.status})},{key:"views",label:"Views",sortable:!0,align:"right",render:e=>e.views.toLocaleString()},{key:"clicks",label:"Clicks",sortable:!0,align:"right",render:e=>e.clicks.toLocaleString()},{key:"apps",label:"Applications",sortable:!0,align:"right",render:e=>s.jsx("b",{children:e.apps})},{key:"_conv",label:"Conversion",sortable:!0,sortValue:e=>e.views?e.apps/e.views:0,render:e=>s.jsxs("span",{className:"badge b-indigo badge-plain",children:[e.views?(e.apps/e.views*100).toFixed(1):"0.0","%"]})},{key:"_a",label:"",align:"right",render:e=>s.jsx("button",{className:"act-btn","data-tip":"Manage",onClick:()=>c(`Managing ${e.platform} posting`,"info"),children:s.jsx(n,{name:"external"})})}];return s.jsxs("div",{className:"page",children:[s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Job Board"}),s.jsx("p",{className:"page-sub",children:"Publish requisitions across channels and track performance"})]}),s.jsxs("div",{className:"page-head-actions",children:[s.jsxs($,{className:"btn btn-secondary",to:"/analytics",children:[s.jsx(n,{name:"trending-up"})," Analytics"]}),s.jsxs("button",{className:"btn btn-primary",onClick:()=>j({}),children:[s.jsx(n,{name:"send"})," Publish a Job"]})]})]}),s.jsxs("div",{className:"grid g-kpi mb-18",children:[s.jsx(g,{label:"Total Views",value:i.views.toLocaleString(),icon:"eye",tone:"i-blue",foot:"across all platforms"}),s.jsx(g,{label:"Total Clicks",value:i.clicks.toLocaleString(),icon:"target",tone:"i-purple",foot:`${i.views?(i.clicks/i.views*100).toFixed(1):"0.0"}% CTR`}),s.jsx(g,{label:"Applications",value:i.apps.toLocaleString(),icon:"users",tone:"i-green",foot:"from job boards"}),s.jsx(g,{label:"Conversion Rate",value:`${u}%`,icon:"trending-up",tone:"i-teal",foot:"view → application"})]}),s.jsxs("div",{className:"grid g-2-1 mb-18",children:[s.jsxs("div",{className:"card",children:[s.jsx("div",{className:"card-head",children:s.jsxs("div",{children:[s.jsx("h3",{children:"Platform Performance"}),s.jsx("span",{className:"ch-sub",children:"Applications by channel"})]})}),s.jsx("div",{className:"card-body",children:s.jsx("div",{className:"chart-wrap",children:s.jsx(M,{type:"horizontalBar",data:y,height:300})})})]}),s.jsxs("div",{className:"card",children:[s.jsx("div",{className:"card-head",children:s.jsx("div",{children:s.jsx("h3",{children:"Connected Platforms"})})}),s.jsx("div",{className:"card-body",children:s.jsx("div",{className:"list-tight",children:w.map(e=>s.jsxs("div",{className:"list-row",children:[s.jsx("span",{className:"platform-logo",style:{background:e.color},children:s.jsx(n,{name:e.icon})}),s.jsxs("div",{className:"lr-main",children:[s.jsx("div",{className:"lr-title",children:e.name}),s.jsx("div",{className:"lr-sub",children:e.cost==="Free"?"Free posting":`Paid · ${e.cost}`})]}),e.connected?s.jsx(v,{className:"b-green",children:"Connected"}):s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>c(`Connecting ${e.name}…`,"info"),children:"Connect"})]},e.name))})})]})]}),s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-head",children:[s.jsxs("div",{children:[s.jsx("h3",{children:"Active Postings"}),s.jsxs("span",{className:"ch-sub",children:[t.length," live postings across ",m.length," platforms"]})]}),s.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>c("Performance report exported","success"),children:[s.jsx(n,{name:"download"})," Export"]})]}),s.jsx(R,{columns:r,rows:t,pageSize:8})]}),x&&s.jsx(z,{jobs:f,initialJobId:x.jobId,onClose:()=>j(null),onPublish:(e,l)=>{N(h=>[...l.map(k=>({jobId:e.id,jobTitle:e.title,platform:k,status:"Live",views:I(0,30),clicks:0,apps:0,published:new Date(D)})),...h])},toast:c})]})}function z({jobs:c,initialJobId:b,onClose:t,onPublish:f,toast:N}){var P,C;const x=c.filter(a=>a.status!=="Draft"),j=c.filter(a=>a.status==="Open"),[i,u]=d.useState(1),[m,y]=d.useState(b||((P=j[0])==null?void 0:P.id)||((C=x[0])==null?void 0:C.id)),[r,e]=d.useState(["Career Portal"]),l=c.find(a=>a.id===m);function h(){if(i===3){if(!r.length){N("Select at least one platform","warning");return}f(l,r)}u(a=>a+1)}function k(a){e(o=>o.includes(a)?o.filter(p=>p!==a):[...o,a])}return s.jsxs(E,{title:"Publish Job",subtitle:"Distribute this requisition to job boards",size:"modal-lg",onClose:t,footer:i===4?s.jsxs("button",{className:"btn btn-primary",onClick:t,children:[s.jsx(n,{name:"check"})," Done"]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>i===1?t():u(a=>a-1),children:i===1?"Cancel":"Back"}),s.jsx("button",{className:"btn btn-primary",onClick:h,children:i===3?s.jsxs(s.Fragment,{children:[s.jsx(n,{name:"send"})," Publish"]}):"Continue"})]}),children:[s.jsx("div",{className:"stepper",children:T.map((a,o)=>{const p=o+1,A=p<i?"done":p===i?"active":"";return s.jsxs("div",{style:{display:"contents"},children:[s.jsxs("div",{className:`step ${A}`,children:[s.jsx("div",{className:"step-num",children:p<i?"✓":p}),s.jsx("div",{className:"step-label",children:a})]}),o<T.length-1&&s.jsx("div",{className:`step-line ${p<i?"done":""}`})]},a)})}),i===1&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"form-field",children:[s.jsx("label",{children:"Select requisition to publish"}),s.jsx("select",{value:m,onChange:a=>y(a.target.value),children:x.map(a=>s.jsxs("option",{value:a.id,children:[a.title," · ",a.id]},a.id))})]}),l&&s.jsx("div",{className:"card",style:{boxShadow:"none",background:"var(--bg-sunken)",marginTop:16},children:s.jsx("div",{className:"card-body",children:s.jsxs("div",{className:"flex items-center gap-12",children:[s.jsx("span",{className:"kpi-icn i-indigo",style:{width:44,height:44,borderRadius:12},children:s.jsx(n,{name:"briefcase"})}),s.jsxs("div",{children:[s.jsx("div",{className:"fw-600",children:l.title}),s.jsxs("div",{className:"cell-sub",children:[l.department," · ",l.location," · ",l.type]})]})]})})})]}),i===2&&s.jsx("div",{className:"card",style:{boxShadow:"none",background:"var(--bg-sunken)"},children:s.jsxs("div",{className:"card-body",children:[s.jsxs("div",{className:"flex items-center gap-12",style:{marginBottom:14},children:[s.jsx("span",{className:"kpi-icn i-green",style:{width:44,height:44,borderRadius:12},children:s.jsx(n,{name:"check-circle"})}),s.jsxs("div",{children:[s.jsx("div",{className:"fw-600",children:"Approval granted"}),s.jsx("div",{className:"cell-sub",children:"Approved by Department Head · Budget confirmed"})]})]}),["Hiring Manager sign-off","Finance budget approval","Compliance review"].map((a,o)=>s.jsxs("div",{className:"setting-row",style:{padding:"10px 0",...o===2?{border:"none"}:{}},children:[s.jsx("div",{className:"setting-info",children:s.jsx("h4",{children:a})}),s.jsx(v,{className:"b-green",children:"Approved"})]},a))]})}),i===3&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-muted",style:{marginBottom:14},children:"Select the platforms to publish this role to"}),s.jsx("div",{className:"grid g-2",children:w.map(a=>s.jsxs("div",{className:`platform-card${r.includes(a.name)?" selected":""}${a.connected?"":" disabled"}`,style:a.connected?void 0:{opacity:.5,pointerEvents:"none"},onClick:()=>k(a.name),children:[s.jsx("span",{className:"platform-logo",style:{background:a.color},children:s.jsx(n,{name:a.icon})}),s.jsxs("div",{style:{flex:1},children:[s.jsx("div",{className:"fw-600",children:a.name}),s.jsx("div",{className:"cell-sub",children:a.cost==="Free"?"Free":`Paid · ${a.cost}`})]}),s.jsx("span",{className:"platform-check",children:s.jsx(n,{name:"check"})})]},a.name))})]}),i===4&&s.jsxs("div",{style:{textAlign:"center",padding:"20px 0"},children:[s.jsx("div",{className:"kpi-icn i-green",style:{width:64,height:64,borderRadius:18,margin:"0 auto 16px"},children:s.jsx(n,{name:"check-circle"})}),s.jsx("h2",{style:{fontSize:20,marginBottom:6},children:"Published Successfully"}),s.jsxs("p",{className:"text-muted",style:{marginBottom:20},children:[l==null?void 0:l.title," is now live on ",r.length," platform",r.length>1?"s":""]}),s.jsx("div",{className:"flex gap-8",style:{justifyContent:"center",flexWrap:"wrap"},children:r.map(a=>s.jsx(v,{className:"b-green",children:a},a))})]})]})}export{K as default};
|
|
//# sourceMappingURL=JobBoard-Bi41FSXk.js.map
|