dealpos 11.7.0 → 11.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/POS/{1752.2127c11c4aaabd1b.js → 1752.b6b8559c49a63216.js} +1 -1
- package/POS/{1930.2bb52276ee6242a3.js → 1930.cd0d8dbd1a639045.js} +1 -1
- package/POS/1987.d21dfcf831200943.js +1 -0
- package/POS/2141.2aae4536b71d0c25.js +1 -0
- package/POS/2545.6b4924b8cdd23a5b.js +1 -0
- package/POS/{273.6bc66b48fc76a9ac.js → 273.03ed59526b855ff5.js} +1 -1
- package/POS/2757.1a54750e227125e1.js +1 -0
- package/POS/2834.369597d62373ee57.js +1 -0
- package/POS/3353.9c1dec5fb685e45a.js +1 -0
- package/POS/3571.553a20e260c4251f.js +1 -0
- package/POS/{3632.2c6e35b55f830da0.js → 3632.d75cbc7896e530c7.js} +1 -1
- package/POS/3rdpartylicenses.txt +3 -0
- package/POS/{4020.b44cd040d6254415.js → 4020.5973356c61d77274.js} +1 -1
- package/POS/4426.b45d92993bf907d9.js +1 -0
- package/POS/4518.94ba6b8352d6b4f9.js +1 -0
- package/POS/4941.9a13cdc85f6c5d9c.js +1 -0
- package/POS/5222.8b2b8593bc777f3c.js +1 -0
- package/POS/5418.708a0f101005a425.js +1 -0
- package/POS/6262.026116826a992775.js +1 -0
- package/POS/6268.8bc9dd8321b014e6.js +1 -0
- package/POS/{6290.96f60470e37ed0fe.js → 6290.9de9231956dd392e.js} +1 -1
- package/POS/6317.b6d4d00773085cf1.js +1 -0
- package/POS/6485.78731f57e2dcb623.js +1 -0
- package/POS/7193.66a374057e6f8708.js +1 -0
- package/POS/7266.636cdcb20747bbb4.js +1 -0
- package/POS/7928.823914ffcf871ef5.js +1 -0
- package/POS/{7998.c9011facd73ea23d.js → 7998.f6ce431cf9a37f37.js} +1 -1
- package/POS/{8126.01b673776d83c117.js → 8126.ae17d75e1e2ba10b.js} +1 -1
- package/POS/8131.d7867bc244e8f928.js +1 -0
- package/POS/8604.c1639f54ebb4cbb5.js +1 -0
- package/POS/8914.363897fea86d18e2.js +1 -0
- package/POS/{9156.43ad4198988e983c.js → 9156.69652739b980eeb8.js} +1 -1
- package/POS/9564.f1cd9a4ee5f0731a.js +1 -0
- package/POS/9937.355a645bee6589b9.js +1 -0
- package/POS/common.ad9c257c165b3eed.js +1 -0
- package/POS/index.html +3 -3
- package/POS/main.517e36c17bcc93fa.js +1 -0
- package/POS/runtime.574b7553845997ce.js +1 -0
- package/POS/{styles.a3d14f744d6205f8.css → styles.d90459651b6cae18.css} +2 -2
- package/package.json +1 -1
- package/POS/1825.98c7303c5474f623.js +0 -1
- package/POS/1987.be978fcbd9672b5f.js +0 -1
- package/POS/2141.b57b7332f86dbc4e.js +0 -1
- package/POS/2489.b438ab9155900576.js +0 -1
- package/POS/2545.7fc81bfc6359da94.js +0 -1
- package/POS/2834.0e037008b8096c82.js +0 -1
- package/POS/3353.95c4cc4957204232.js +0 -1
- package/POS/3571.87b958e4248fb672.js +0 -1
- package/POS/3782.c1a064c13a475cab.js +0 -1
- package/POS/3912.3a49e60f7e9859fa.js +0 -1
- package/POS/4426.b9343ecb9805b942.js +0 -1
- package/POS/4518.3fb1b4c1e406c382.js +0 -1
- package/POS/4941.c92a40ea6ae274f9.js +0 -1
- package/POS/5418.178637ffad5620da.js +0 -1
- package/POS/5698.6af720dcff6281e0.js +0 -1
- package/POS/6262.16bd0552b5259a8d.js +0 -1
- package/POS/6268.eee89c5cb9be100b.js +0 -1
- package/POS/6485.c2b465a9b5ea1bd5.js +0 -1
- package/POS/7193.55fe0bf8af1c1a36.js +0 -1
- package/POS/7266.b8d9d44eed0958f9.js +0 -1
- package/POS/7928.16fd34d0aa0c75d2.js +0 -1
- package/POS/8131.245629b618bd877a.js +0 -1
- package/POS/8914.a12ab477eb441a70.js +0 -1
- package/POS/9564.0aadceb81f265d59.js +0 -1
- package/POS/common.e564793e9dbc56d0.js +0 -1
- package/POS/main.85e90c783aab0994.js +0 -1
- package/POS/runtime.5a3d8f44d7298dd5.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkPOS=self.webpackChunkPOS||[]).push([[1752],{44591:(P,D,o)=>{o.d(D,{W:()=>a,$:()=>g});var t=o(94650),_=o(36895),y=o(24006),C=o(65412),T=o(63165),S=o(93669);let M=(()=>{class i{constructor(e,r){this.dialogRef=e,this.data=r,this.inputNumberic=this.data.inputNumberic,this.message=this.data.messageData}ngOnInit(){}onOk(){this.dialogRef.close({inputNumberic:this.inputNumberic})}}return i.\u0275fac=function(e){return new(e||i)(t.Y36(C.so),t.Y36(C.WI))},i.\u0275cmp=t.Xpm({type:i,selectors:[["POS-modal-number-input"]],decls:3,vars:3,consts:[[3,"headerType","title","onOk","onCancel"],["autoNum","",1,"border","w-100","rounded","p-4",3,"ngModel","ngModelChange"]],template:function(e,r){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(){return r.onOk()})("onCancel",function(){return r.dialogRef.close()}),t.TgZ(1,"content")(2,"input",1),t.NdJ("ngModelChange",function(f){return r.inputNumberic=f}),t.qZA()()()),2&e&&(t.Q6J("headerType",r.message.Type)("title",r.message.Header),t.xp6(2),t.Q6J("ngModel",r.inputNumberic))},dependencies:[y.Fj,y.JJ,y.On,T.M]}),i})(),d=(()=>{class i{}return i.\u0275fac=function(e){return new(e||i)},i.\u0275mod=t.oAB({type:i}),i.\u0275inj=t.cJS({imports:[_.ez,S.dr,y.u5,y.UX,T.d]}),i})();var u=o(88796),l=o(67327),m=o(96700);class h{constructor(n=null,e=null,r=null){this.Type=n,this.Header=r,this.Body=e,this.Header||(this.Header=m.n[n])}}var v=o(76359),b=o(77091),I=o(97185);function E(i,n){if(1&i){const e=t.EpF();t.TgZ(0,"a",17),t.NdJ("click",function(){t.CHM(e);const p=t.oxw(),f=p.$implicit,O=p.index,x=t.oxw();return t.KtG(x.openSplitQuantity(f,O))}),t._UZ(1,"i",18),t.qZA()}}function s(i,n){if(1&i){const e=t.EpF();t.TgZ(0,"a",19),t.NdJ("click",function(){t.CHM(e);const p=t.oxw(),f=p.$implicit,O=p.index,x=t.oxw();return t.KtG(x.mergeItem(f,O))}),t._UZ(1,"i",20),t.qZA()}}function c(i,n){if(1&i){const e=t.EpF();t.TgZ(0,"tr")(1,"td",12),t._uU(2),t.qZA(),t.TgZ(3,"td"),t._uU(4),t.qZA(),t.TgZ(5,"td",12),t._uU(6),t.qZA(),t.TgZ(7,"td",13),t.YNc(8,E,2,0,"a",14),t.YNc(9,s,2,0,"a",15),t.qZA(),t.TgZ(10,"td",12),t._uU(11),t.ALo(12,"number"),t.qZA(),t.TgZ(13,"td",12),t._uU(14),t.ALo(15,"number"),t.qZA(),t.TgZ(16,"td")(17,"ng-select-infinite",16),t.NdJ("selectedChange",function(p){const O=t.CHM(e).$implicit;return t.KtG(O.SalesID=p)}),t.qZA()()()}if(2&i){const e=n.$implicit,r=n.index,p=t.oxw();t.xp6(2),t.Oqu(r+1),t.xp6(2),t.Oqu(e.Name),t.xp6(2),t.Oqu(e.Quantity),t.xp6(2),t.Q6J("ngIf",e.Quantity>1),t.xp6(1),t.Q6J("ngIf",p.displayMerge(e,r)),t.xp6(2),t.Oqu(t.lcZ(12,9,e.Commission)),t.xp6(3),t.Oqu(t.lcZ(15,11,e.Quantity*e.Commission)),t.xp6(3),t.Q6J("items",p.listSales)("selected",e.SalesID)}}let a=(()=>{class i{constructor(e,r,p){this._OrderHttpService=e,this.matDialog=r,this.toastr=p,this.commissionCart={},this.listSales=[],this.onSaved=new t.vpe,this.onBack=new t.vpe}ngOnInit(){l.gT.IsNotEmpty(this.soid)&&this._OrderHttpService.getCommission(this.soid).subscribe(e=>{this.commissionCart=e})}cancelCommission(){}saveCommission(){const e=this.commissionCart.List.filter(r=>l.gT.IsNotEmpty(r.SalesID));this._OrderHttpService.saveCommission(this.soid,e).subscribe(r=>{this.toastr.info(r,"Info"),this.onSaved.emit()})}displayMerge(e,r){const p=this.commissionCart.List.filter(O=>O.SalesOrderItemID==e.SalesOrderItemID);let f={};return r>0&&(f=this.commissionCart.List[r-1]),p.length>1&&f.SalesOrderItemID!=e.SalesOrderItemID}mergeItem(e,r){if(confirm("Are you sure to Merge ?")){const p=this.commissionCart.List.filter(O=>O.SalesOrderItemID==e.SalesOrderItemID);let f=0;p.forEach(O=>{f+=O.Quantity,O!=e&&this.commissionCart.List.splice(this.commissionCart.List.indexOf(O),1)}),e.Quantity=f}}openSplitQuantity(e,r){this.matDialog.open(M,{data:{messageData:new h(m.n.Success,"","Split Quantity?"),inputNumberic:1}}).afterClosed().subscribe(f=>{if(f)if(f.inputNumberic>=e.Quantity)alert("Split must less than Variant Quantity!");else{e.Quantity=e.Quantity-f.inputNumberic;const O=Object.assign(new Object,e);O.Quantity=f.inputNumberic,this.commissionCart.List.splice(this.commissionCart.List.indexOf(e)+1,0,O)}})}}return i.\u0275fac=function(e){return new(e||i)(t.Y36(b.D),t.Y36(C.uw),t.Y36(I._W))},i.\u0275cmp=t.Xpm({type:i,selectors:[["commission-cart"]],inputs:{commissionCart:"commissionCart",listSales:"listSales",soid:"soid"},outputs:{onSaved:"onSaved",onBack:"onBack"},decls:24,vars:1,consts:[[1,"table","table-bordered","w-100","mt-lg-5"],[1,"text-dark","fw-bold","p-3",2,"background-color","#FCECA3 !important"],[1,"border-end","text-end",2,"width","10px"],[1,"border-end"],[1,"border-end",2,"width","50px"],[1,"border-end","text-end",2,"width","150px"],[1,"border-end",2,"width","150px"],[4,"ngFor","ngForOf"],["id","CommissionAction"],[1,"d-flex","justify-content-end","mt-5"],[1,"btn","btn-outline-secondary","me-4","btn-lg",3,"click"],[1,"btn","btn-success","btn-lg",3,"click"],[1,"text-end"],[2,"width","50px"],["style","cursor:pointer","title","Split",3,"click",4,"ngIf"],["style","cursor:pointer","title","Merge",3,"click",4,"ngIf"],["bindValue","ID","bindLabel","Name","placeholder","Sales Person",3,"items","selected","selectedChange"],["title","Split",2,"cursor","pointer",3,"click"],[1,"fa-solid","fa-share-from-square"],["title","Merge",2,"cursor","pointer",3,"click"],[1,"fa-solid","fa-share-nodes"]],template:function(e,r){1&e&&(t.TgZ(0,"table",0)(1,"thead",1)(2,"tr")(3,"th",2),t._uU(4," No "),t.qZA(),t.TgZ(5,"th",3),t._uU(6," Name "),t.qZA(),t.TgZ(7,"th",4),t._uU(8," Qty "),t.qZA(),t._UZ(9,"th",3),t.TgZ(10,"th",5),t._uU(11," Commission "),t.qZA(),t.TgZ(12,"th",5),t._uU(13," Total "),t.qZA(),t.TgZ(14,"th",6),t._uU(15," Sales Person "),t.qZA()()(),t.TgZ(16,"tbody"),t.YNc(17,c,18,13,"tr",7),t.qZA()(),t.TgZ(18,"div",8)(19,"div",9)(20,"a",10),t.NdJ("click",function(){return r.onBack.emit()}),t._uU(21,"Cancel"),t.qZA(),t.TgZ(22,"a",11),t.NdJ("click",function(){return r.saveCommission()}),t._uU(23,"Save"),t.qZA()()()),2&e&&(t.xp6(17),t.Q6J("ngForOf",r.commissionCart.List))},dependencies:[_.sg,_.O5,v.R,_.JJ]}),i})(),g=(()=>{class i{}return i.\u0275fac=function(e){return new(e||i)},i.\u0275mod=t.oAB({type:i}),i.\u0275inj=t.cJS({imports:[_.ez,S.dr,y.u5,y.UX,d,u.A0,v.q]}),i})()},34915:(P,D,o)=>{o.d(D,{u:()=>t});class t{constructor(){this.Success=!0,this.Message="",this.ObjectID="",this.SalesOrderID="",this.OutDeliveryID="",this.Contact=null,this.LoyaltyPoint="",this.InvoiceNumber="",this.Creator="",this.OrderTimeString="",this.PrintMode=0,this.PaymentStateID=0,this.PaymentStateLabel="",this.Final=0}}},77091:(P,D,o)=>{o.d(D,{D:()=>b});var t=o(42763),_=o(75033),y=o(34915),C=o(67327),T=o(61135),S=o(49808),M=o(71884),d=o(39300),u=o(94650),l=o(89156),m=o(13337),h=o(29099),v=o(97185);let b=(()=>{class I{constructor(s,c,a,g){this.httpService=s,this._localDataService=c,this._onlineStatusService=a,this._toastrService=g,this._Data=new T.X(null),this.Data$=this._Data.pipe((0,M.x)(),(0,d.h)(i=>null!==i)),this._onlineStatusService.getOnlineStatus$().subscribe(i=>{this.isOnline=i})}get Data(){return this._Data.value}pushNewValue(s){this._Data.next(s)}getSalesOrderPrint(s){return this.httpService.post("/API/POS/GetSalesOrderPrint",{TemplateID:s})}submitOnline(s){return this.httpService.post("/API/POS/SubmitOrder",s,1e4)}generatePOSDataForSubmission(s,c=!0){const a=Object.assign(new _.m,s);a.Items=[],null==a.Order.CustomerID&&(a.Order.CustomerID=C.gT.GuidEmpty),null==a.Order.SalesID&&(a.Order.SalesID=C.gT.GuidEmpty);let g=1;a.Payments=a.Payments.map(n=>(n.Date=a.Order.Date,n.Index=g,g++,delete n.TypeID,n));let i=1;for(const n of a.CartItems){const e=new t.N;e.ID=n.ID,e.VariantID=n.VariantID,e.Quantity=n.Quantity,e.Cost=n.Cost,e.Price=n.Price,e.Discount=n.Discount,e.DiscountAmount=n.DiscountAmount,e.Note=n.Note,e.Taxable=n.Variant.Taxable,e.LoyaltyPoint=n.LoyaltyPoint,e.UnitCost=n.Cost,e.UnitPrice=n.Price,e.UnitPriceOriginal=n.UnitPriceOriginal,e.UnitExpense=n.UnitExpense,e.EntityID=n.EntityID,e.Index=i,e.UnitQuantity=n.UnitQuantity,e.PriceTypeID=n.PriceTypeID,e.PriceNote=n.PriceNote,e.Splited=n.SplitQuantity>0,e.SplitQuantity=n.SplitQuantity,e.InventoryTypeID=n.Variant.TypeID,e.SalesID="",e.Serial.length<1&&delete e.Serial,delete e.SamePark,n.SalesID&&(e.SalesID=n.SalesID),a.Items.push(e),i++}return c?(delete a.CartItems,delete a.Order.ClientTimestamp):a.Order.ClientTimestamp=new Date,a}generateCompleteData(s){const c=new y.u;return c.InvoiceNumber=s.Order.Number,c.OrderTimeString=(new Date).toString(),c.PaymentStateID=s.Action.Type,c.Success=!0,c.OutDeliveryID=s.Action.DeliveryEntityID,c}submitOrder(s,c){return new Promise((a,g)=>{const i=this.generatePOSDataForSubmission(s,this.isOnline);this.isOnline?c.ModuleSell.EnableAutomaticallyUploadOfflineOrder?this._localDataService.uploadOrders().subscribe({complete:()=>{(0,S.n)(this.submitOnline(i)).then(n=>{a(n)},n=>{g(n)})},error:n=>{g(n)}}):(0,S.n)(this.submitOnline(i)).then(n=>{a(n)},n=>{g(n)}):c.ModuleSell.EnableOfflineTransaction?c.ModuleSell.EnableOfflineTransactionSaveStorage?this._localDataService.syncOrder(i).subscribe({next:()=>{a(this.generateCompleteData(i))},error:n=>{console.error(n),this._toastrService.error(C.g7.failToSyncOrder,"Error")}}):a(this.generateCompleteData(i)):this._toastrService.warning("Offline order is not Supported!","Info!")})}GetReturnInvoice(s,c){return this.httpService.post(C.Wz.ReturInvoice,{EntityID:c,InvoiceNumber:s})}GetInvoiceBySoID(s){return this.httpService.post(C.Wz.GetPOSDataByID,{OrderID:s})}UploadCSV(s,c){return this.httpService.post(C.Wz.UploadCsv,{csv:s,entityID:c})}sendEmail(s,c){return new Promise((a,g)=>{this._localDataService.isProductFromServer().subscribe(i=>{if(i){const e='Email is sent successfully to" '+s+'"';this.httpService.post(C.Wz.SendInvoiceEmail,{invoiceID:c,email:s}).subscribe(()=>a(e),r=>g(r))}else g(C.g7.wrongOfflineAction)})})}getCommission(s){return this.httpService.post("/API/Transaction/GetCommission",JSON.stringify(s))}saveCommission(s,c){return this.httpService.POSText("/API/Transaction/SetCommission",{SOID:s,commission:c})}generateReceiptA4(s){return this.httpService.post(C.Wz.InvoiceA4,{ID:s})}getVacant(s){return this.httpService.post(C.Wz.GetVacant,{EntityID:s})}}return I.\u0275fac=function(s){return new(s||I)(u.LFG(l.O),u.LFG(m.T),u.LFG(h.q),u.LFG(v._W))},I.\u0275prov=u.Yz7({token:I,factory:I.\u0275fac,providedIn:"root"}),I})()},64425:(P,D,o)=>{o.d(D,{Iq:()=>M,TU:()=>C,i3:()=>S});var t=o(36895),_=o(94650);class y{constructor(u,l){this._document=l;const m=this._textarea=this._document.createElement("textarea"),h=m.style;h.position="fixed",h.top=h.opacity="0",h.left="-999em",m.setAttribute("aria-hidden","true"),m.value=u,m.readOnly=!0,this._document.body.appendChild(m)}copy(){const u=this._textarea;let l=!1;try{if(u){const m=this._document.activeElement;u.select(),u.setSelectionRange(0,u.value.length),l=this._document.execCommand("copy"),m&&m.focus()}}catch{}return l}destroy(){const u=this._textarea;u&&(u.remove(),this._textarea=void 0)}}let C=(()=>{class d{constructor(l){this._document=l}copy(l){const m=this.beginCopy(l),h=m.copy();return m.destroy(),h}beginCopy(l){return new y(l,this._document)}}return d.\u0275fac=function(l){return new(l||d)(_.LFG(t.K0))},d.\u0275prov=_.Yz7({token:d,factory:d.\u0275fac,providedIn:"root"}),d})();const T=new _.OlP("CDK_COPY_TO_CLIPBOARD_CONFIG");let S=(()=>{class d{constructor(l,m,h){this._clipboard=l,this._ngZone=m,this.text="",this.attempts=1,this.copied=new _.vpe,this._pending=new Set,h&&null!=h.attempts&&(this.attempts=h.attempts)}copy(l=this.attempts){if(l>1){let m=l;const h=this._clipboard.beginCopy(this.text);this._pending.add(h);const v=()=>{const b=h.copy();b||!--m||this._destroyed?(this._currentTimeout=null,this._pending.delete(h),h.destroy(),this.copied.emit(b)):this._currentTimeout=this._ngZone.runOutsideAngular(()=>setTimeout(v,1))};v()}else this.copied.emit(this._clipboard.copy(this.text))}ngOnDestroy(){this._currentTimeout&&clearTimeout(this._currentTimeout),this._pending.forEach(l=>l.destroy()),this._pending.clear(),this._destroyed=!0}}return d.\u0275fac=function(l){return new(l||d)(_.Y36(C),_.Y36(_.R0b),_.Y36(T,8))},d.\u0275dir=_.lG2({type:d,selectors:[["","cdkCopyToClipboard",""]],hostBindings:function(l,m){1&l&&_.NdJ("click",function(){return m.copy()})},inputs:{text:["cdkCopyToClipboard","text"],attempts:["cdkCopyToClipboardAttempts","attempts"]},outputs:{copied:"cdkCopyToClipboardCopied"}}),d})(),M=(()=>{class d{}return d.\u0275fac=function(l){return new(l||d)},d.\u0275mod=_.oAB({type:d}),d.\u0275inj=_.cJS({}),d})()}}]);
|
|
1
|
+
"use strict";(self.webpackChunkPOS=self.webpackChunkPOS||[]).push([[1752],{44591:(P,D,r)=>{r.d(D,{W:()=>a,$:()=>g});var t=r(94650),_=r(36895),y=r(24006),C=r(65412),T=r(63165),S=r(93669);let M=(()=>{class i{constructor(e,o){this.dialogRef=e,this.data=o,this.inputNumberic=this.data.inputNumberic,this.message=this.data.messageData}ngOnInit(){}onOk(){this.dialogRef.close({inputNumberic:this.inputNumberic})}}return i.\u0275fac=function(e){return new(e||i)(t.Y36(C.so),t.Y36(C.WI))},i.\u0275cmp=t.Xpm({type:i,selectors:[["POS-modal-number-input"]],decls:3,vars:3,consts:[[3,"headerType","title","onOk","onCancel"],["autoNum","",1,"border","w-100","rounded","p-4",3,"ngModel","ngModelChange"]],template:function(e,o){1&e&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(){return o.onOk()})("onCancel",function(){return o.dialogRef.close()}),t.TgZ(1,"content")(2,"input",1),t.NdJ("ngModelChange",function(f){return o.inputNumberic=f}),t.qZA()()()),2&e&&(t.Q6J("headerType",o.message.Type)("title",o.message.Header),t.xp6(2),t.Q6J("ngModel",o.inputNumberic))},dependencies:[y.Fj,y.JJ,y.On,T.M]}),i})(),d=(()=>{class i{}return i.\u0275fac=function(e){return new(e||i)},i.\u0275mod=t.oAB({type:i}),i.\u0275inj=t.cJS({imports:[_.ez,S.dr,y.u5,y.UX,T.d]}),i})();var u=r(88796),l=r(67327),m=r(96700);class h{constructor(n=null,e=null,o=null){this.Type=n,this.Header=o,this.Body=e,this.Header||(this.Header=m.n[n])}}var v=r(76359),b=r(77091),I=r(97185);function E(i,n){if(1&i){const e=t.EpF();t.TgZ(0,"a",17),t.NdJ("click",function(){t.CHM(e);const p=t.oxw(),f=p.$implicit,O=p.index,x=t.oxw();return t.KtG(x.openSplitQuantity(f,O))}),t._UZ(1,"i",18),t.qZA()}}function s(i,n){if(1&i){const e=t.EpF();t.TgZ(0,"a",19),t.NdJ("click",function(){t.CHM(e);const p=t.oxw(),f=p.$implicit,O=p.index,x=t.oxw();return t.KtG(x.mergeItem(f,O))}),t._UZ(1,"i",20),t.qZA()}}function c(i,n){if(1&i){const e=t.EpF();t.TgZ(0,"tr")(1,"td",12),t._uU(2),t.qZA(),t.TgZ(3,"td"),t._uU(4),t.qZA(),t.TgZ(5,"td",12),t._uU(6),t.qZA(),t.TgZ(7,"td",13),t.YNc(8,E,2,0,"a",14),t.YNc(9,s,2,0,"a",15),t.qZA(),t.TgZ(10,"td",12),t._uU(11),t.ALo(12,"number"),t.qZA(),t.TgZ(13,"td",12),t._uU(14),t.ALo(15,"number"),t.qZA(),t.TgZ(16,"td")(17,"ng-select-infinite",16),t.NdJ("selectedChange",function(p){const O=t.CHM(e).$implicit;return t.KtG(O.SalesID=p)}),t.qZA()()()}if(2&i){const e=n.$implicit,o=n.index,p=t.oxw();t.xp6(2),t.Oqu(o+1),t.xp6(2),t.Oqu(e.Name),t.xp6(2),t.Oqu(e.Quantity),t.xp6(2),t.Q6J("ngIf",e.Quantity>1),t.xp6(1),t.Q6J("ngIf",p.displayMerge(e,o)),t.xp6(2),t.Oqu(t.lcZ(12,9,e.Commission)),t.xp6(3),t.Oqu(t.lcZ(15,11,e.Quantity*e.Commission)),t.xp6(3),t.Q6J("items",p.listSales)("selected",e.SalesID)}}let a=(()=>{class i{constructor(e,o,p){this._OrderHttpService=e,this.matDialog=o,this.toastr=p,this.commissionCart={},this.listSales=[],this.onSaved=new t.vpe,this.onBack=new t.vpe}ngOnInit(){l.gT.IsNotEmpty(this.soid)&&this._OrderHttpService.getCommission(this.soid).subscribe(e=>{this.commissionCart=e})}cancelCommission(){}saveCommission(){const e=this.commissionCart.List.filter(o=>l.gT.IsNotEmpty(o.SalesID));this._OrderHttpService.saveCommission(this.soid,e).subscribe(o=>{this.toastr.info(o,"Info"),this.onSaved.emit()})}displayMerge(e,o){const p=this.commissionCart.List.filter(O=>O.SalesOrderItemID==e.SalesOrderItemID);let f={};return o>0&&(f=this.commissionCart.List[o-1]),p.length>1&&f.SalesOrderItemID!=e.SalesOrderItemID}mergeItem(e,o){if(confirm("Are you sure to Merge ?")){const p=this.commissionCart.List.filter(O=>O.SalesOrderItemID==e.SalesOrderItemID);let f=0;p.forEach(O=>{f+=O.Quantity,O!=e&&this.commissionCart.List.splice(this.commissionCart.List.indexOf(O),1)}),e.Quantity=f}}openSplitQuantity(e,o){this.matDialog.open(M,{data:{messageData:new h(m.n.Success,"","Split Quantity?"),inputNumberic:1}}).afterClosed().subscribe(f=>{if(f)if(f.inputNumberic>=e.Quantity)alert("Split must less than Variant Quantity!");else{e.Quantity=e.Quantity-f.inputNumberic;const O=Object.assign(new Object,e);O.Quantity=f.inputNumberic,this.commissionCart.List.splice(this.commissionCart.List.indexOf(e)+1,0,O)}})}}return i.\u0275fac=function(e){return new(e||i)(t.Y36(b.D),t.Y36(C.uw),t.Y36(I._W))},i.\u0275cmp=t.Xpm({type:i,selectors:[["commission-cart"]],inputs:{commissionCart:"commissionCart",listSales:"listSales",soid:"soid"},outputs:{onSaved:"onSaved",onBack:"onBack"},decls:24,vars:1,consts:[[1,"table","table-bordered","w-100","mt-lg-5"],[1,"text-dark","fw-bold","p-3",2,"background-color","#FCECA3 !important"],[1,"border-end","text-end",2,"width","10px"],[1,"border-end"],[1,"border-end",2,"width","50px"],[1,"border-end","text-end",2,"width","150px"],[1,"border-end",2,"width","150px"],[4,"ngFor","ngForOf"],["id","CommissionAction"],[1,"d-flex","justify-content-end","mt-5"],[1,"btn","btn-outline-secondary","me-4","btn-lg",3,"click"],[1,"btn","btn-success","btn-lg",3,"click"],[1,"text-end"],[2,"width","50px"],["style","cursor:pointer","title","Split",3,"click",4,"ngIf"],["style","cursor:pointer","title","Merge",3,"click",4,"ngIf"],["bindValue","ID","bindLabel","Name","placeholder","Sales Person",3,"items","selected","selectedChange"],["title","Split",2,"cursor","pointer",3,"click"],[1,"fa-solid","fa-share-from-square"],["title","Merge",2,"cursor","pointer",3,"click"],[1,"fa-solid","fa-share-nodes"]],template:function(e,o){1&e&&(t.TgZ(0,"table",0)(1,"thead",1)(2,"tr")(3,"th",2),t._uU(4," No "),t.qZA(),t.TgZ(5,"th",3),t._uU(6," Name "),t.qZA(),t.TgZ(7,"th",4),t._uU(8," Qty "),t.qZA(),t._UZ(9,"th",3),t.TgZ(10,"th",5),t._uU(11," Commission "),t.qZA(),t.TgZ(12,"th",5),t._uU(13," Total "),t.qZA(),t.TgZ(14,"th",6),t._uU(15," Sales Person "),t.qZA()()(),t.TgZ(16,"tbody"),t.YNc(17,c,18,13,"tr",7),t.qZA()(),t.TgZ(18,"div",8)(19,"div",9)(20,"a",10),t.NdJ("click",function(){return o.onBack.emit()}),t._uU(21,"Cancel"),t.qZA(),t.TgZ(22,"a",11),t.NdJ("click",function(){return o.saveCommission()}),t._uU(23,"Save"),t.qZA()()()),2&e&&(t.xp6(17),t.Q6J("ngForOf",o.commissionCart.List))},dependencies:[_.sg,_.O5,v.R,_.JJ]}),i})(),g=(()=>{class i{}return i.\u0275fac=function(e){return new(e||i)},i.\u0275mod=t.oAB({type:i}),i.\u0275inj=t.cJS({imports:[_.ez,S.dr,y.u5,y.UX,d,u.A0,v.q]}),i})()},34915:(P,D,r)=>{r.d(D,{u:()=>t});class t{constructor(){this.Success=!0,this.Message="",this.ObjectID="",this.SalesOrderID="",this.OutDeliveryID="",this.Contact=null,this.LoyaltyPoint="",this.InvoiceNumber="",this.Creator="",this.OrderTimeString="",this.PrintMode=0,this.PaymentStateID=0,this.PaymentStateLabel="",this.Final=0}}},77091:(P,D,r)=>{r.d(D,{D:()=>b});var t=r(42763),_=r(75033),y=r(34915),C=r(67327),T=r(61135),S=r(49808),M=r(71884),d=r(39300),u=r(94650),l=r(89156),m=r(13337),h=r(29099),v=r(97185);let b=(()=>{class I{constructor(s,c,a,g){this.httpService=s,this._localDataService=c,this._onlineStatusService=a,this._toastrService=g,this._Data=new T.X(null),this.Data$=this._Data.pipe((0,M.x)(),(0,d.h)(i=>null!==i)),this._onlineStatusService.getOnlineStatus$().subscribe(i=>{this.isOnline=i})}get Data(){return this._Data.value}pushNewValue(s){this._Data.next(s)}getSalesOrderPrint(s){return this.httpService.post("/API/POS/GetSalesOrderPrint",{TemplateID:s})}submitOnline(s){return this.httpService.post("/API/POS/SubmitOrder",s,1e4)}generatePOSDataForSubmission(s,c=!0){const a=Object.assign(new _.m,s);a.Items=[],null==a.Order.CustomerID&&(a.Order.CustomerID=C.gT.GuidEmpty),null==a.Order.SalesID&&(a.Order.SalesID=C.gT.GuidEmpty);let g=1;a.Payments=a.Payments.map(n=>(n.Date=a.Order.Date,n.Index=g,g++,delete n.TypeID,n));let i=1;for(const n of a.CartItems){const e=new t.N;e.ID=n.ID,e.VariantID=n.VariantID,e.Quantity=n.Quantity,e.Cost=n.Cost,e.Price=n.Price,e.Discount=n.Discount,e.DiscountAmount=n.DiscountAmount,e.Note=n.Note,e.Taxable=n.Variant.Taxable,e.LoyaltyPoint=n.LoyaltyPoint,e.UnitCost=n.Cost,e.UnitPrice=n.Price,e.UnitPriceOriginal=n.UnitPriceOriginal,e.UnitExpense=n.UnitExpense,e.EntityID=n.EntityID,e.Index=i,e.UnitQuantity=n.UnitQuantity,e.PriceTypeID=n.PriceTypeID,e.PriceNote=n.PriceNote,e.Splited=n.SplitQuantity>0,e.SplitQuantity=n.SplitQuantity,e.InventoryTypeID=n.Variant.TypeID,e.SalesID="",e.Serial.length<1&&delete e.Serial,delete e.SamePark,n.SalesID&&(e.SalesID=n.SalesID),a.Items.push(e),i++}return c?(delete a.CartItems,delete a.Order.ClientTimestamp):a.Order.ClientTimestamp=new Date,a}generateCompleteData(s){const c=new y.u;return c.InvoiceNumber=s.Order.Number,c.OrderTimeString=(new Date).toString(),c.PaymentStateID=s.Action.Type,c.Success=!0,c.OutDeliveryID=s.Action.DeliveryEntityID,c}submitOrder(s,c){return new Promise((a,g)=>{const i=this.generatePOSDataForSubmission(s,this.isOnline);this.isOnline?c.ModuleSell.EnableAutomaticallyUploadOfflineOrder?this._localDataService.uploadOrders().subscribe({complete:()=>{(0,S.n)(this.submitOnline(i)).then(n=>{a(n)},n=>{g(n)})},error:n=>{g(n)}}):(0,S.n)(this.submitOnline(i)).then(n=>{a(n)},n=>{g(n)}):c.ModuleSell.EnableOfflineTransaction?c.ModuleSell.EnableOfflineTransactionSaveStorage?this._localDataService.syncOrder(i).subscribe({next:()=>{a(this.generateCompleteData(i))},error:n=>{console.error(n),this._toastrService.error(C.g7.failToSyncOrder,"Error")}}):a(this.generateCompleteData(i)):this._toastrService.warning("Offline order is not Supported!","Info!")})}GetReturnInvoice(s,c){return this.httpService.post(C.Wz.ReturInvoice,{EntityID:c,InvoiceNumber:s})}GetInvoiceBySoID(s){return this.httpService.post(C.Wz.GetPOSDataByID,{OrderID:s})}UploadCSV(s,c){return this.httpService.post(C.Wz.UploadCsv,{csv:s,entityID:c})}sendEmail(s,c){return new Promise((a,g)=>{this._localDataService.isProductFromServer().subscribe(i=>{i?this.httpService.post(C.Wz.SendInvoiceEmail,{invoiceID:c,email:s}).subscribe({next:o=>{a(o)},error:o=>{g(o)}}):g(C.g7.wrongOfflineAction)})})}getCommission(s){return this.httpService.post("/API/Transaction/GetCommission",JSON.stringify(s))}saveCommission(s,c){return this.httpService.POSText("/API/Transaction/SetCommission",{SOID:s,commission:c})}generateReceiptA4(s){return this.httpService.post(C.Wz.InvoiceA4,{ID:s})}getVacant(s){return this.httpService.post(C.Wz.GetVacant,{EntityID:s})}}return I.\u0275fac=function(s){return new(s||I)(u.LFG(l.O),u.LFG(m.T),u.LFG(h.q),u.LFG(v._W))},I.\u0275prov=u.Yz7({token:I,factory:I.\u0275fac,providedIn:"root"}),I})()},64425:(P,D,r)=>{r.d(D,{Iq:()=>M,TU:()=>C,i3:()=>S});var t=r(36895),_=r(94650);class y{constructor(u,l){this._document=l;const m=this._textarea=this._document.createElement("textarea"),h=m.style;h.position="fixed",h.top=h.opacity="0",h.left="-999em",m.setAttribute("aria-hidden","true"),m.value=u,m.readOnly=!0,this._document.body.appendChild(m)}copy(){const u=this._textarea;let l=!1;try{if(u){const m=this._document.activeElement;u.select(),u.setSelectionRange(0,u.value.length),l=this._document.execCommand("copy"),m&&m.focus()}}catch{}return l}destroy(){const u=this._textarea;u&&(u.remove(),this._textarea=void 0)}}let C=(()=>{class d{constructor(l){this._document=l}copy(l){const m=this.beginCopy(l),h=m.copy();return m.destroy(),h}beginCopy(l){return new y(l,this._document)}}return d.\u0275fac=function(l){return new(l||d)(_.LFG(t.K0))},d.\u0275prov=_.Yz7({token:d,factory:d.\u0275fac,providedIn:"root"}),d})();const T=new _.OlP("CDK_COPY_TO_CLIPBOARD_CONFIG");let S=(()=>{class d{constructor(l,m,h){this._clipboard=l,this._ngZone=m,this.text="",this.attempts=1,this.copied=new _.vpe,this._pending=new Set,h&&null!=h.attempts&&(this.attempts=h.attempts)}copy(l=this.attempts){if(l>1){let m=l;const h=this._clipboard.beginCopy(this.text);this._pending.add(h);const v=()=>{const b=h.copy();b||!--m||this._destroyed?(this._currentTimeout=null,this._pending.delete(h),h.destroy(),this.copied.emit(b)):this._currentTimeout=this._ngZone.runOutsideAngular(()=>setTimeout(v,1))};v()}else this.copied.emit(this._clipboard.copy(this.text))}ngOnDestroy(){this._currentTimeout&&clearTimeout(this._currentTimeout),this._pending.forEach(l=>l.destroy()),this._pending.clear(),this._destroyed=!0}}return d.\u0275fac=function(l){return new(l||d)(_.Y36(C),_.Y36(_.R0b),_.Y36(T,8))},d.\u0275dir=_.lG2({type:d,selectors:[["","cdkCopyToClipboard",""]],hostBindings:function(l,m){1&l&&_.NdJ("click",function(){return m.copy()})},inputs:{text:["cdkCopyToClipboard","text"],attempts:["cdkCopyToClipboardAttempts","attempts"]},outputs:{copied:"cdkCopyToClipboardCopied"}}),d})(),M=(()=>{class d{}return d.\u0275fac=function(l){return new(l||d)},d.\u0275mod=_.oAB({type:d}),d.\u0275inj=_.cJS({}),d})()}}]);
|