1import{a as lt,b as st,c as mt}from"./chunk-CRRGGWWY.js";import{b as L,c as G,d as J,e as U,f as W,g as X,h as Y,i as Z,j as tt,k as et,l as nt,m as it}from"./chunk-4EOZ4GQM.js";import{a as b,b as at}from"./chunk-ABS4HHRO.js";import{a as ot,b as rt}from"./chunk-LOPE2D3P.js";import"./chunk-5Y2IASQK.js";import"./chunk-CJAJU6AD.js";import"./chunk-2X7AQD2Q.js";import{a as H,b as K}from"./chunk-5HEDMDRO.js";import"./chunk-TA4CGIW5.js";import"./chunk-ERKFY33D.js";import"./chunk-DSUZVMNK.js";import"./chunk-IBZUQYXW.js";import"./chunk-7B5TRSS4.js";import{u as V}from"./chunk-4T2PTKQJ.js";import{a as Q}from"./chunk-QG57Z74K.js";import{a as j}from"./chunk-6AO5R6CW.js";import"./chunk-KT3675XS.js";import"./chunk-VZ3MNGED.js";import"./chunk-AY76R2MH.js";import"./chunk-JCQ33YRD.js";import{U as N,V as z}from"./chunk-2GKCQ5UO.js";import{a as $,b as A}from"./chunk-AZMSRLP2.js";import{d as k,i as B,k as F}from"./chunk-J32AD3W7.js";import{$b as w,Ab as h,Cb as g,Cc as O,Ec as I,Hb as u,Ib as i,Jb as a,Kb as f,Ob as p,Pb as c,Rb as R,Vb as x,Xa as l,Xb as m,ac as D,ba as S,bc as E,ha as y,ia as v,jc as o,kb as q,kc as C,lc as P,qb as s,ua as M,yc as T}from"./chunk-YOAD7BVF.js";import"./chunk-55GY6K5S.js";var ut=()=>[10,25,50];function pt(e,t){e&1&&f(0,"mat-progress-bar",7)}function ct(e,t){e&1&&(i(0,"div",8)(1,"mat-icon",9),o(2,"event_busy"),a(),i(3,"h3"),o(4,"No shift requests"),a(),i(5,"p"),o(6,"There are no shift requests matching the current filter."),a()())}function ft(e,t){e&1&&(i(0,"th",23),o(1,"Employee"),a())}function _t(e,t){if(e&1&&(i(0,"td",24),o(1),a()),e&2){let n=t.$implicit;l(),C(n.employeeName)}}function ht(e,t){e&1&&(i(0,"th",23),o(1,"Shift"),a())}function gt(e,t){if(e&1&&(i(0,"td",24),o(1),a()),e&2){let n=t.$implicit,r=m(2);l(),C(r.formatShiftInfo(n.scheduledShift))}}function Ct(e,t){e&1&&(i(0,"th",23),o(1,"Requested"),a())}function St(e,t){if(e&1&&(i(0,"td",24),o(1),O(2,"date"),a()),e&2){let n=t.$implicit;l(),C(I(2,1,n.requestDate,"medium"))}}function xt(e,t){e&1&&(i(0,"th",23),o(1,"Priority"),a())}function bt(e,t){if(e&1&&(i(0,"td",24),o(1),a()),e&2){let n=t.$implicit;l(),C(n.priority)}}function yt(e,t){e&1&&(i(0,"th",23),o(1,"Status"),a())}function vt(e,t){if(e&1&&(i(0,"td",24)(1,"span",25),o(2),a()()),e&2){let n=t.$implicit,r=m(2);l(),u("ngClass",r.statusClass(n.requestStatus)),l(),P(" ",n.requestStatus," ")}}function Mt(e,t){e&1&&f(0,"th",23)}function qt(e,t){if(e&1){let n=R();i(0,"button",27),x("click",function(){y(n);let d=m().$implicit,_=m(2);return v(_.approve(d))}),i(1,"mat-icon"),o(2,"check"),a(),o(3," Approve "),a(),i(4,"button",28),x("click",function(){y(n);let d=m().$implicit,_=m(2);return v(_.reject(d))}),i(5,"mat-icon"),o(6,"close"),a(),o(7," Reject "),a()}}function Rt(e,t){if(e&1&&(i(0,"td",26),h(1,qt,8,0),a()),e&2){let n=t.$implicit;l(),g(n.requestStatus==="Pending"?1:-1)}}function wt(e,t){e&1&&f(0,"tr",29)}function Dt(e,t){e&1&&f(0,"tr",30)}function Et(e,t){if(e&1&&(i(0,"table",10),p(1,11),s(2,ft,2,0,"th",12)(3,_t,2,1,"td",13),c(),p(4,14),s(5,ht,2,0,"th",12)(6,gt,2,1,"td",13),c(),p(7,15),s(8,Ct,2,0,"th",12)(9,St,3,4,"td",13),c(),p(10,16),s(11,xt,2,0,"th",12)(12,bt,2,1,"td",13),c(),p(13,17),s(14,yt,2,0,"th",12)(15,vt,3,2,"td",13),c(),p(16,18),s(17,Mt,1,0,"th",12)(18,Rt,2,1,"td",19),c(),s(19,wt,1,0,"tr",20)(20,Dt,1,0,"tr",21),a(),f(21,"mat-paginator",22)),e&2){let n=m();u("dataSource",n.dataSource),l(19),u("matHeaderRowDef",n.displayedColumns),l(),u("matRowDefColumns",n.displayedColumns),l(),u("pageSizeOptions",T(5,ut))("pageSize",25)}}var dt=class e{api=S(Q);appState=S(j);snackBar=S(H);paginator;displayedColumns=["employeeName","shiftInfo","requestDate","priority","requestStatus","actions"];dataSource=new it([]);loading=M(!0);statusFilter=M("");ngOnInit(){this.loadData()}ngAfterViewInit(){this.connectPaginator()}connectPaginator(){setTimeout(()=>{this.paginator&&(this.dataSource.paginator=this.paginator)})}onStatusFilterChange(t){this.statusFilter.set(t),this.loadData()}loadData(){let t=this.appState.selectedRestaurantId;if(!t)return;this.loading.set(!0);let n=this.statusFilter()||void 0;this.api.getPartnerShiftRequests(t,n).subscribe({next:r=>{this.dataSource.data=r,this.loading.set(!1),this.connectPaginator()},error:()=>{this.dataSource.data=[],this.loading.set(!1),this.snackBar.open("Failed to load shift requests","OK",{duration:3e3})}})}
1approve(t){this.api.approvePartnerShiftRequest(t.id).subscribe({next:()=>{this.snackBar.open("Shift request approved","OK",{duration:3e3}),this.loadData()},error:()=>this.snackBar.open("Failed to approve request","OK",{duration:3e3})})}reject(t){let n=window.prompt("Rejection notes (optional):");n!==null&&this.api.rejectPartnerShiftRequest(t.id,n||void 0).subscribe({next:()=>{this.snackBar.open("Shift request rejected","OK",{duration:3e3}),this.loadData()},error:()=>this.snackBar.open("Failed to reject request","OK",{duration:3e3})})}formatShiftInfo(t){if(!t)return"\u2014";let n=new Date(t.shiftDate).toLocaleDateString();return`${t.name??"Shift"} (${n}, ${this.formatTime(t.startTime)} - ${this.formatTime(t.endTime)})`}formatTime(t){return t?t.substring(0,5):""}statusClass(t){switch(t){case"Pending":return"badge--outline";case"Approved":return"badge--success";case"Rejected":return"badge--warn";default:return"badge--outline"}}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=q({type:e,selectors:[["app-shift-requests"]],viewQuery:function(n,r){if(n&1&&w(b,5),n&2){let d;D(d=E())&&(r.paginator=d.first)}},decls:18,vars:4,consts:[[1,"page-header"],[1,"subtitle"],[1,"filter-group",3,"change","value"],["value",""],["value","Pending"],["value","Approved"],["value","Rejected"],["mode","indeterminate"],[1,"empty-state"],[1,"empty-icon"],["mat-table","",1,"mat-elevation-z1","full-width",3,"dataSource"],["matColumnDef","employeeName"],["mat-header-cell","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","shiftInfo"],["matColumnDef","requestDate"],["matColumnDef","priority"],["matColumnDef","requestStatus"],["matColumnDef","actions"],["mat-cell","","class","actions-cell",4,"matCellDef"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["showFirstLastButtons","",3,"pageSizeOptions","pageSize"],["mat-header-cell",""],["mat-cell",""],[1,"badge",3,"ngClass"],["mat-cell","",1,"actions-cell"],["mat-flat-button","","color","primary",1,"action-btn",3,"click"],["mat-stroked-button","","color","warn",1,"action-btn",3,"click"],["mat-header-row",""],["mat-row",""]],template:function(n,r){n&1&&(i(0,"div",0)(1,"div")(2,"h1"),o(3,"Shift Requests"),a(),i(4,"p",1),o(5,"Review and manage employee shift requests"),a()()(),i(6,"mat-button-toggle-group",2),x("change",function(_){return r.onStatusFilterChange(_.value)}),i(7,"mat-button-toggle",3),o(8,"All"),a(),i(9,"mat-button-toggle",4),o(10,"Pending"),a(),i(11,"mat-button-toggle",5),o(12,"Approved"),a(),i(13,"mat-button-toggle",6),o(14,"Rejected"),a()(),h(15,pt,1,0,"mat-progress-bar",7),h(16,ct,7,0,"div",8),h(17,Et,22,6)),n&2&&(l(6),u("value",r.statusFilter()),l(9),g(r.loading()?15:-1),l(),g(!r.loading()&&r.dataSource.data.length===0?16:-1),l(),g(r.dataSource.data.length>0?17:-1))},dependencies:[F,k,V,nt,L,J,Y,U,G,Z,W,X,tt,et,z,N,A,$,rt,ot,K,mt,lt,st,at,b,B],styles:[".page-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:24px}.page-header[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{margin:0}.subtitle[_ngcontent-%COMP%]{margin:4px 0 0;color:var(--mat-sys-on-surface-variant)}.full-width[_ngcontent-%COMP%]{width:100%}.filter-group[_ngcontent-%COMP%]{margin-bottom:16px}mat-paginator[_ngcontent-%COMP%]{margin-top:12px}.actions-cell[_ngcontent-%COMP%]{text-align:right;white-space:nowrap}.action-btn[_ngcontent-%COMP%]{margin-left:8px}.empty-state[_ngcontent-%COMP%]{text-align:center;padding:64px 16px;color:var(--mat-sys-on-surface-variant)}.empty-icon[_ngcontent-%COMP%]{font-size:48px;width:48px;height:48px;opacity:.4}.badge[_ngcontent-%COMP%]{display:inline-block;padding:2px 10px;border-radius:12px;font-size:12px;font-weight:500;line-height:20px}.badge--outline[_ngcontent-%COMP%]{border:1px solid currentColor;color:var(--mat-sys-on-surface-variant)}.badge--success[_ngcontent-%COMP%]{background:#e8f5e9;color:#2e7d32}.badge--warn[_ngcontent-%COMP%]{background:#fbe9e7;color:#c62828}"]})};export{dt as ShiftRequestsComponent};
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.