PageSourceSearch

https://vizops360.ai/assets/itSessionStore-Druxnl8E.js

js vizops360.ai collected 2026-10-05 13:52:19 UTC 2,114 bytes, 1 lines download raw bytes

1import{aP as p,aQ as S}from"./index-CpeGhXo5.js";const l=o=>{if(o.sessionStatus==="Completed")return"Completed";if(o.sessionStatus==="Scheduled"&&o.scheduledDate&&new Date(o.scheduledDate)>new Date)return"Scheduled";const i=o.joinedDate;return i&&Math.floor((Date.now()-new Date(i).getTime())/864e5)>14?"Overdue":"Pending"},D=p()(S((o,i)=>({sessions:[],syncFromEmployees:n=>{const s=i().sessions,d=new Set(s.map(e=>e.employeeId)),a=new Date().toISOString(),t=[];for(const e of n){if(d.has(e.id))continue;const c=e.joinedDate||e.dateOfJoining||e.createdAt,r=[e.firstName,e.lastName].filter(Boolean).join(" ")||"Unknown",m=(c?Math.floor((Date.now()-new Date(c).getTime())/(1e3*60*60*24)):0)>14?"Overdue":"Pending";t.push({id:`ITS-${e.id}-${Date.now()}`,employeeId:e.id,employeeName:r,empCode:e.empCode,department:e.department,designation:e.designation,joinedDate:c,sessionStatus:m,createdAt:a,updatedAt:a})}t.length>0&&o({sessions:[...s,...t]});const u=i().sessions.map(e=>{if(e.sessionStatus==="Completed")return e;const c=l(e);return c!==e.sessionStatus?{...e,sessionStatus:c,updatedAt:a}:e});o({sessions:u})},getSessionForEmployee:n=>i().sessions.find(s=>s.employeeId===n),addSession:n=>{const s=new Date().toISOString(),d={...n,id:`ITS-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,createdAt:s,updatedAt:s};return o({sessions:[d,...i().sessions]}),d},updateSession:(n,s)=>{const d=new Date().toISOString();o({sessions:i().sessions.map(a=>a.id===n?{...a,...s,updatedAt:d}:a)})},markCompleted:(n,s={})=>{const d=new Date().toISOString();i().sessions.find(t=>t.employeeId===n)&&o({sessions:i().sessions.map(t=>t.employeeId===n?{...t,sessionStatus:"Completed",completedDate:s.completedDate||d.split("T")[0],conductedBy:s.conductedBy??t.conductedBy,notes:s.notes??t.notes,updatedAt:d}:t)})},scheduleSession:(n,s,d)=>{const a=new Date().toISOString();o({sessions:i().sessions.map(t=>t.employeeId===n?{...t,sessionStatus:"Scheduled",scheduledDate:s,conductedBy:d??t.conductedBy,updatedAt:a}:t)})},deleteSession:n=>{o({sessions:i().sessions.filter(s=>s.id!==n)})}}),{name:"it-session-store"}));export{D as u};

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.