PageSourceSearch

https://sohopizza.co.th/362.1e6a1d36d388357d.js

js sohopizza.co.th collected 2026-09-29 02:54:32 UTC 9,970 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkfoodie_project=self.webpackChunkfoodie_project||[]).push([[362],{5362:(ne,R,i)=>{i.d(R,{Z:()=>Ee});var A=i(5861),m=i(9862),r=i(3190),b=i(4711),S=i(2096),P=i(7398),se=i(7715),x=i(708),ae=i(9315),W=i(4664),de=i(5592),ce=i(9397),le=i(6676),d=i.n(le),w=i(9203),ue=i(9851),M=i(9027),De=i(8504),g=i(6689),he=i(8202),_e=i(4873),fe=i(5787);let Ee=(()=>{var y;class G{constructor(e,c,s,D){this._cart=e,this._auth=c,this._foodie=s,this._http=D,this._paymentItems=[{value:r.u.Cash,label:"Cash on delivery",icon:"cash.svg",visible:(o,n)=>{const _=o.BrandConfig.StoreSetting;return _.CashMode&&n<=_.CashOrderLimit}},{value:r.u.CreditCard,label:"Credit Card",icon:"credit-card.svg",visible:o=>o.BrandConfig.StoreSetting.CreditCardMode},{value:r.u.PromptPay,label:"Prompt Pay",icon:"promptpay.svg",visible:o=>o.BrandConfig.StoreSetting.PromptPay},{value:r.u.KBank,label:"KBank Mobile Banking",icon:"kbank.svg",visible:(o,n)=>o.BrandConfig.StoreSetting.KbankMobile&&n>=450},{value:r.u.TrueMoney,label:"TRUE Money Wallet",icon:"other.svg",visible:o=>o.BrandConfig.StoreSetting.TrueWallet}]}get invoiceSymbolsArray(){return"::"}loadPaymentTypeItems(){return(0,S.of)(this._paymentItems)}loadOrder(e,c){return this._http.post("/api/Order/GetById",{Id:e,OrderCode:c}).pipe((0,P.U)(s=>{if(!s)throw new Error("Not found order data");return s}))}validatePreOrderTime(e,c,s,D,o){var n=this;return(0,se.D)(new Promise(function(){var _=(0,A.Z)(function*(f,u){try{if(D||(D=n._foodie.currentBranch),!D)throw new Error("Not found branch data");if(!e||!c||!s)throw new Error("Pre Order Time is invalid");const B=`${d()(e).format("YYYY-MM-DD")} ${c}:${s}:00`,L=d()(B,"YYYY-MM-DD HH:mm:ss").toDate(),F=(o?d()(o):yield(0,x.n)(n._foodie.serverDateTime.pipe((0,P.U)(v=>d()(v)))),d()(L)),h=yield(0,x.n)(n._foodie.loadBrandOperatingConfig(e));if(!h)throw new Error("Cannot load operating time");if(h.BrandOperatingTime.IsClosed&&"Break Time"!=h.BrandOperatingTime.Day)throw new Error("The brand is closed");if(h.BranchOperatingTime.IsClosed&&"Break Time"!=h.BranchOperatingTime.Day)throw new Error("The store is closed");if(yield(0,x.n)(n.getBranchHoliday(L)))throw yield(0,x.n)(n._foodie.loadErrorMessage("FDWEB0083")).then(v=>new w.f(v.message,v.title));f(F.toDate())}catch(B){u(B)}});return function(f,u){return _.apply(this,arguments)}}()))}saveOrder(e,c=!0,s=!1,D=!1){return(0,ae.D)([this._auth.loadUserProfile(D),this._foodie.loadBrandInfo(s),this._foodie.loadAllBranch(s),this._cart.calculateDiscountPromotions(e.promotions,e.distance?.DeliveryFee||0)]).pipe((0,W.w)(([o,n,_,f])=>new de.y(u=>{if(n.IsOffline)return void this._foodie.loadErrorMessage("FDWEB0082").subscribe({next:t=>u.error(t),error:t=>u.error(t),complete:()=>u.complete()});const E=this._cart.orderId,I=d()(e.orderDate).toISOString(),B=d()(e.orderDate).format("HH:mm"),L=e.deliveryDate?d()(e.deliveryDate).format("YYYY-MM-DD"):d()(I).format("YYYY-MM-DD"),j=e.deliveryDate?d()(e.deliveryDate).format("HH:mm"):B,F=this._foodie.currentLocation,h=this._foodie.currentBranch,v=this._auth.userLogin;if(!_.find(t=>t.Id==h.id))throw new w.f(`Sorry store "${h.name}" is not active, please change another store`,"Store is not active");const pe=e.deliveryType,J=e.deliveryMode||this._foodie.deliveryMode,z=J==b.N.Pickup,$=z?0:e.deliveryFree||0,Ce=parseFloat(Math.ceil(e.distance?.Distance||0).toFixed(2)),Q=this._cart.quantity,V=this._cart.items,N=this._cart.calculateProductItems(V),X=N-f.discount,Z=this._cart.calculateTotalPrice({subTotal:N,discount:f.discount,deliveryFree:$}),q=n.VATInclude?0:this._cart.calculateVat(n.VatDeliveryFee?Z:X),ee=Math.round(Z+q),Pe=f.deliveryFreeDiscount,ye=e.remark.checked?e.remark.input:"",te=this.invoiceSymbolsArray,K=e.invoice.checked?[e.invoice.input.company,e.invoice.input.tax,e.invoice.input.address1,e.invoice.input.address2,e.invoice.input.address3].join(te):"",oe=K?e.invoice.input.tax:"",re=c?K:K.split(te).filter(t=>!t.includes(oe)).map(t=>t.trim()).join(" ").trim();let ie;if(e.earnPoint.checked){const t=o.Loyalty;ie={LoyaltyId:t.Id,PointBalance:t.TotalPoint,Burn:e.earnPoint.amount}}e.paymentType==r.u.None&&(e.paymentType=r.u.CreditCard);const a={Id:E,CustomerId:v.id,CustomerIdWeb:v.id,BranchId:h.id,BranchName:h.name,TaxId:oe,BillingAddressText:re,BillingAddressCustom:re,ContactNumber:o.PhoneNumber,DeliveryAddressId:z?null:F?.addressId||null,DeliveryFee:$,DeliveryDate:L,DeliveryTime:j,DeliveryType:pe,Distance:Ce,LanguageCode:e.language?.code||"en",OrderBy:v.email,OrderDate:I,OrderRemarks:ye,PickupAtBranch:J==b.N.Pickup?1:0,RequireCutlery:e.cutlery?.checked||!1,RequireTaxInvoice:e.invoice?.checked||!1,IsRequireTaxInvoice:e.invoice?.checked||!1,SubTotal:N,TotalAmount:N,TotalQty:Q,TotalQtyAfterPro:Q,TotalAmountAfterPro:X,TotalPay:ee,NetAmount:ee,UserBy:`${o.FirstNameEN} ${o.LastNameEN}`,VAT:q,IsDraft:c,Paymode:e.createPaymentLink?r.u.CreditCard:e.paymentType,Channel:this._auth.userLogin?.channel||De.b.Website,DeliveryFeeDiscount:Pe,OrderForElse:e.forElse.checked,OrderElseRemark:e.forElse.checked?e.forElse.input:"",PointUsage:ie,CreatePaymentLink:e.createPaymentLink,OrderPromotions:[],OrderDetails:[],IsMealPlanning:!1,CouponAmount:0,CouponCode:"",CouponId:0,TotalPointsEarned:0,Affiliate
1Code:null,TotalCalories:0,IsEditMode:!1,AmountChange:0,CashRemark:""};if(this._cart.orderCoupons.length>0){const{promotionId:t,code:l,couponId:O}=this._cart.orderCoupons[0],H=e.promotions.find(U=>U.PromotionId==t);a.CouponId=O||t,a.CouponCode=l,a.CouponAmount=H?.Amount||1}const k=this._cart.items.find(t=>t.type===M.Jv.MealPlanning);k&&(a.IsMealPlanning=!0,a.DeliveryDate=d()(k.inputRefs.date).format("YYYY-MM-DD"),a.DeliveryTime=d()(k.inputRefs.time).format("HH:mm")),a.CustomerMetaData=e.userInfo&&this._auth.userLogin?{customerId:this._auth.userLogin.id,firstName:e.userInfo.firstname,lastName:e.userInfo.lastname,email:e.userInfo.email}:{customerId:o.Id,firstName:o.FirstNameEN,lastName:o.LastNameEN,email:o.Email},a.OrderBy=a.CustomerMetaData.email,a.UserBy=`${a.CustomerMetaData.firstName} ${a.CustomerMetaData.lastName}`,V.forEach(t=>{if(!t.reference)throw new Error("Not found product references");if(t.type==M.Jv.ProductFreeAutoAdd)return;const l=t.reference.product,O=t.reference.sizes.find(p=>p.SizeId==t.sizeId),H=t.reference.options;if(!O)throw new Error("Not found product size");const U=[];H.forEach(p=>{t.options.map(C=>{const T=p.ExtraOptionDetails.find(Te=>Te.ExtraOptionDetailId==C.id);T&&U.push({Id:1,OrderId:E,DishId:O.DishId,CurrencyCode:T.CurrencyCode,ExtraOptionDetailId:T.ExtraOptionDetailId,ExtraOptionEN:T.ExtraOptionEN,ExtraOptionTH:T.ExtraOptionTH,ExtraOptionJP:T.ExtraOptionJP,ExtraOptionGroupId:p.ExtraOptionGroupId,ExtraOptionGroupEN:p.ExtraOptionGroupEN,ExtraOptionGroupTH:p.ExtraOptionGroupTH,ExtraOptionGroupJP:p.ExtraOptionGroupJP,OrderDetailId:0,Price:C.price,Qty:C.qty,TotalAmount:this._cart.calculateProductOptionItem(C),DishExtraOptionPortionId:C.portion?.id,ExtraOptionPortion:C.portion?.name,PortionPrice:C.portion?.price})})});let Y=t.request;[M.Jv.ProductFreeAutoAdd,M.Jv.ProductFreeUserAdd].includes(t.type)&&(Y=""),t.type==M.Jv.MealPlanning&&(Y=`Deliver on ${d()(t.inputRefs.date).format("DD-MM-YYYY")} at ${d()(t.inputRefs.time).format("HH:mm")} hours`),a.OrderDetails.push({Id:0,OrderId:E,DishId:t.id,DishName:l.DishNameEN,DishNameTH:l.DishNameTH,DishNameJP:l.DishNameJP,DishSetId:l.SetId,Note:Y,Price:this._cart.calculateProductItemWithOutQty(t),Qty:t.quantity,SetId:l.SetId,SizeDesc:O.SizeDesc,SizeId:t.sizeId,TotalAmount:this._cart.calculateProductItem(t),UseCode:l.UseCode,DishDescriptionEN:l.DishDesciptionEN,DishDescriptionTH:l.DishDesciptionTH,DishDescriptionJP:l.DishDesciptionJP,Options:[],Extras:U,UsedPoint:O.Point,DishSetTitle:""})}),e.promotions.forEach(t=>{a.OrderPromotions.push({Id:0,Amount:t.Amount,CreateDate:I,DeliveryFeeType:t.DeliveryFeeType,DiscountType:t.DiscountType,DisplayLine:t.DisplayLine,DisplayLineTH:t.DisplayLineTH,IsCoupon:t.IsCoupon,ModifyDate:I,OrderId:E,PromotionDetailId:t.PromotionDetailId,PromotionDescription:t.PromotionDescription,PromotionTitle:t.PromotionTitle,PromotionId:t.PromotionId,Qty:t.Qty,AmountBeforeDiscount:t.AmountBeforeDiscount,DiscountSubType:t.DiscountSubType,DiscountSubValue:t.DiscountSubValue,PromoContent:t.PromoContent,PromotionDescriptionTH:t.PromotionDescription,PromotionTitleTH:t.PromotionTitleTH,ExpiryOn:t.ExpiryOn,DishId:t.DishId,SizeId:t.SizeId})}),u.next(a),u.complete()}))).pipe((0,W.w)(o=>this._http.post("/api/Order/Merchant/SaveCart",o).pipe((0,P.U)(n=>(n.RequestData=o,n))))).pipe((0,W.w)(o=>e.invoice.checked&&this._auth.userLogin?this.updateCustomerInvoice(this._auth.userLogin.id,e.invoice.input.company,e.invoice.input.tax,e.invoice.input.address1,e.invoice.input.address2,e.invoice.input.address3).pipe((0,P.U)(()=>o)):(0,S.of)(o))).pipe((0,ce.b)(o=>this._cart.setOrderCart(o.Id,o.OrderCode)))}getBranchHoliday(e){return this._http.post("/api/Branch/GetAllByDate",{DeliveryDate:e}).pipe((0,P.U)(s=>{if("boolean"!=typeof s)throw new Error("Error Check branch holiday response fail.");return s}))}updateCustomerInvoice(e,c,s,D,o,n){if(!c.trim()||!s.trim()||!D.trim())return(0,S.of)({});const _={ClientType:2,ContactId:e,CompanyName:c,TaxID:s,CompanyAddressLine1:D,CompanyAddressLine2:o,CompanyAddressLine3:n},f=(new m.qT).set(ue.j,!0);return this._http.post("/api/Customer/UpdateTaxInvoiceData",_,{context:f}).pipe((0,P.U)(u=>{if(!u)throw new Error("Can not update customer invoice");return u}))}}return(y=G).\u0275fac=function(e){return new(e||y)(g.LFG(he.N),g.LFG(_e.e),g.LFG(fe.o),g.LFG(m.eN))},y.\u0275prov=g.Yz7({token:y,factory:y.\u0275fac}),G})()},3190:(ne,R,i)=>{i.d(R,{J:()=>m,u:()=>A});var A=function(r){return r[r.None=0]="None",r[r.Cash=1]="Cash",r[r.Credit
1Card=2]="CreditCard",r[r.PromptPay=4]="PromptPay",r[r.KBank=8]="KBank",r[r.TrueMoney=7]="TrueMoney",r}(A||{}),m=function(r){return r[r.DefaultCheckout=1]="DefaultCheckout",r[r.BeeamCheckout=2]="BeeamCheckout",r[r.XenditPaylink=3]="XenditPaylink",r}(m||{})}}]);

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.