1import{D as Q,E as X,F as Z,Q as tt,S as et,T as nt,U as it,V as at,Z as rt,_ as ot,da as st,i as Y,j as K,q as U,u as W,y as q}from"./chunk-KMXQE4KL.js";import{a as D,e as O,v as k,w as mt,xa as N}from"./chunk-R5WJRIHB.js";import{a as dt}from"./chunk-NFYWOYC5.js";import"./chunk-ITMFNP22.js";import{b as lt,d as ct}from"./chunk-LFRTPRFK.js";import"./chunk-GUZO7ZNK.js";import{Aa as b,Cb as G,Db as z,Ga as w,Ha as f,Ia as d,J as y,N as x,O as v,Pa as I,Rb as J,Ua as c,Va as S,Vc as j,Wa as h,Xa as P,_ as T,aa as s,fa as F,ka as g,lb as $,ob as R,pb as M,rb as H,ub as A,vb as B,xa as m,ya as o,za as r}from"./chunk-3RYB6SVN.js";import"./chunk-QYJGY2IR.js";import"./chunk-YGHZJLBQ.js";import"./chunk-G35TH3HO.js";import"./chunk-QUJFQN2Y.js";import"./chunk-TQCPDUT3.js";import"./chunk-USX6FYMP.js";import"./chunk-LPZTKJWE.js";import"./chunk-PW6GA5NL.js";import"./chunk-S5XOBH6Y.js";import"./chunk-MKFP4TZ3.js";import"./chunk-JQVI6FS2.js";import"./chunk-BCFU56ZB.js";import"./chunk-PT3YUHTI.js";import"./chunk-MTEZNQW4.js";import"./chunk-PTASOGFN.js";import"./chunk-4K53T7NJ.js";import"./chunk-MTHZ7MWU.js";import"./chunk-WI5MSH4N.js";import"./chunk-N2ITJEWR.js";import"./chunk-CKP3SGE2.js";import"./chunk-RFGOEN6H.js";import"./chunk-Y7EQJLOB.js";import"./chunk-4EXU7QX3.js";import"./chunk-YG5PFMJ7.js";import"./chunk-NER57BGA.js";import"./chunk-DSHYVPZD.js";import"./chunk-PD2PSGYJ.js";import"./chunk-YGDXWWXH.js";import"./chunk-JNMFIV4M.js";import"./chunk-DXRS3GW7.js";import"./chunk-ZDL7X67C.js";import"./chunk-CLVRMGG4.js";import{g as _}from"./chunk-NMDLJX5Q.js";function _t(i,l){if(i&1&&(o(0,"span"),c(1),r()),i&2){let n=d();s(),P("",n.userFirstName," ",n.userLastName)}}function gt(i,l){i&1&&(o(0,"div",12),b(1,"ion-spinner",13),o(2,"p"),c(3,"Loading activity details..."),r()())}function ft(i,l){if(i&1){let n=w();o(0,"div",14)(1,"ion-text",15)(2,"h2"),c(3,"Error"),r(),o(4,"p"),c(5),r()(),o(6,"ion-button",16),f("click",function(){x(n);let t=d();return v(t.retryLoading())}),c(7," Retry "),r(),o(8,"ion-button",17),f("click",function(){x(n);let t=d();return v(t.showSampleData())}),c(9," Show Sample Data "),r()()}if(i&2){let n=d();s(5),S(n.errorMessage)}}function ht(i,l){if(i&1){let n=w();o(0,"div",18)(1,"ion-text",19)(2,"h2"),c(3,"No Entries Found"),r(),o(4,"p"),c(5),r()(),o(6,"ion-button",16),f("click",function(){x(n);let t=d();return v(t.retryLoading())}),c(7," Try Again "),r()()}if(i&2){let n=d();s(5),h('No entries found for activity "',n.activity==null?null:n.activity.name,'"')}}function yt(i,l){if(i&1&&(o(0,"p"),c(1),r()),i&2){let n=d(2);s(),h("Total Hours: ",n.getTotalHours())}}function xt(i,l){if(i&1&&(o(0,"p"),c(1),r()),i&2){let n=d().$implicit,e=d(2);s(),P("",n.values.length," entries \u2022 ",e.getGroupHours(n)," hours")}}function vt(i,l){if(i&1&&c(0),i&2){let n=d().$implicit;h("",n.values.length," entries")}}function bt(i,l){if(i&1){let n=w();o(0,"img",32),f("error",function(){x(n);let t=d().$implicit;return v(t.data.inventory_image=null)}),r()}if(i&2){let n=d().$implicit,e=d(4);m("src",e.global.buildMediaUrl(n.data.inventory_image),T)}}function St(i,l){i&1&&b(0,"img",33)}function wt(i,l){if(i&1&&(o(0,"p",34)(1,"span"),c(2,"Hours:"),r(),o(3,"strong"),c(4),r()()),i&2){let n=d().$implicit;s(4),S(n.hours||(n.data==null?null:n.data.inventory_value)||"0")}}function Ct(i,l){if(i&1&&(o(0,"p",34)(1,"span"),c(2,"Project:"),r(),c(3),r()),i&2){let n=d().$implicit;s(3),h(" ",n.data.address," ")}}function It(i,l){if(i&1&&(o(0,"p",34)(1,"span"),c(2,"Activity:"),r(),c(3),r()),i&2){let n=d().$implicit;s(3),h(" ",n.data.inventory_item," ")}}function Pt(i,l){if(i&1&&(o(0,"p",35)(1,"span"),c(2,"Notes:"),r(),c(3),$(4,"slice"),r()),i&2){let n=d().$implicit;s(3),h(" ",n.data.notes.length>100?R(4,1,n.data.notes,0,100)+"...":n.data.notes," ")}}function Mt(i,l){if(i&1&&(o(0,"ion-item",27)(1,"ion-thumbnail",2),g(2,bt,1,1,"img",28)(3,St,1,0,"ng-template",null,1,M),r(),o(5,"ion-label",29)(6,"h3"),c(7),r(),g(8,wt,5,1,"p",30)(9,Ct,4,1,"p",30)(10,It,4,1,"p",30)(11,Pt,5,5,"p",31),r()()),i&2){let n=l.$implicit,e=I(4),t=d(4);s(2),m("ngIf",n.data==null?null:n.data.inventory_image)("ngIfElse",e),s(5),S(n.date||"No Date"),s(),m("ngIf",t.showRecordHours),s(),m("ngIf",n.data==null?null:n.data.address),s(),m("ngIf",n.data==null?null:n.data.inventory_item),s(),m("ngIf",n.data==null?null:n.data.notes)}}function Dt(i,l){if(i&1&&(o(0,"ion-list"),g(1,Mt,12,7,"ion-item",26),r()),i&2){let n=d().$implicit;s(),m("ngForOf",n.values)}}function Ot(i,l){if(i&1){let n=w();o(0,"ion-list",22)(1,"ion-list-header",23),f("click",function(){let t=x(n).$implicit,a=d(2);return v(a.clickSubCat(t,null))}),o(2,"ion-label")(3,"h2"),c(4),r(),g(5,xt,2,2,"p",24)(6,vt,1,1,"ng-template",null,0,M),r(),b(8,"ion-icon",25),r(),g(9,Dt,2,1,"ion-list",5),r()}if(i&2){let n=l.$implicit,e=I(7),t=d(2);s(4),S(n.name),s(),m("ngIf",t.showRecordHours)("ngIfElse",e),s(4),m("ngIf",n.values&&n.values.length>0)}}function kt(i,l){if(i&1&&(o(0,"div")(1,"ion-list-header",20)(2,"ion-label")(3,"h1"),c(4),r(),g(5,yt,2,1,"p",5),o(6,"p"),c(7),r()()(),g(8,Ot,10,4,"ion-list",21),r()),i&2){let n=d();s(4),S((n.activity==null?null:n.activity.name)||"Activity Details"),s(),m("ngIf",n.showRecordHours),s(2),h("Total Entries: ",n.resultList.length),s(),m("ngForOf",n.renderGroups)}}D({arrowBack:O,chevronForward:mt,refresh:N,"chevron-down-outline":k});var Jt=(()=>{let l=class l{constructor(){this.userFirstName="",this.userLastName="",this.alertCtrl=y(rt),this.loadingCtrl=y(ot),this.router=y(J),this.cdRef=y(H),this.translate=y(lt),this.global=y(dt),this.activity=null,this.resultList=[],this.renderGroups=[],this.isLoading=!0,this.errorMessage="",this.showRecordHours=!0,D({arrowBack:O,refresh:N,chevronDownOutline:k})}ngOnInit(){let e=localStorage.getItem("currentStaff");if(e)try{let t=JSON.parse(e);this.userFirstName=t.user_firstname||"",this.userLastName=t.user_lastname||""}catch{this.userFirstName="",this.userLastName=""}this.loadFacultyFeatureFlags(),this.initializePage()}loadFacultyFeatureFlags(){return _(this,null,function*(){let e=JSON.parse(localStorage.getItem("currentStaff")||"{}"),t=String(e?.faculty||"").trim();if(!t){this.showRecordHours=!0;return}try{let p=(yield this.global.loadFacultyList()).find(u=>String(u?.list_id)===t);this.showRecordHours=Number(p?.record_hours??1)===1}catch{this.showRecordHours=!0}})}ionViewWillEnter(){this.initializePage()}goBack(){localStorage.removeItem("staffSummaryActivity"),this.router.navigate(["/staff-view-summary-activity"])}retryLoading(){return _(this,null,function*(){yield this.initializePage()})}initializePage(){return _(this,null,function*(){this.isLoading=!0,this.errorMessage="",this.renderGroups=[],this.resultList=[];let e=localStorage.getItem("staffSummaryActivity");if(!e){this.errorMessage="No activity data found in localStorage",this.isLoading=!1,this.cdRef.detectChanges();return}try{this.activity=JSON.parse(e)}catch{this.errorMessage="Failed to parse activity data",this.isLoading=!1,this.cdRef.detectChanges();return}yield this.loadAndFindData(),this.isLoading=!1,this.cdRef.detectChanges()})}loadAndFindData(){return _(this,null,function*(){let e=[],t=localStorage.getItem("staffInventoryList");if(t)try{e=JSON.parse(t)}catch{}if(e.length===0&&(e=this.global.staffInventoryList||this.global.allStudentLogList||[]),e.length===0&&(e=this.loadBackupData()),e.length===0){this.errorMessage="No inventory data available";return}this.findMatchingItems(e),this.resultList.length>0?yield this.processIntoGroups():this.errorMessage=`No entries found for activity: ${this.activity?.name}`})}
1findMatchingItems(e){if(!this.activity?.name)return;let t=this.activity.name.toLowerCase().trim(),a=this.activity.subCategoryId?.toString?.()||"",p=this.activity.subCategoryCat?.toString?.()||"";e.forEach((u,E)=>{let C=u.inventory_item?.toLowerCase().trim()||"",L=u.inventory_item2?.toLowerCase().trim()||"",ut=u.inventory_item3?.toLowerCase().trim()||"",pt=u.inventory_item4?.toLowerCase().trim()||"",V=u.sub_category?.toString?.()||"";(!(a!==""||p!=="")||V===a||V===p)&&(t===C||t===L||t===ut||t===pt)&&this.resultList.push(u)}),this.resultList.sort((u,E)=>{let C=new Date(u.inventory_purchased||0);return new Date(E.inventory_purchased||0).getTime()-C.getTime()})}loadBackupData(){let e=["staffStudentLogBackup","tutorStudentLogBackup","studentLogBackup"];for(let t of e){let a=localStorage.getItem(t);if(a)try{return JSON.parse(a)}catch{}}return[]}processIntoGroups(){return _(this,null,function*(){try{let e={};this.resultList.forEach(t=>{let a=t.inventory_purchased||"No Date",p=new Date(a),u=a!=="No Date"?`${p.getFullYear()}-${String(p.getMonth()+1).padStart(2,"0")}`:"No Date";e[u]||(e[u]={id:u,name:this.formatDateGroupName(u),values:[]}),e[u].values.push({id:t.inventory_id||Date.now(),name:this.formatItemName(t),data:t,date:t.inventory_purchased||"No Date",hours:parseFloat(t.inventory_value)||0,notes:t.notes||"No notes",address:t.address||"No address"})}),this.renderGroups=Object.values(e).sort((t,a)=>t.id==="No Date"?1:a.id==="No Date"?-1:a.id.localeCompare(t.id))}catch{this.renderGroups=[{id:"all",name:"All Entries",values:this.resultList.map(t=>({id:t.inventory_id||Date.now(),name:this.formatItemName(t),data:t,date:t.inventory_purchased||"No Date",hours:parseFloat(t.inventory_value)||0,notes:t.notes||"No notes",address:t.address||"No address"}))}]}})}formatDateGroupName(e){if(e==="No Date")return"No Date";let[t,a]=e.split("-");return`${["January","February","March","April","May","June","July","August","September","October","November","December"][parseInt(a)-1]} ${t}`}formatItemName(e){let t=e.inventory_purchased||"No Date",a=parseFloat(e.inventory_value)||0;return this.showRecordHours?`${t} - ${a} hours`:`${t}`}showAlert(e,t){return _(this,null,function*(){yield(yield this.alertCtrl.create({header:e,message:t,buttons:["OK"]})).present()})}showSampleData(){return _(this,null,function*(){this.resultList.length>0,yield(yield this.alertCtrl.create({header:"Sample Data",message:`Found ${this.resultList.length} entries for "${this.activity?.name}". Check browser console for details.`,buttons:["OK"]})).present()})}clickSubCat(e,t){t&&t.data&&this.showEntryDetails(t.data)}showEntryDetails(e){return _(this,null,function*(){let t=this.showRecordHours?`<strong>Hours:</strong> ${parseFloat(e.inventory_value)||0}<br>`:"";yield(yield this.alertCtrl.create({header:"Entry Details",message:` 2 <strong>Date:</strong> ${e.inventory_purchased||"No Date"}<br> 3 ${t} 4 <strong>Address:</strong> ${e.address||"No address"}<br> 5 <strong>Notes:</strong> ${e.notes||"No notes"}<br> 6 <strong>Main Category:</strong> ${e.main_category||"N/A"}<br> 7 <strong>Sub Category:</strong> ${e.sub_category||"N/A"} 8 `,buttons:["OK"]})).present()})}getTotalHours(){return!this.resultList||this.resultList.length===0?0:this.resultList.reduce((e,t)=>e+(parseFloat(t.inventory_value)||0),0)}getGroupHours(e){return!e.values||e.values.length===0?0:e.values.reduce((t,a)=>t+(parseFloat(a.data?.inventory_value)||a.hours||0),0)}refreshData(){return _(this,null,function*(){yield this.initializePage()})}};l.\u0275fac=function(t){return new(t||l)},l.\u0275cmp=F({type:l,selectors:[["app-staff-view-summary-detail"]],decls:15,vars:5,consts:[["groupCountOnly",""],["defaultImg",""],["slot","start"],["fill","clear",3,"click"],["slot","icon-only","name","arrow-back"],[4,"ngIf"],["slot","end"],["slot","icon-only","name","refresh"],[1,"page-bg"],["class","loading-container",4,"ngIf"],["class","error-container",4,"ngIf"],["class","empty-container",4,"ngIf"],[1,"loading-container"],["name","crescent"],[1,"error-container"],["color","danger"],["expand","block","fill","solid",3,"click"],["expand","block","fill","outline",3,"click"],[1,"empty-container"],["color","medium"],[1,"activity-header"],["class","main-card",4,"ngFor","ngForOf"],[1,"main-card"],[1,"group-header",3,"click"],[4,"ngIf","ngIfElse"],["name","chevron-down-outline","slot","end"],["class","inventory-card","lines","full",4,"ngFor","ngForOf"],["lines","full",1,"inventory-card"],[3,"src","error",4,"ngIf","ngIfElse"],[1,"inventory-label"],["class","row",4,"ngIf"],["class","row notes",4,"ngIf"],[3,"error","src"],["src","assets/img/YIoJsnszRE6Y948PO6u7_default-news-image.jpg"],[1,"row"],[1,"row","notes"]],template:function(t,a){t&1&&(o(0,"ion-header")(1,"ion-toolbar")(2,"ion-buttons",2)(3,"ion-button",3),f("click",function(){return a.goBack()}),b(4,"ion-icon",4),r()(),o(5,"ion-title"),g(6,_t,2,2,"span",5),r(),o(7,"ion-buttons",6)(8,"ion-button",3),f("click",function(){return a.refreshData()}),b(9,"ion-icon",7),r()()()(),o(10,"ion-content",8),g(11,gt,4,0,"div",9)(12,ft,10,1,"div",10)(13,ht,8,1,"div",11)(14,kt,9,4,"div",5),r()),t&2&&(s(6),m("ngIf",a.userFirstName||a.userLastName),s(5),m("ngIf",a.isLoading),s(),m("ngIf",!a.isLoading&&a.errorMessage),s(),m("ngIf",!a.isLoading&&!a.errorMessage&&a.renderGroups.length===0),s(),m("ngIf",!a.isLoading&&!a.errorMessage&&a.renderGroups.length>0))},dependencies:[z,A,B,j,ct,W,at,K,Y,st,U,X,Z,q,Q,it,nt,et,tt,G],styles:["ion-content[_ngcontent-%COMP%]{--background: transparent !important;background:transparent!important;box-shadow:none!important}@media(prefers-color-scheme:dark){ion-content[_ngcontent-%COMP%]{--background: transparent !important;background:transparent!important;box-shadow:none!important}}ion-list[_ngcontent-%COMP%]{--background: transparent !important;background:transparent!important;box-shadow:none!important}@media(prefers-color-scheme:dark){ion-list[_ngcontent-%COMP%]{--background: transparent !important;background:transparent!important;box-shadow:none!important}}@media(prefers-color-scheme:dark){.page-bg[_ngcontent-%COMP%]{--background: #181818 !important;background:#181818!important}.main-card[_ngcontent-%COMP%]{background:#23272f!important;box-shadow:0 6px 18px #0000004d!important;border-left:1px solid #23272f!important;border-right:1px solid #23272f!important}.main-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{color:#e0e6ed!important}.sub-header[_ngcontent-%COMP%]{background:#23272f!important}.sub-header[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{color:#e0e6ed!important}.sub-header[_ngcontent-%COMP%] ion-icon[_ngcontent-%COMP%]{color:#b0b8c1!important}.inventory-card[_ngcontent-%COMP%]{--background: #23272f !important;background:#23272f!important;border:1px solid #23272f!important;border-left:1px solid #23272f!important;border-right:1px solid #23272f!important;box-shadow:0 2px 10px #0000004d!important}.row[_ngcontent-%COMP%]{color:#e0e6ed!important}.row[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{color:#fff!important}.notes[_ngcontent-%COMP%]{color:#b0b8c1!important}}.page-bg[_ngcontent-%COMP%]{--background: transparent !important;background:transparent!important;padding:12px}.main-card[_ngcontent-%COMP%]{background:transparent!important;border-radius:16px;padding:16px;margin-bottom:20px;box-shadow:0 6px 18px #0000000f;transition:transform .2s,box-shadow .2s}.main-card[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 10px 22px #00000014}.main-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-size:18px;font-weight:700;color:#1f2937;margin:0 0 8px}.sub-card-wrapper[_ngcontent-%COMP%]{margin-bottom:12px}.sub-header[_ngcontent-%COMP%]{background:#eef2f7;border-radius:12px;padding:10px 16px;margin-bottom:8px;display:flex;justify-content:space-between;align-items:center;cursor:pointer;transition:background .2s}.sub-header[_ngcontent-%COMP%]:hover{background:#e2e8f0}.sub-header[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{font-size:15px;font-weight:600;color:#374151;margin:0}.sub-header[_ngcontent-%COMP%] ion-icon[_ngcontent-%COMP%]{color:#6b7280}.inventory-card[_ngcontent-%COMP%]{--background: #ffffff;margin-top:10px;border-radius:14px;padding:12px;border:1px solid #e5e7eb;box-shadow:0 2px 10px #0000000a;cursor:pointer;display:flex;align-items:center;transition:transform .2s,box-shadow .2s}.inventory-card[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 6px 16px #00000014}.inventory-card[_ngcontent-%COMP%] ion-thumbnail[_ngcontent-%COMP%]{--size: 80px;margin-right:16px;border-radius:12px;overflow:hidden}.inventory-card[_ngcontent-%COMP%] ion-thumbnail[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover;border-radius:12px}.inventory-card[_ngcontent-%COMP%] .inventory-label[_ngcontent-%COMP%]{flex:1}.row[_ngcontent-%COMP%]{font-size:14px;color:#374151;margin-bottom:4px}.row[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-weight:600;color:#111827}.notes[_ngcontent-%COMP%]{color:#4b5563;font-style:italic}"]});let i=l;return i})();export{Jt as StaffViewSummaryDetailPage};
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.