PageSourceSearch

https://buildersacademynz.web.app/chunk-XRHFUJ4T.js

js buildersacademynz.web.app collected 2026-10-03 12:20:55 UTC 9,054 bytes, 1 lines download raw bytes

1import{D as M,E as V,Q as z,U as R,V as j,Z as q,_ as W,b as k,da as K,i as P,j as T,k as N,l as $,m as B,o as H,q as O,u as D,y as L}from"./chunk-KMXQE4KL.js";import{G as tt,Na as et,a as X,b as Y,e as Z}from"./chunk-R5WJRIHB.js";import{a as Q}from"./chunk-NFYWOYC5.js";import"./chunk-ITMFNP22.js";import{d as J}from"./chunk-LFRTPRFK.js";import"./chunk-GUZO7ZNK.js";import{Aa as m,Db as S,Ga as E,Ha as h,Ia as g,Ib as v,J as c,N as y,O as _,Rb as F,Ua as p,Va as I,aa as d,fa as x,ka as A,qa as w,sa as C,ub as U,xa as G,ya as o,za as s}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 n}from"./chunk-NMDLJX5Q.js";
1function it(a,l){a&1&&(o(0,"div",7),m(1,"ion-spinner",8),s())}function rt(a,l){if(a&1){let u=E();o(0,"ion-item",11)(1,"ion-label")(2,"h3"),p(3),s(),o(4,"p"),p(5),s()(),o(6,"ion-button",12),h("click",function(){let e=y(u).$implicit,i=g(2);return _(i.editGroup(e))}),m(7,"ion-icon",13),s(),o(8,"ion-button",14),h("click",function(){let e=y(u).$implicit,i=g(2);return _(i.deleteGroup(e))}),m(9,"ion-icon",15),s()()}if(a&2){let u=l.$implicit,t=g(2);d(3),I(u.name),d(2),I(t.getUserCountText(u.list_id))}}function nt(a,l){a&1&&(o(0,"div",10),p(1,"No groups found for this faculty."),s())}function at(a,l){if(a&1&&(o(0,"ion-list"),A(1,rt,10,2,"ion-item",9),s(),w(2,nt,2,0,"div",10)),a&2){let u=g();d(),G("ngForOf",u.groups),d(),C(u.groups.length===0?2:-1)}}var _t=(()=>{let l=class l{constructor(){this.http=c(v),this.router=c(F),this.global=c(Q),this.alertCtrl=c(q),this.loadingCtrl=c(W),this.groups=[],this.groupUserCounts={},this.isLoading=!0,this.facultyId=null,X({arrowBack:Z,addOutline:Y,createOutline:tt,trashOutline:et})}ngOnInit(){return n(this,null,function*(){let t=this.global.getCurrentUser();if(!t?.faculty){yield this.showAlert("Error","No faculty found for your account."),this.router.navigate(["/hod-faculty-settings"]);return}this.facultyId=Number(t.faculty),yield this.loadGroups()})}loadGroups(){return n(this,null,function*(){if(this.facultyId!==null){this.isLoading=!0;try{let t=`${this.global.getApiBaseUrl()}get_groups_by_faculty.php?faculty=${encodeURIComponent(String(this.facultyId))}`,e=yield this.http.get(t).toPromise(),i=e?.data||e?.groups||[];this.groups=Array.isArray(i)?i.map(r=>({list_id:Number(r?.list_id),faculty:Number(r?.faculty),name:String(r?.name||"")})):[],yield this.loadUserCounts()}catch(t){yield this.showAlert("Error",t?.error?.message||"Failed to load groups.")}finally{this.isLoading=!1}}})}addGroup(){return n(this,null,function*(){if(this.facultyId===null)return;yield(yield this.alertCtrl.create({header:"Add Group",inputs:[{name:"name",type:"text",placeholder:"Group name"}],buttons:[{text:"Cancel",role:"cancel"},{text:"Add",handler:e=>n(this,null,function*(){let i=String(e?.name||"").trim();return i?this.hasDuplicateName(i)?(yield this.showAlert("Error","A group with this name already exists in this faculty."),!1):(yield this.persistCreate(i),!0):(yield this.showAlert("Error","Group name is required."),!1)})}]})).present()})}editGroup(t){return n(this,null,function*(){yield(yield this.alertCtrl.create({header:"Edit Group",inputs:[{name:"name",type:"text",value:t.name,placeholder:"Group name"}],buttons:[{text:"Cancel",role:"cancel"},{text:"Save",handler:i=>n(this,null,function*(){let r=String(i?.name||"").trim();return r?this.hasDuplicateName(r,t.list_id)?(yield this.showAlert("Error","A group with this name already exists in this faculty."),!1):(yield this.persistUpdate(t.list_id,r),!0):(yield this.showAlert("Error","Group name is required."),!1)})}]})).present()})}deleteGroup(t){return n(this,null,function*(){yield this.loadUserCounts();let e=this.getAssignedUsersCount(t.list_id),i=e>0,r=i?`${e} user${e===1?"":"s"} are assigned to "${t.name}". If you continue, the group will be deleted and you will need to reassign it's users to another group or leave them unassigned.`:`Warning: This will permanently delete "${t.name}".`;yield(yield this.alertCtrl.create({header:"Delete Group Warning",message:r,buttons:[{text:"Cancel",role:"cancel"},{text:"Continue",role:"destructive",handler:()=>n(this,null,function*(){yield this.persistDelete(t.list_id,i)})}]})).present()})}goBack(){this.router.navigate(["/hod-faculty-settings"])}persistCreate(t){return n(this,null,function*(){if(this.facultyId===null)return;let e=yield this.loadingCtrl.create({message:"Saving..."});yield e.present();try{let i=yield this.http.post(`${this.global.getApiBaseUrl()}add_group.php`,{faculty:this.facultyId,name:t}).toPromise();yield e.dismiss(),i?.success||i?.error===!1?yield this.loadGroups():yield this.showAlert("Error",i?.message||"Failed to add group.")}catch(i){yield e.dismiss(),yield this.showAlert("Error",i?.error?.message||"Failed to add group.")}})}persistUpdate(t,e){return n(this,null,function*(){if(this.facultyId===null)return;let i=yield this.loadingCtrl.create({message:"Saving..."});yield i.present();try{let r=yield this.http.post(`${this.global.getApiBaseUrl()}update_group.php`,{list_id:t,faculty:this.facultyId,name:e}).toPromise();
1yield i.dismiss(),r?.success||r?.error===!1?yield this.loadGroups():yield this.showAlert("Error",r?.message||"Failed to update group.")}catch(r){yield i.dismiss(),yield this.showAlert("Error",r?.error?.message||"Failed to update group.")}})}persistDelete(t,e=!1){return n(this,null,function*(){if(this.facultyId===null)return;let i=yield this.loadingCtrl.create({message:"Deleting..."});yield i.present();try{let r=yield this.http.post(`${this.global.getApiBaseUrl()}delete_group.php`,{list_id:t,faculty:this.facultyId,force_delete:e?1:0}).toPromise();yield i.dismiss(),r?.success||r?.error===!1?yield this.loadGroups():yield this.showAlert("Error",r?.message||"Failed to delete group.")}catch(r){yield i.dismiss(),yield this.showAlert("Error",r?.error?.message||"Failed to delete group.")}})}showAlert(t,e){return n(this,null,function*(){yield(yield this.alertCtrl.create({header:t,message:e,buttons:["OK"]})).present()})}hasDuplicateName(t,e){let i=this.normalizeName(t);return this.groups.some(r=>e!==void 0&&Number(r.list_id)===Number(e)?!1:this.normalizeName(r.name)===i)}normalizeName(t){return String(t||"").trim().toLowerCase()}getUserCountText(t){let e=this.getAssignedUsersCount(t);return e===1?"1 user assigned":e>1?`${e} users assigned`:"No users assigned"}getAssignedUsersCount(t){return this.groupUserCounts[String(t)]||0}loadUserCounts(){return n(this,null,function*(){if(this.facultyId===null){this.groupUserCounts={};return}try{let t=`${this.global.getApiBaseUrl()}get_users_by_faculty.php?faculty=${encodeURIComponent(String(this.facultyId))}`,e=yield this.http.get(t).toPromise(),i=Array.isArray(e?.data)?e.data:[],r={};for(let b of i){let f=String(b?.grp??"").trim();f&&(r[f]=(r[f]||0)+1)}this.groupUserCounts=r}catch{this.groupUserCounts={}}})}};l.\u0275fac=function(e){return new(e||l)},l.\u0275cmp=x({type:l,selectors:[["app-hod-faculty-groups"]],decls:17,vars:1,consts:[["color","primary"],["slot","start"],["defaultHref","/hod-faculty-settings",3,"click"],["slot","end"],[3,"click"],["slot","icon-only","name","add-outline"],[1,"ion-padding"],[1,"loading-wrap"],["name","crescent"],["lines","full",4,"ngFor","ngForOf"],[1,"empty-note"],["lines","full"],["fill","clear","color","primary",3,"click"],["slot","icon-only","name","create-outline"],["fill","clear","color","danger",3,"click"],["slot","icon-only","name","trash-outline"]],template:function(e,i){e&1&&(o(0,"ion-header")(1,"ion-toolbar",0)(2,"ion-buttons",1)(3,"ion-back-button",2),h("click",function(){return i.goBack()}),s()(),o(4,"ion-title"),p(5,"Faculty Groups"),s(),o(6,"ion-buttons",3)(7,"ion-button",4),h("click",function(){return i.addGroup()}),m(8,"ion-icon",5),s()()()(),o(9,"ion-content",6)(10,"ion-card")(11,"ion-card-header")(12,"ion-card-title"),p(13,"Groups"),s()(),o(14,"ion-card-content"),w(15,it,2,0,"div",7)(16,at,3,2),s()()()),e&2&&(d(15),C(i.isLoading?15:16))},dependencies:[S,U,J,D,j,T,k,R,O,N,B,H,$,V,L,M,P,K,z],styles:[".loading-wrap[_ngcontent-%COMP%]{display:flex;justify-content:center;padding:24px 0}.empty-note[_ngcontent-%COMP%]{color:var(--ion-color-medium);padding:12px 0}"]});let a=l;return a})();export{_t as HodFacultyGroupsPage};

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.