PageSourceSearch

https://sociallab.sa/chunk-CdzmpQB-.js

js sociallab.sa collected 2026-09-24 13:29:58 UTC 18,606 bytes, 1 lines download raw bytes

1import {M as Mi}from'./chunk-MdUW6fLv.js';import {m as mi}from'./chunk-DeFVi4Or.js';import {e as ei$1}from'./chunk-CKIV5Uze.js';import {T,_,y}from'./chunk-DslIj0jt.js';import {x}from'./chunk-DKa_lTad.js';import {e as e$1}from'./chunk-C0FlMv5v.js';import {w}from'./chunk-C79GQXs3.js';import {W}from'./chunk-DdPoOY5M.js';import {E as En,D as De$1}from'./chunk-D3crpTkA.js';import {f}from'./chunk-CjNSgPDz.js';import {h as he}from'./chunk-C2EVnWPI.js';import {c as ce}from'./chunk-Cha4_V9g.js';import {g,b as gr,dY as T$1,c8 as Xr,E,D,H,bQ as P,bO as Gt,h as c$1,e as b,O,a as G,aE as lt,K as Kb,P as Pg,bu as Tg,bT as zc,V as Vg,a4 as YE,j as ai,T as Tt,cr as pe,d5 as Pe$1,k as Kv,l as b0,b1 as ei$2,L as L0,Y as Yx,m as dn,b2 as da,by as vr,bR as Ch,n as Vw,bA as Pw,o as nk,t as td,b3 as ed,p as tC,q as bC,s as sv,aF as ta,aG as pr,aH as ov,N as NC,X as XC,_ as _D,r as il,u as XD,v as rM,F as Fb,w as t1,y as A1,z as gS,B as Vs,C as zs,I as Fi,J as NS,Z as ZS,M as EI,Q as us,R as ms,S as HI,U as ZI,$ as Dn,a0 as kE,a1 as Jv,a2 as go,a3 as qd,av as on,a5 as OT,a6 as lA,a7 as mt,aR as o_,a8 as cy,a9 as qT,aa as Xs,ae as fS,ab as my,ad as hd,ac as V_,bZ as Vy,aS as Pp,b_ as G_,aU as Lp,af as KT,aV as QT,bB as lb,aB as Qm,ai as ay,bC as tS,ag as _C,ah as ZT,bD as Z_,al as hS,aj as ky,b$ as By,bE as fb,am as XT,eF as iy,aZ as Ey,a_ as g_,a$ as m_,aT as l_,ak as Dd,be as Y_,bi as v_,bh as nS,ba as _y}from'./main-CTPND76J.js';import'./chunk-CC_dzDIF.js';import'./chunk-yuXVPJRt.js';import'./chunk-CAH8VGMK.js';var Te=["searchInput"],Pe=()=>["Search for an order by number or customer.","Open an order to change its status as it moves through fulfilment.","Export to Excel to hand the list to whoever ships or accounts for it."],ve=()=>["Manage_Products"],Ie=e=>["/apps/orders/add-order",e],Le=()=>[1,2,3,4,5],ke=e=>["/apps/orders/order-details",e];function De(e,o){if(e&1&&cy(0,"app-alert-message",3),e&2){let t=l_();ay("messages",t.featureAccessMessage)("dismissible",false);}}function Ee(e,o){if(e&1){let t=o_();Xs(0,"app-status-counts-strip",30),my("highlightClicked",function(){Pp(t);let r=l_();return Lp(r.isCompletedThisMonthFilterActive?r.clearDateFilter():r.filterCompletedThisMonth())}),hd();}if(e&2){let t=l_();ay("items",t.statusItems)("total",t.statusCounts.total)("highlightValue",t.statusCounts.completedFromThisMonth)("highlightClickable",true)("highlightActive",t.isCompletedThisMonthFilterActive);}}function Fe(e,o){if(e&1&&(Xs(0,"mat-option",11),V_(1),fS(2,"translate"),hd()),e&2){let t=o.$implicit,i=l_();ay("value",t),_C(),ky(hS(2,2,i.getOrderStatusLabel(t)));}}function Ae(e,o){if(e&1){let t=o_();Xs(0,"button",31),fS(1,"translate"),fS(2,"translate"),my("click",function(){Pp(t);let r=l_();return Lp(r.clearStatusFilter())}),Xs(3,"mat-icon",15),V_(4,"filter_alt_off"),hd()();}e&2&&(ay("matTooltip",Z_(hS(1,4,"Clear filters"))),iy("aria-label",Z_(hS(2,6,"Clear filters"))));}function Re(e,o){if(e&1&&(Xs(0,"a",33)(1,"mat-icon",35),V_(2,"add"),hd(),V_(3),fS(4,"translate"),hd()),e&2){let t=l_(3);ay("routerLink",nS(4,Ie,t.customerId)),_C(3),Dd(" ",hS(4,2,"Add")," ");}}function Be(e,o){if(e&1){let t=o_();Xs(0,"button",36),my("click",function(){Pp(t);let r=l_(3);return Lp(r.showFeatureAccessDialog())}),Xs(1,"mat-icon",35),V_(2,"add"),hd(),V_(3),fS(4,"translate"),hd();}e&2&&(_C(3),Dd(" ",hS(4,1,"Add")," "));}function Ve(e,o){if(e&1&&(Xs(0,"span"),qT(1,Re,5,6,"a",33)(2,Be,5,3,"button",34),hd()),e&2){let t=l_(2);_C(),ZT(t.canUseWhatsAppCatalog?1:2);}}function Ne(e,o){e&1&&Qm(0,Ve,3,1,"span",32),e&2&&ay("ngxPermissionsOnly",tS(1,ve));}function $e(e,o){if(e&1&&V_(0),e&2){let t=o.$implicit;Dd(" ",t.orderNo," ");}}function je(e,o){if(e&1&&(Xs(0,"div",37)(1,"a",38),V_(2),hd(),Xs(3,"span",39)(4,"mat-icon",40),V_(5,"phone"),hd(),V_(6),hd()()),e&2){let t=o.$implicit;_C(),ay("routerLink",Y_("/apps/customers/customer-profile/",t.customerId)),_C(),Dd(" ",t.customerName," "),_C(4),Dd(" ",t.phoneNumber," ");}}function We(e,o){if(e&1&&cy(0,"sar-icon",11),e&2){let t=o.$implicit;ay("value",t.totalPrice);}}function Ue(e,o){if(e&1&&V_(0),e&2){let t=o.$implicit;Dd(" ",t.discountRate,"% ");}}function ze(e,o){if(e&1&&cy(0,"sar-icon",11),e&2){let t=o.$implicit;ay("value",t.discountPrice);}}function Qe(e,o){if(e&1&&cy(0,"sar-icon",11),e&2){let t=o.$implicit;ay("value",t.netPrice);}}function qe(e,o){if(e&1&&(V_(0),fS(1,"translate")),e&2){let t=o.$implicit,i=l_();Dd(" ",hS(1,1,i.getPaymentStatusLabel(t.paymentStatus))," ");}}function Ge(e,o){if(e&1&&(V_(0),fS(1,"translate")),e&2){let t=o.$implicit,i=l_();Dd(" ",hS(1,1,i.getOrderStatusLabel(t.orderStatus))," ");}}function He(e,o){if(e&1&&(V_(0),fS(1,"translate")),e&2){let t=o.$implicit,i=l_();Dd(" ",hS(1,1,i.getPaymentMethodLabel(t.paymentMethod))," ");}}function Ye(e,o){if(e&1&&(Xs(0,"mat-icon",44),V_(1," star "),hd()),e&2){let t=o.$implicit,i=l_(2).$implicit;_y("text-warning",t<=i.feedbackRating)("icon-filled",t<=i.feedbackRating)("text-muted",t>i.feedbackRating);}}function Ke(e,o){e&1&&(Xs(0,"div",41),KT(1,Ye,2,6,"mat-icon",43,QT),hd()),e&2&&(_C(),XT(tS(0,Le)));}function Je(e,o){e&1&&(Xs(0,"span",42),V_(1,"\u2014"),hd());}function Xe(e,o){if(e&1&&(qT(0,Ke,3,1,"div",41),qT(1,Je,2,0,"span",42)),e&2){let t=o.$implicit;ZT(t.feedbackRating?0:-1),_C(),ZT(t.feedbackRating?-1:1);}}
1function Ze(e,o){if(e&1){let t=o_();Xs(0,"button",49),my("click",function(r){Pp(t);let c=l_(2).$implicit,f=l_();return Lp(f.onEditOrder(c,r))}),Xs(1,"mat-icon"),V_(2,"edit"),hd(),Xs(3,"span"),V_(4),fS(5,"translate"),hd()();}e&2&&(_C(4),ky(hS(5,1,"Edit")));}function ti(e,o){e&1&&Qm(0,Ze,6,3,"button",48),e&2&&ay("ngxPermissionsOnly",tS(1,ve));}function ei(e,o){if(e&1&&(Xs(0,"button",45),my("click",function(i){return i.stopPropagation()}),Xs(1,"mat-icon"),V_(2,"more_vert"),hd()(),Xs(3,"mat-menu",null,1)(5,"button",46)(6,"mat-icon"),V_(7,"visibility"),hd(),Xs(8,"span"),V_(9),fS(10,"translate"),hd()(),qT(11,ti,1,2,"button",47),hd()),e&2){let t=o.$implicit,i=v_(4);ay("matMenuTriggerFor",i),_C(5),ay("routerLink",nS(6,ke,t.id)),_C(4),ky(hS(10,4,"View")),_C(2),ZT(t.paymentStatus?-1:11);}}var br=(()=>{class e{constructor(t,i,r,c,f,x,Oe,we){this.orderService=t,this.loadingService=i,this.errorService=r,this.dialogConfigService=c,this.clientsService=f,this.translate=x,this.router=Oe,this.toastr=we,this.dialog=g(gr),this.orders=[],this.isLoading=true,this.canUseWhatsAppCatalog=false,this.featureAccessChecked=false,this.featureAccessMessage=["You either don't have a subscription or your subscription does not support this feature or you have reached the maximum limit."],this.selectedStatuses=[],this.statusOptions=[T.New,T.PendingConfirmation,T.Confirmed,T.PendingPayment,T.InProgress,T.Ready,T.OutForDelivery,T.Completed,T.PaymentFailed,T.Rejected,T.CancelledByCustomer,T.CancelledByStore],this.columns=[{key:"orderNo",label:"Order Id",priority:1},{key:"customerInfo",label:"Customer",priority:1},{key:"totalPrice",label:"Total Price",priority:2},{key:"discountRate",label:"Discount Rate",priority:3},{key:"discountPrice",label:"Discount Price",priority:3},{key:"netPrice",label:"Net Price",priority:2},{key:"paymentStatus",label:"Payment Status",priority:2},{key:"orderStatus",label:"Order Status",priority:2},{key:"paymentMethod",label:"Payment Method",priority:3},{key:"rating",label:"Rating",priority:3},{key:"actions",label:"Actions",priority:1,hideLabel:true,stickyEnd:true}],this.statusCounts=null,this.statusItems=[],this.fromDateFilter=null;}get noDataMessage(){return this.customerId?"This customer has no orders in SocialLab yet":"No orders yet"}ngOnInit(){this.checkFeatureAccess(),this.loadStatusCounts();}loadStatusCounts(){this.orderService.getStatusCounts().subscribe({next:t=>{if(!t?.succeeded||!t.data){this.statusCounts=null,this.statusItems=[];return}this.statusCounts=t.data,this.statusItems=this.statusCounts.statuses.map(i=>({label:this.getOrderStatusLabel(i.status),count:i.count}));},error:()=>{this.statusCounts=null,this.statusItems=[];}});}checkFeatureAccess(){this.clientsService.canUseFeature(T$1.WHATSAPP_CATALOG).subscribe({next:t=>{this.canUseWhatsAppCatalog=t,this.featureAccessChecked=true;},error:()=>{this.canUseWhatsAppCatalog=false,this.featureAccessChecked=true;}});}showFeatureAccessDialog(){this.dialog.open(mi,{data:{message:this.translate.instant("You either don't have a subscription or your subscription does not support this feature or you have reached the maximum limit.")},width:"400px"});}onAddOrderClick(){this.canUseWhatsAppCatalog&&this.customerId?this.router.navigate(["/apps/orders/add-order",this.customerId]):this.canUseWhatsAppCatalog||this.showFeatureAccessDialog();}onEditOrder(t,i){if(i.stopPropagation(),!this.canUseWhatsAppCatalog){this.showFeatureAccessDialog();return}this.openUpdateDialog(t);}ngAfterViewInit(){this.getOrders();}ngOnDestroy(){this.sub&&this.sub.unsubscribe();}searchOrders(){this.paginator.pageIndex=0,this.getOrders();}onStatusFilterChange(){this.searchOrders();}clearStatusFilter(){this.selectedStatuses=[],this.searchOrders();}get isCompletedThisMonthFilterActive(){return !!this.fromDateFilter&&this.selectedStatuses.length===1&&this.selectedStatuses[0]===T.Completed}filterCompletedThisMonth(){this.statusCounts&&(this.selectedStatuses=[T.Completed],this.fromDateFilter=this.statusCounts.monthStartUtc.slice(0,10),this.searchOrders());}clearDateFilter(){this.fromDateFilter=null,this.selectedStatuses=[],this.searchOrders();}getOrders(){let t=this.searchInput.nativeElement.value;this.isLoading=true,this.loadingService.beginSuppress();let i=null;this.customerId&&(i=parseInt(this.customerId));let r=null;this.productId&&(r=parseInt(this.productId)),this.sub=this.orderService.searchOrders(i,r,this.paginator.pageIndex,this.paginator.pageSize,t,this.selectedStatuses,this.fromDateFilter).pipe(Xr(()=>{this.isLoading=false,this.loadingService.endSuppress();})).subscribe({next:c=>{this.orders=c.data,c.count!==void 0&&c.count!==null&&(this.paginator.length=c.count);},error:c=>this.errorService.setError(c,"Error while getting the data")});}getPaymentStatusLabel(t){return t!=null?this.translate.instant(e$1[t]):""}openUpdateDialog(t){let i=this.dialogConfigService.getDefaultDialogConfig();this.dialog.open(ei$1,E(D({},i),{data:{id:t.id,order:t}})).afterClosed().subscribe(c=>{c!==void 0&&(this.paginator.pageIndex=0,this.getOrders());});}exportToExcel(){if(!this.orders?.length){this.toastr.warning("No data to export");return}let t=this.orders.map(i=>({[this.translate.instant("Customer")]:`${i.customerName??""} (${i.phoneNumber??""})`,[this.translate.instant("Total Price")]:i.totalPrice??"",[this.translate.instant("Discount Rate")]:i.discountRate!=null?`${i.discountRate}%`:"",[this.translate.instant("Discount Price")]:i.discountPrice??"",[this.translate.instant("Net Price")]:i.netPrice??"",[this.translate.instant("Payment Status")]:this.getPaymentStatusLabel(i.paymentStatus),[this.translate.instant("Order Status")]:this.getOrderStatusLabel(i.orderStatus),[this.translate.instant("Payment Method")]:this.getPaymentMethodLabel(i.paymentMethod),[this.translate.instant("Delivery Type")]:i.deliveryType??"",[this.translate.instant("Rating")]:i.feedbackRating??""}));x(t,"Orders",`orders_${new Date().toISOString().slice(0,10)}.xlsx`).then(()=>this.toastr.success("Excel file exported successfully")).catch(()=>this.toastr.error("Error exporting to Excel"));}getOrderStatusLabel(t){switch(t){case T.New:return "New";case T.InProgress:return "In Progress";case T.Ready:return "Ready";case T.OutForDelivery:return "Out For Delivery";case T.Completed:return "Completed";case T.CancelledByCustomer:return "Cancelled By Customer";case T.CancelledByStore:return "Cancelled By Store";case T.PendingConfirmation:return "Pending Confirmation";case T.Confirmed:return "Confirmed";case T.PendingPayment:return "Pending Payment";case T.PaymentFailed:return "Payment Failed";case T.Rejected:return "Rejected";default:return "-"}}getPaymentMethodLabel(t){switch(t){case _.Moyasar:return "Online Payment";case _.CashOnDelivery:return "Cash On Delivery";case _.OnBranch:return "Payment At Branch";default:return "-"}}getOrderStatusClass(t){switch(t){case T.New:case T.PendingConfirmation:return "status-new";case T.Confirmed:case T.InProgress:return "status-active";case T.Ready:return "status-ready";case T.OutForDelivery:return "status-delivery";case T.Completed:return "status-completed";case T.PendingPayment:return "status-pending-payment";case T.PaymentFailed:case T.CancelledByCustomer:case T.CancelledByStore:case T.Rejected:return "status-failed";default:return ""}}static{this.\u0275fac=function(i){return new(i||e)(H(y),H(P),H(Gt),H(c$1),H(b),H(O),H(G),H(lt))};}static{this.\u0275cmp=Kb({type:e,selectors:[["app-orders-list"]],viewQuery:function(i,r){if(i&1&&Ey(he,7)(Te,5),i&2){let c;g_(c=m_())&&(r.paginator=c.first),g_(c=m_())&&(r.searchInput=c.first);}},inputs:{customerId:"customerId",productId:"productId"},decls:39,vars:27,consts:[["searchInput",""],["actionsMenu","matMenu"],["helpKey","orders","intro","Every order placed through SocialLab, with its status and payment state.",3,"steps"],["type","warning",3,"messages","dismissible"],["totalLabel","All orders","highlightLabel","Completed from this month","highlightTooltip","Orders CREATED this month that are now completed. We don't record when an order was completed, so an order created earlier and completed this month is not counted here. Click to show them.",3,"items","total","highlightValue","highlightClickable","highlightActive"],[1,"orders-toolbar"],["subscriptSizing","dynamic",1,"orders-search","hide-hint"],["matInput","","id","searchInput","autocomplete","off",3,"keyup.enter","placeholder"],["matSuffix","",1,"icon-18",3,"click"],["subscriptSizing","dynamic",1,"orders-status-filter","hide-hint"],["multiple","","panelClass","orders-status-panel",3,"ngModelChange","ngModel"],[3,"value"],["mat-icon-button","",3,"matTooltip","aria-label"],[1,"orders-toolbar-actions"],["mat-icon-button","",3,"click","matTooltip","disabled","aria-label"],[1,"icon-18"],[1,"orders-table"],[3,"rowClick","dataSource","columns","loading","noDataMessage"],["rtColumnDef","orderNo"],["rtColumnDef","customerInfo"],["rtColumnDef","totalPrice"],["rtColumnDef","discountRate"],["rtColumnDef","discountPrice"],["rtColumnDef","netPrice"],["rtColumnDef","paymentStatus"],["rtColumnDef","orderStatus"],["rtColumnDef","paymentMethod"],["rtColumnDef","rating"],["rtColumnDef","actions"],[3,"page"],["totalLabel","All orders","highlightLabel","Completed from this month","highlightTooltip","Orders CREATED this month that are now completed. We don't record when an order was completed, so an order created earlier and completed this month is not counted here. Click to show them.",3,"highlightClicked","items","total","highlightValue","highlightClickable","highlightActive"],["mat-icon-button","",3,"click","matTooltip","aria-label"],[4,"ngxPermissionsOnly"],["mat-flat-button","","color","primary",3,"routerLink"],["mat-flat-button","","color","primary"],[1,"m-r-8"],["mat-flat-button","","color","primary",3,"click"],[1,"d-flex","flex-column","justify-content-center","py-2"],[1,"curs
1or-pointer","f-w-600","text-decoration-none","m-b-4",3,"routerLink"],[1,"text-muted","f-s-12","d-flex","align-items-center","gap-1"],[2,"font-size","14px","width","14px","height","14px"],[1,"d-flex","align-items-center"],[1,"text-muted"],[1,"f-s-16",2,"width","16px","height","16px","font-size","16px",3,"text-warning","icon-filled","text-muted"],[1,"f-s-16",2,"width","16px","height","16px","font-size","16px"],["mat-icon-button","","aria-label","more vert",3,"click","matMenuTriggerFor"],["mat-menu-item","",3,"routerLink"],["mat-menu-item",""],["mat-menu-item","",3,"click",4,"ngxPermissionsOnly"],["mat-menu-item","",3,"click"]],template:function(i,r){if(i&1){let c=o_();cy(0,"app-page-help",2),qT(1,De,1,2,"app-alert-message",3),qT(2,Ee,1,5,"app-status-counts-strip",4),Xs(3,"div",5)(4,"mat-form-field",6)(5,"input",7,0),fS(7,"translate"),my("keyup.enter",function(){return r.searchOrders()}),hd(),Xs(8,"mat-icon",8),my("click",function(){return r.searchOrders()}),V_(9,"search"),hd()(),Xs(10,"mat-form-field",9)(11,"mat-label"),V_(12),fS(13,"translate"),hd(),Xs(14,"mat-select",10),Vy("ngModelChange",function(x){return Pp(c),G_(r.selectedStatuses,x)||(r.selectedStatuses=x),Lp(x)}),my("ngModelChange",function(){return r.onStatusFilterChange()}),KT(15,Fe,3,4,"mat-option",11,QT),hd(),lb(),hd(),qT(17,Ae,5,8,"button",12),Xs(18,"div",13),qT(19,Ne,1,2,"span"),Xs(20,"button",14),fS(21,"translate"),fS(22,"translate"),my("click",function(){return r.exportToExcel()}),Xs(23,"mat-icon",15),V_(24,"download"),hd()()()(),Xs(25,"div",16)(26,"app-responsive-table",17),my("rowClick",function(x){return r.router.navigate(["/apps/orders/order-details",x.id])}),Qm(27,$e,1,1,"ng-template",18)(28,je,7,4,"ng-template",19)(29,We,1,1,"ng-template",20)(30,Ue,1,1,"ng-template",21)(31,ze,1,1,"ng-template",22)(32,Qe,1,1,"ng-template",23)(33,qe,2,3,"ng-template",24)(34,Ge,2,3,"ng-template",25)(35,He,2,3,"ng-template",26)(36,Xe,2,2,"ng-template",27)(37,ei,12,8,"ng-template",28),hd(),Xs(38,"paginator-configurable",29),my("page",function(){return r.getOrders()}),hd()();}i&2&&(ay("steps",tS(26,Pe)),_C(),ZT(r.featureAccessChecked&&!r.canUseWhatsAppCatalog?1:-1),_C(),ZT(r.statusCounts?2:-1),_C(3),ay("placeholder",Z_(hS(7,18,"Search"))),_C(7),ky(hS(13,20,"Order Status")),_C(2),By("ngModel",r.selectedStatuses),fb(),_C(),XT(r.statusOptions),_C(2),ZT(r.selectedStatuses.length?17:-1),_C(2),ZT(r.customerId?19:-1),_C(),ay("matTooltip",Z_(hS(21,22,"Download as Excel"))),iy("aria-label",Z_(hS(22,24,"Download as Excel"))),ay("disabled",!r.orders||!r.orders.length),_C(6),ay("dataSource",r.orders)("columns",r.columns)("loading",r.isLoading)("noDataMessage",r.noDataMessage));},dependencies:[ce,Pg,Tg,zc,Vg,YE,ai,Tt,pe,Pe$1,f,he,Mi,w,W,En,De$1,Kv,b0,ei$2,L0,Yx,dn,da,vr,Ch,Vw,Pw,nk,td,ed,tC,bC,sv,ta,pr,ov,NC,XC,_D,il,XD,rM,Fb,t1,A1,gS,Vs,zs,Fi,NS,ZS,EI,us,ms,HI,ZI,Dn,kE,Jv,go,qd,on,OT,lA,mt],styles:[".orders-toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:16px}.orders-search[_ngcontent-%COMP%]{flex:1;
1min-width:200px;max-width:360px}.orders-status-filter[_ngcontent-%COMP%]{width:220px;min-width:180px}.orders-toolbar-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin-inline-start:auto}.orders-table[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .08));border-radius:var(--radius-xl, 16px);background:var(--color-white, #fff);padding:6px 10px;overflow:hidden}"],changeDetection:1});}}return e})();export{br as OrdersListComponent};

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.