1import{a as De}from"./chunk-NM53COXH.js";import{d as Se,h as xe}from"./chunk-LGWCY2T2.js";import{Aa as P,Ab as B,B as I,Ea as h,Eb as z,Fa as C,Fb as Q,G as D,Ha as f,He as X,I as $,Ia as p,Ik as he,Ka as l,L as w,Md as G,Na as F,O as _,Oa as L,Od as q,P as d,Pa as U,Tl as M,Ul as Ce,Xa as m,Xj as pe,Ya as x,Yj as _e,bj as b,bm as Me,ca as c,cj as Z,ej as ee,fj as te,gj as ie,ha as S,hb as j,hj as ne,hk as de,ia as O,ib as y,ij as ae,ik as ue,ja as k,jb as N,jd as A,jj as oe,kb as E,ke as R,kj as re,kk as ge,lj as se,md as W,mf as H,mj as le,na as g,nj as ce,ok as fe,pa as T,tc as V,te as K,vj as me,xa as u,xh as Y,ya as o,za as s,ze as J}from"./chunk-YMFY75IU.js";var v=class{static customPrioritySort(){return(a,e)=>e==="priority"?this.convertPriority(a):a[e]}static convertPriority(a){switch(a.priority){case M.HIGH:return 2;case M.NORMAL:return 1;case M.LOW:default:return 0}}};var be=(t,a)=>({unseen:t,"high-priority":a});function ve(t,a){if(t&1){let e=f();o(0,"mat-header-cell",15),p("click",function(){_(e);let n=l();return d(n.toogleAllMessages())}),o(1,"mat-checkbox",16),p("change",function(){_(e);let n=l();return d(n.toogleAllMessages())})("click",function(n){return n.stopPropagation()}),s()()}if(t&2){let e=l();c(),T("aria-label",e.checkboxLabel()),u("checked",e.selection.hasValue()&&e.isAllSelected())("indeterminate",e.selection.hasValue()&&!e.isAllSelected())}}function Te(t,a){if(t&1){let e=f();o(0,"mat-cell",15),p("click",function(){let n=_(e).$implicit,r=l();return d(r.selection.toggle(n))}),o(1,"mat-checkbox",17),p("change",function(){let n=_(e).$implicit,r=l();return d(r.selection.toggle(n))})("click",function(n){return n.stopPropagation()}),s()()}if(t&2){let e=a.$implicit,i=l();c(),T("aria-label",i.checkboxLabel(e)),u("checked",i.selection.isSelected(e))}}function Pe(t,a){t&1&&(o(0,"mat-header-cell",18),m(1,"Tytu\u0142"),s())}function Ee(t,a){if(t&1){let e=f();o(0,"mat-cell",19),p("click",function(){let n=_(e).$implicit,r=l();return d(r.openDetailsDialog(n))}),o(1,"span"),m(2),s()()}if(t&2){let e=a.$implicit;c(2),x(e.title)}}function Ve(t,a){t&1&&(o(0,"mat-header-cell",20),m(1,"Wa\u017Cne od"),s())}function Ae(t,a){if(t&1){let e=f();o(0,"mat-cell",19),p("click",function(){let n=_(e).$implicit,r=l();return d(r.openDetailsDialog(n))}),o(1,"span"),m(2),y(3,"date"),s()()}if(t&2){let e=a.$implicit,i=l();c(2),x(E(3,1,e.startDate,i.dateFormat))}}function Re(t,a){t&1&&(o(0,"mat-header-cell",18),m(1,"Wa\u017Cne do"),s())}function He(t,a){if(t&1){let e=f();o(0,"mat-cell",19),p("click",function(){let n=_(e).$implicit,r=l();return d(r.openDetailsDialog(n))}),o(1,"span"),m(2),y(3,"date"),s()()}if(t&2){let e=a.$implicit,i=l();c(2),x(E(3,1,e.endDate,i.dateFormat))}}function Ie(t,a){t&1&&(o(0,"mat-header-cell",18),m(1,"Priorytet"),s())}function $e(t,a){if(t&1){let e=f();o(0,"mat-cell",19),p("click",function(){let n=_(e).$implicit,r=l();return d(r.openDetailsDialog(n))}),o(1,"span"),m(2),y(3,"messageTypePipe"),s()()}if(t&2){let e=a.$implicit;c(2),x(N(3,1,e.priority))}}function Oe(t,a){t&1&&P(0,"mat-header-row")}function Fe(t,a){if(t&1&&P(0,"mat-row",21),t&2){let e=a.$implicit,i=l();u("ngClass",j(1,be,i.isUnseen(e),i.isHighPriority(e)&&i.isUnseen(e)))}}var ke=(()=>{class t{constructor(e,i,n,r){this.messagesService=e,this.mainMenuService=i,this.dialog=n,this.spinnerService=r,this.dateFormat=X,this.selection=new K(!0,[]),this.dataSource=new pe,this.displayedColumns=["select","title","startDate","endDate","priority"],this.matSortDirection=_e}ngOnInit(){this.getMessages().subscribe()}ngAfterViewInit(){this.customSortPriority()}isAllSelected(){let e=this.dataSource.data.length,i=this.selection.selected.length;return e===0?!1:i===e}toogleAllMessages(){this.isAllSelected()?this.selection.clear():this.dataSource.data.forEach(e=>this.selection.select(e))}checkboxLabel(e){return e?`${this.selection.isSelected(e)?"deselect":"select"} row ${e.title}`:`${this.isAllSelected()?"select":"deselect"} all`}openDetailsDialog(e){let i=new A;i.panelClass=R.MEDIUM,i.data={title:e.title,message:e.content},this.dialog.open(he,i).afterClosed().pipe(D(()=>
1this.mainMenuService.checkUnreadMessages()),I(1)).subscribe(),e.seen||(this.messagesService.markAsSeen(e.id),e.seen=!0)}delete(){this.openDeleteDialog(this.selection.selected.map(e=>e.id))}deleteAll(){this.openDeleteDialog(this.dataSource.data.map(e=>e.id))}isHighPriority(e){return e.priority===M.HIGH}isUnseen(e){return!e.seen}openDeleteDialog(e){let i=new A;i.panelClass=R.SMALL,i.data=e,this.dialog.open(De,i).afterClosed().pipe(D(()=>this.mainMenuService.checkUnreadMessages()),D(()=>this.getMessages())).subscribe()}getMessages(){return this.spinnerService.showSpinner(),this.messagesService.getMessages().pipe($(e=>{this.spinnerService.hideSpinner(),this.dataSource.data=e,this.selection.clear()}))}customSortPriority(){this.dataSource.sortingDataAccessor=v.customPrioritySort(),this.dataSource.sort=this.sort}static{this.\u0275fac=function(i){return new(i||t)(S(Y),S(Se),S(W),S(q))}}static{this.\u0275cmp=O({type:t,selectors:[["app-messages"]],viewQuery:function(i,n){if(i&1&&F(b,5),i&2){let r;L(r=U())&&(n.sort=r.first)}},standalone:!1,decls:27,vars:7,consts:[[1,"gap-02rem"],[3,"clickAction","disabled"],["matSortActive","startDate","matSort","","matSortDisableClear","",3,"dataSource","matSortDirection"],["matColumnDef","select"],["class","checkbox",3,"click",4,"matHeaderCellDef"],["class","checkbox",3,"click",4,"matCellDef"],["matColumnDef","title"],["mat-sort-header","",4,"matHeaderCellDef"],[3,"click",4,"matCellDef"],["matColumnDef","startDate"],["mat-sort-header","startDate",4,"matHeaderCellDef"],["matColumnDef","endDate"],["matColumnDef","priority"],[4,"matHeaderRowDef","matHeaderRowDefSticky"],["class","table-row",3,"ngClass",4,"matRowDef","matRowDefColumns"],[1,"checkbox",3,"click"],[3,"change","click","aria-label","checked","indeterminate"],[3,"change","click","aria-label","checked"],["mat-sort-header",""],[3,"click"],["mat-sort-header","startDate"],[1,"table-row",3,"ngClass"]],template:function(i,n){i&1&&(o(0,"app-page-container")(1,"app-page-header"),m(2,"Komunikaty"),s(),o(3,"app-page-content")(4,"app-page-btn-panel",0)(5,"app-button",1),p("clickAction",function(){return n.delete()}),m(6,"Usu\u0144 zaznaczone"),s(),o(7,"app-button",1),p("clickAction",function(){return n.deleteAll()}),m(8,"Usu\u0144 wszystkie"),s()(),o(9,"mat-table",2),h(10,3),g(11,ve,2,3,"mat-header-cell",4)(12,Te,2,2,"mat-cell",5),C(),h(13,6),g(14,Pe,2,0,"mat-header-cell",7)(15,Ee,3,1,"mat-cell",8),C(),h(16,9),g(17,Ve,2,0,"mat-header-cell",10)(18,Ae,4,4,"mat-cell",8),C(),h(19,11),g(20,Re,2,0,"mat-header-cell",7)(21,He,4,4,"mat-cell",8),C(),h(22,12),g(23,Ie,2,0,"mat-header-cell",7)(24,$e,4,3,"mat-cell",8),C(),g(25,Oe,1,0,"mat-header-row",13)(26,Fe,1,4,"mat-row",14),s()()()),i&2&&(c(5),u("disabled",n.selection.isEmpty()),c(2),u("disabled",n.dataSource.data.length===0),c(2),u("dataSource",n.dataSource)("matSortDirection",n.matSortDirection),c(16),u("matHeaderRowDef",n.displayedColumns)("matHeaderRowDefSticky",!0),c(),u("matRowDefColumns",n.displayedColumns))},dependencies:[B,J,b,Z,ee,ie,re,ne,te,se,ae,oe,le,ce,de,ue,ge,fe,G,z,Ce],styles:["[_nghost-%COMP%]{display:block;padding:1.5rem}.unseen[_ngcontent-%COMP%]{font-weight:700}.high-priority[_ngcontent-%COMP%] *[_ngcontent-%COMP%]{color:red}.checkbox[_ngcontent-%COMP%]{flex:0 1 70px}.table-row[_ngcontent-%COMP%]{cursor:pointer}.delete-menu[_ngcontent-%COMP%]{margin-bottom:10px}.gap-02rem[_ngcontent-%COMP%]{gap:.2rem}"]})}}return t})();var Le=[{path:"",component:xe,children:[{path:"",redirectTo:H},{path:H,component:ke}]}],ye=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=k({type:t})}static{this.\u0275inj=w({imports:[V.forChild(Le),V]})}}return t})();var wt=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=k({type:t})}static{this.\u0275inj=w({imports:[Q,ye,me,Me]})}}return t})();export{wt as MessagesModule};
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.