PageSourceSearch

https://app.staffskillsacademy.co.uk/build/assets/SimulatedApplicationTime-B2NzV3tp.js

js staffskillsacademy.co.uk collected 2026-10-04 14:18:14 UTC 11,603 bytes, 1 lines download raw bytes

1import{_ as U}from"./AdminLayout-BhPmOhB0.js";import{_ as D}from"./PrimaryButton-CNrxCghz.js";import{_ as B}from"./SecondaryButton-D3ZBnHX0.js";import{_ as Q}from"./InputLabel-BWamd_x9.js";import{_ as V}from"./TextInput-AzIcQ4VN.js";import{_ as R}from"./InputError-DZewhVtc.js";import{_ as L}from"./ToastMessage-CZnctVTd.js";import{k as F,Q as H,u as O,r as Y,l as p,y as W,A as X,B as z,o as c,c as G,w as u,a as t,b as d,e as a,f,m as J,t as o,d as _,h as v,g as Z,F as K,z as ee}from"./app-Dsu_9ZFr.js";import"./ImpersonatingBar-CSiu7E_c.js";import"./DashboardIcon-DDHz8ph2.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./MyCoursesIcon-PPse1Nm8.js";import"./CompaniesIcon-Ci2fs5Bl.js";import"./UserIcon-CgYuJ9nl.js";import"./SettingsIcon-2iCRzdYc.js";import"./SubLinkMenu-H1JJlyZd.js";import"./ColourHelpers-BUTFcReV.js";import"./ReturnIcon-B3V341O-.js";import"./DropdownLink-CnrycL-H.js";import"./NotificationIcon-BuPA2t8R.js";import"./MessagesIcon-DlHxhtVy.js";import"./CourseCollectionIcon-Kpnn3Z3q.js";import"./DownloadIcon-DUotIHkd.js";import"./SyncIcon-BGTjby5c.js";import"./createLucideIcon-CYXWfzkQ.js";import"./chart-column-j-gZZslH.js";import"./ApplicationMark-Cy_xIW--.js";import"./MenuIcon-Bim_zm4r.js";import"./AppHead-B6AtMQLP.js";import"./toastWatcher-CLWKU_yT.js";import"./DialogModal-C_cZHFZ-.js";import"./Modal-DQiy6TZu.js";import"./useMediaPickerStore-FTvSyb2Y.js";import"./FileUpload-CLTMQXnO.js";import"./filepond.esm-DpgIsP34.js";import"./filepond-plugin-image-preview.min-T3029Ca-.js";import"./circle-check-big-DcvhH7uh.js";import"./file-CYOWkNIP.js";import"./CloseDeleteIcon-H_stXYhA.js";import"./useButtonClasses-DaBVTZqM.js";import"./dynamic-import-helper-BheWnx7M.js";import"./x-CdR-vzUA.js";import"./AlertIcon-DHTuICF4.js";import"./TickIcon-DREWnL2M.js";import"./InfoIcon-C0aFXn2U.js";const te={class:"w-full"},se={class:"mb-6 text-xs text-mid-grey"},ae={class:"grid grid-cols-1 gap-6 lg:grid-cols-2 lg:gap-8 lg:items-start"},ne={class:"min-w-0 p-6 bg-white border shadow-xl border-light-grey rounded-2xl"},ie={class:"mb-4 text-xs text-gray-500"},re={class:"font-mono text-gray-800 break-all"},oe={class:"mb-4"},le={class:"flex flex-wrap gap-3 mb-4"},de={key:0,class:"p-3 mb-4 text-xs border rounded-lg border-amber-200 bg-amber-50 text-amber-900"},ue={key:1,class:"p-3 mb-4 text-xs border rounded-lg border-red-200 bg-red-50 text-red-900"},me={class:"mt-1"},pe={class:"min-w-0 p-6 bg-white border shadow-xl border-light-grey rounded-2xl"},ce={key:0,class:"p-4 mb-4 text-sm border rounded-lg border-amber-200 bg-amber-50 text-amber-900"},fe={class:"mt-1 text-xs sm:text-sm"},ge={class:"pl-0 space-y-3 list-none"},ye={class:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between sm:gap-4"},be={class:"min-w-0"},_e={class:"text-sm font-medium text-gray-900"},he={class:"text-xs text-gray-500"},pt={__name:"SimulatedApplicationTime",props:{storedSimulatedAt:{default:null},effectiveNowIso:{type:String,required:!0},queueHealth:{type:Object,default:()=>({driver:"sync",defaultQueue:null,warning:null,pendingReady:null,pendingByQueue:null})}},setup(g){const T=g,h=F(),q=H();function N(s){if(!s)return"";const e=new Date(s);if(Number.isNaN(e.getTime()))return"";const n=r=>String(r).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}T${n(e.getHours())}:${n(e.getMinutes())}`}const i=O({action:"set",simulated_at:N(T.storedSimulatedAt)}),$=["process_mandatory_course_expiry","send_mandatory_course_expiry_reminders","reset_credits"],l=Y({id:null,status:null,steps:{},failed_command:null,message:null});let y=null;function m(){y!==null&&(clearInterval(y),y=null)}async function w(s){try{const e=route("client-management.settings.simulated-application-time.bundle-status",s),n=await fetch(e,{headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"},credentials:"same-origin"});if(!n.ok){m();return}const r=await n.json();l.value={id:s,...r},(r.status==="completed"||r.status==="failed")&&m()}catch{m()}}function k(s){s&&(m(),l.value={id:s,status:"running",steps:{},failed_command:null,message:null},w(s),y=setInterval(()=>w(s),2e3))}const b=p(()=>l.value.status==="running"),j=p(()=>i.processing&&i.action==="set"),C=p(()=>i.processing&&i.action==="clear");function E(s){var e;if($.includes(s)){const n=(e=l.value.steps)==null?void 0:e[s];if(b.value&&n==null)return"Queued…";if(n==="running")return"Running…";if(n==="pending")return"Queued…";if(n==="failed")return b.value?"Failed":"Run now"}return"Run now"}const x=p(()=>i.processing||b.value),I=p(()=>i.processing);function A(){i.action="set",i.put(route("client-management.settings.simulated-application-time.update"))}function M(){i.action="clear",i.simulated_at=null,i.put(route("client-management.settings.simulated-application-time.update"))}const S=[{key:"process_mandatory_course_expiry",title:"Process mandatory course expiry",description:"Mark assignments expired when past expires_at; SSA retake resets and stale progress cleanup using effective application time."}
1,{key:"send_mandatory_course_expiry_reminders",title:"Mandatory course expiry emails",description:"Before expiry (30 and 7 days), on expiry day, and after expiry (every 7 days, up to 90 days)."},{key:"reset_credits",title:"Reset credits",description:"Reset company credits when reset_credits_at is due (Credits/Reseller companies), using effective application time."},{key:"course_not_started_emails",title:"Course not started emails",description:"Send reminders to users who haven't started their assigned courses"},{key:"course_not_completed_emails",title:"Course not completed emails",description:"Send reminders to users who have started but haven't completed assigned courses"},{key:"send_mandatory_due_date_reminders",title:"Mandatory course due date reminder",description:"Send notifications when mandatory courses are due to be completed (14 days and 7 days before)"},{key:"check_overdue_mandatory",title:"Overdue mandatory courses notification",description:"Notify users with overdue mandatory courses (scheduled job)"}];function P(s){const e=S.find(r=>r.key===s),n=(e==null?void 0:e.title)??s;q({component:L,props:{title:n,message:"This job is running in the background and may take some time. You can start other jobs from this list while they run.",type:"info"}},{icon:!1}),ee.post(route("client-management.settings.simulated-application-time.run-command"),{command:s},{preserveScroll:!0})}return W(()=>h.props.simulatedTimeBundleId,s=>{s&&k(s)}),X(()=>{h.props.simulatedTimeBundleId&&k(h.props.simulatedTimeBundleId)}),z(()=>{m()}),(s,e)=>(c(),G(U,{title:"Simulated application time and notifications"},{default:u(()=>{var n;return[t("div",te,[t("div",se,[d(f(J),{href:s.route("client-management.settings.index"),class:"text-blue-600 hover:underline"},{default:u(()=>e[1]||(e[1]=[a(" Settings ")])),_:1},8,["href"]),e[2]||(e[2]=t("span",{class:"mx-1"},"/",-1)),e[3]||(e[3]=t("span",null,"Simulated application time and notifications",-1))]),t("div",ae,[t("div",ne,[e[7]||(e[7]=t("h2",{class:"mb-3 text-base font-medium text-gray-900"}," Effective application time ",-1)),e[8]||(e[8]=t("p",{class:"mb-4 text-sm text-gray-600"},' Non-production only. Shifts effective "today" for mandatory due dates, expiry, compliance, and dashboard date filters — not sessions or auth. ',-1)),t("p",ie,[e[4]||(e[4]=a(' Effective "now" (preview): ')),t("span",re,o(g.effectiveNowIso),1)]),t("div",oe,[d(Q,null,{default:u(()=>e[5]||(e[5]=[a("Simulated date and time")])),_:1}),d(V,{class:"w-full mt-1",type:"datetime-local",modelValue:f(i).simulated_at,"onUpdate:modelValue":e[0]||(e[0]=r=>f(i).simulated_at=r),disabled:x.value},null,8,["modelValue","disabled"]),d(R,{message:f(i).errors.simulated_at,class:"mt-1"},null,8,["message"]),d(R,{message:f(i).errors.action,class:"mt-1"},null,8,["message"])]),t("div",le,[d(D,{type:"button",disabled:x.value,onClick:A},{default:u(()=>[a(o(j.value?"Saving…":"Save"),1)]),_:1},8,["disabled"]),d(B,{type:"button",disabled:x.value,onClick:M},{default:u(()=>[a(o(C.value?"Clearing…":"Use real clock"),1)]),_:1},8,["disabled"])]),b.value?(c(),_("p",de," Bundled expiry, reminder, and credit-reset steps are running on the server. This often takes several minutes on large databases — follow progress in the list on the right. You can leave this page; refresh to lose the live status bar until the run finishes. ")):v("",!0),l.value.status==="failed"?(c(),_("div",ue,[e[6]||(e[6]=t("p",{class:"font-medium"}," Bundled step failed ",-1)),t("p",me,o(l.value.failed_command?`${l.value.failed_command}: `:"")+o(l.value.message||"Check logs for details."),1)])):v("",!0),e[9]||(e[9]=t("div",{class:"p-4 mb-4 text-sm border border-blue-200 rounded-lg bg-blue-50 text-blue-900"},[t("p",{class:"mb-2 font-medium"}," When you click Save or Use real clock "),t("ol",{class:"pl-5 space-y-2 list-decimal text-xs sm:text-sm"},[t("li",null,[t("span",{class:"font-medium"},"Process mandatory course expiry"),a(" — marks assignments as expired when past expires_at; applies SSA retake resets and stale progress cleanup using the new effective time. ")]),t("li",{class:"leading-snug"},[t("span",{class:"font-medium"},"Send mandatory course expiry reminders"),a(" — emails per company settings: before (30 and 7 days), on expiry day, after expiry (every 7 days, up to 90 days). ")]),t("li",{class:"leading-snug"},[t("span",{class:"font-medium"},"Reset credits"),a(" — resets company credits when reset_credits_at is due (Credits/Reseller companies only), using the new effective time. ")])]),t("p",{class:"mt-3 text-xs sm:text-sm"},[a(" Those three steps are queued together (queue name from "),t("span",{class:"font-mono"},"SIMULATED_TIME_BUNDLE_QUEUE"),a(", default "),t("span",{class:"font-mono"},"default"),a(") and run in order after your settings are saved. Ensure a queue worker is running when not using the sync driver ("),t("span",{class:"font-mono"},"php artisan queue:work"),a(", or include your bundle queue if you override it). You can also run individual steps with "),t("span",{class:"font-medium"},"Run now"),a(" on the right. ")])],-1))]),t("div",pe,[e[12]||(e[12]=t("h2",{class:"mb-2 text-base font-medium text-gray-900"}," Other email and notification jobs ",-1)),(n=g.queueHealth)!=null&&n.warning?(c(),_("div",ce,[e[10]||(e[10]=t("p",{class:"font-medium"}
1," Queue warning ",-1)),t("p",fe,o(g.queueHealth.warning),1),e[11]||(e[11]=t("p",{class:"mt-2 text-xs text-amber-800"},[a(" These actions are queue-dependent. Ensure a worker is running (e.g. "),t("span",{class:"font-mono"},"php artisan queue:work"),a(") and try again. ")],-1))])):v("",!0),e[13]||(e[13]=t("p",{class:"mb-4 text-xs text-gray-500"},[a(" Save or "),t("span",{class:"font-medium"},"Use real clock"),a(" queues the same three steps as the first rows below (in order). Progress updates here while that bundle runs; you can run any step again from the list; further rows are additional jobs. Each "),t("span",{class:"font-medium"},"Run now"),a(" shows a short toast with that job's name — jobs run on the server and you can start several in succession. Names match company preferences where applicable. ")],-1)),t("ul",ge,[(c(),_(K,null,Z(S,r=>t("li",{key:r.key,class:"pb-3 border-b border-gray-100 last:border-0 last:pb-0"},[t("div",ye,[t("div",be,[t("p",_e,o(r.title),1),t("p",he,o(r.description),1)]),d(B,{type:"button",class:"justify-center flex-shrink-0 text-sm whitespace-nowrap sm:self-start",disabled:I.value,onClick:xe=>P(r.key)},{default:u(()=>[a(o(E(r.key)),1)]),_:2},1032,["disabled","onClick"])])])),64))])])])])]}),_:1}))}};export{pt 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.