PageSourceSearch

https://ancarat.com/_next/static/chunks/pages/pos/ban-hang-6e4e55aab1b1249b.js

js ancarat.com collected 2026-10-03 22:38:05 UTC 87,043 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1021],{1381:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>ti});var n=r(37876),i=r(14232),a=r(67578),s=r(49794),o=r(75500),l=r(69390),c=r(2487),d=r(24422),u=r(9831),h=r(6003),p=r(71538),x=r(86650),m=r(22474),g=r(70946),f=r(61642),v=r(76833),y=r(37224),A=r(64410),j=r(88713),b=r(13927),_=r(66120),S=r(7957),C=r(5596),w=r(47866),k=r(3034),I=r(63009),z=r(34126),M=r(93256),T=r(78523),E=r(14628),R=r(31057);let N=(0,R.A)((0,n.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var O=r(50141);let V=(0,R.A)((0,n.jsx)("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"Check"),D=(0,R.A)((0,n.jsx)("path",{d:"m17 7-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4z"}),"Logout");var L=r(87905),W=r(87505);let P=(0,R.A)((0,n.jsx)("path",{d:"M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2m0 14H4v-6h16zm0-10H4V6h16z"}),"CreditCard");var H=r(58299);let B=(0,R.A)((0,n.jsx)("path",{d:"M6.99 11 3 15l3.99 4v-3H14v-2H6.99zM21 9l-3.99-4v3H10v2h7.01v3z"}),"SwapHoriz");var Y=r(88992),q=r(13810),F=r(42817),G=r(81701),X=r(21436),K=r(99427),Q=r(42959),U=r(55744),$=r(54587),Z=r.n($),J=r(34088),ee=r(89099),et=r(87177),er=r(80022),en=r(59945),ei=r(7069),ea=r(41982);let es=()=>(0,n.jsx)(a.A,{sx:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",backgroundColor:"#f5f5f5"},children:(0,n.jsx)(S.A,{})}),eo=e=>{let{children:t}=e,r=(0,ee.useRouter)(),a=(0,U.j)(),[s,o]=(0,i.useState)(!0),[l,c]=(0,i.useState)(!1),[d,u]=(0,i.useState)(null),h=(0,U.G)(e=>e.posAuth.user);(0,i.useEffect)(()=>{(()=>{let e=J.Ay.get(J.d5.POS_ACCESS_TOKEN);if(!(0,en.G)(e)){o(!1),r.push("/pos/dang-nhap");return}if(!h){let e=J.Ay.get(J.d5.POS_USER_INFO);e&&a((0,er.TK)(e))}u(J.Ay.get(J.d5.POS_STORE_ID)||null),c(!0),o(!1)})()},[r,a,h]);let p=(null==h?void 0:h.stores)||[],x=(0,ea.v)(p,d);return((0,i.useEffect)(()=>{l&&"auto"===x.action&&(J.Ay.set(J.d5.POS_STORE_ID,x.storeId),u(x.storeId))},[l,x.action,"auto"===x.action?x.storeId:null]),s||!l)?(0,n.jsx)(es,{}):"prompt"===x.action?(0,n.jsx)(ei.A,{open:!0,stores:p,onSelect:e=>{J.Ay.set(J.d5.POS_STORE_ID,e),u(e)}}):"ready"===x.action?(0,n.jsx)(n.Fragment,{children:t}):(0,n.jsx)(es,{})};var el=r(7339),ec=r(2639),ed=r(18107),eu=r(60755),eh=r(46347);let ep=(0,i.createContext)(void 0),ex=e=>{let{children:t}=e,[r,a]=(0,i.useState)([]),[s,o]=(0,i.useState)(!0),[l,c]=(0,i.useState)(60),d=(0,i.useCallback)(async()=>{try{o(!0);let e=await F.Ay.getCurrentQuote();e.success&&e.data?a(Array.isArray(e.data)?e.data:[]):e.error&&console.error("Error from API:",e.error)}catch(e){console.error("Error fetching gold quotes:",e)}finally{o(!1),c(60)}},[]);return(0,i.useEffect)(()=>{d();let e=setInterval(d,6e4);return()=>clearInterval(e)},[d]),(0,i.useEffect)(()=>{if(l<=0)return;let e=setInterval(()=>{c(e=>e<=1?60:e-1)},1e3);return()=>clearInterval(e)},[l]),(0,n.jsx)(ep.Provider,{value:{quotes:r,loading:s,countdown:l},children:t})},em=()=>{let e=(0,i.useContext)(ep);if(void 0===e)throw Error("useQuote must be used within a QuoteProvider");return e},eg=e=>{let{showHeader:t=!0}=e,{quotes:r,loading:i,countdown:o}=em(),l=e=>e.toLocaleString("vi-VN",{minimumFractionDigits:0,maximumFractionDigits:0}),c=e=>{let t=e.find(e=>"tael"===e.unit);return t?t.sell_price:null},d=e=>{let t=e.find(e=>"gram"===e.unit);return t?t.sell_price:null};return(0,n.jsxs)(a.A,{sx:{mt:"auto",pt:2,borderTop:{xs:0,md:1},borderColor:"divider"},children:[t&&(0,n.jsxs)(a.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1},children:[(0,n.jsx)(s.A,{variant:"subtitle2",fontWeight:"bold",children:"Tỉ gi\xe1"}),(0,n.jsxs)(s.A,{variant:"caption",sx:{color:"#666",fontSize:"0.75rem"},children:[o,"s"]})]}),i&&0===r.length?(0,n.jsx)(s.A,{variant:"body2",sx:{color:"#999",textAlign:"center",py:2},children:"Đang tải..."}):(0,n.jsxs)(el.A,{size:"small",children:[(0,n.jsx)(ec.A,{children:(0,n.jsxs)(ed.A,{children:[(0,n.jsx)(eu.A,{sx:{fontWeight:"bold",padding:"4px"},children:"T\xean"}),(0,n.jsx)(eu.A,{align:"right",sx:{fontWeight:"bold",padding:"4px"},children:"Lượng"}),(0,n.jsx)(eu.A,{align:"right",sx:{fontWeight:"bold",padding:"4px"},children:"Gram"})]})}),(0,n.jsx)(eh.A,{children:r.map(e=>{let t=c(e.units),r=d(e.units);return(0,n.jsxs)(ed.A,{children:[(0,n.jsx)(eu.A,{sx:{paddingY:"8px",paddingX:"4px"},children:e.short_name}),(0,n.jsx)(eu.A,{align:"right",sx:{paddingY:"8px",paddingX:"4px"},children:t?l(t):"-"}),(0,n.jsx)(eu.A,{align:"right",sx:{paddingY:"8px",paddingX:"4px"},children:r?l(r):"-"})]},e.category_code)})})]})]})};r(72467);var ef=r(6448),ev=r(90229),ey=r(68284),eA=r(2799),ej=r(59017),eb=r(13152),e_=r(19957);let eS=e=>{let{setValue:t,userType:r}=e,[o,l]=(0,i.useState)(""),[c,d]=(0,i.useState)([]),[u,h]=(0,i.useState)(!1),[p,x]=(0,i.useState)(!1),m=(0,i.useRef)(!1),g=(0,i.useRef)(null),f=(0,i.useRef)(""),v=(0,X.A)(o,400);(0,i.useEffect)(()=>
1{if(m.current){m.current=!1,h(!1),d([]);return}if(v!==f.current){d([]),h(!1);return}let e=(null==v?void 0:v.trim())||"";if(e.length<3){d([]),x(!1),h(!1);return}h(!0),x(!1),F.Ay.searchUsers({q:e}).then(e=>{e.success&&e.data?d(e.data):d([])}).catch(()=>d([])).finally(()=>{h(!1),x(!0)})},[v]);let y=e=>{var r,n,i;let a=e.address,s=e.user,o=a.phone||s.phone||"";t("invoice_same_as_delivery",!1),s.user_type&&t("user_type",s.user_type),t("phone",o||"",{shouldValidate:!0}),t("name",a.name||"",{shouldValidate:!0}),t("email",a.email||"",{shouldValidate:!0}),t("citizen_id",a.citizen_id||"",{shouldValidate:!0}),t("address",a.address||"",{shouldValidate:!0}),a.city_id&&(t("cityId",a.city_id,{shouldValidate:!0}),t("cityName",(null==(n=a.city)?void 0:n.name)||"")),a.ward_id&&(t("wardId",a.ward_id,{shouldValidate:!0}),t("wardName",(null==(i=a.ward)?void 0:i.name)||"")),(null==s?void 0:s.birthday)&&t("birthday",s.birthday.substring(0,10));let c=s.invoice_organization_name||"",u=(null==s?void 0:s.tax_code)||"",p=(null==s?void 0:s.address)||"",v=(null==s?void 0:s.tax_email)||"";t("invoice_name",c||"",{shouldValidate:!0}),t("invoice_tax_id",u||"",{shouldValidate:!0}),t("invoice_address",p||"",{shouldValidate:!0}),t("invoice_email",v||"",{shouldValidate:!0}),t("buyer_name",s.invoice_buyer_name||"",{shouldValidate:!0}),t("buyer_cccd",s.invoice_buyer_cccd||"",{shouldValidate:!0}),t("misa_account_object_id",s.misa_account_object_id),(null==(r=e.account_manager)?void 0:r.staff_id)&&t("careStaffId",e.account_manager.staff_id),m.current=!0,g.current&&(clearTimeout(g.current),g.current=null),h(!1),d([]),x(!1),l(""),f.current=""},A=(e,t)=>{if(!e)return null;let r=t.trim();if(!r)return(0,n.jsx)(n.Fragment,{children:e});let i=RegExp("(".concat(r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),")"),"gi"),a=e.split(i);return(0,n.jsx)(n.Fragment,{children:a.map((e,t)=>i.test(e)?(0,n.jsx)("span",{style:{backgroundColor:"#FF6B00",color:"#fff",borderRadius:2,padding:"0 2px"},children:e},t):e)})},j=e=>{var t,r;let n=[];return e.address&&n.push(e.address),(null==(t=e.ward)?void 0:t.name)&&n.push(e.ward.name),(null==(r=e.city)?void 0:r.name)&&n.push(e.city.name),n.join(", ")};return(0,i.useEffect)(()=>()=>{g.current&&clearTimeout(g.current)},[]),(0,n.jsxs)(a.A,{sx:{position:"relative"},children:[(0,n.jsx)(ey.A,{value:o,onChange:e=>{let t=e.target.value;f.current=t,l(t)},onBlur:()=>{g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{d([]),h(!1),x(!1),g.current=null},500)},onFocus:()=>{g.current&&(clearTimeout(g.current),g.current=null)},label:"T\xecm kiếm kh\xe1ch h\xe0ng",placeholder:"Nhập SĐT, t\xean, MST...",fullWidth:!0,size:"small",variant:"outlined",margin:"dense",InputProps:{startAdornment:(0,n.jsx)(e_.A,{position:"start",children:(0,n.jsx)(eb.A,{sx:{fontSize:18,color:"text.secondary"}})})},sx:{"& .MuiOutlinedInput-root":{height:"36px"},"& .MuiInputBase-input":{py:"8px"}}}),(u||c.length>0||p)&&(0,n.jsxs)(eA.A,{elevation:3,sx:{position:"absolute",top:"100%",left:0,right:0,mt:.5,zIndex:1400,maxHeight:500,overflowY:"auto"},children:[u&&(0,n.jsx)(a.A,{sx:{display:"flex",alignItems:"center",justifyContent:"center",py:1.5},children:(0,n.jsx)(S.A,{size:20})}),!u&&0===c.length&&(0,n.jsx)(a.A,{sx:{py:1,px:2},children:(0,n.jsx)(s.A,{variant:"body2",color:"text.secondary",children:"Kh\xf4ng t\xecm thấy kh\xe1ch h\xe0ng ph\xf9 hợp"})}),!u&&c.length>0&&(0,n.jsx)(I.A,{dense:!0,children:c.map((e,t)=>{var i,l,c,d,u;let h=e.user,p=e.address||{};return(0,n.jsx)(z.Ay,{button:!0,divider:!0,onMouseDown:e=>e.preventDefault(),onClick:()=>y(e),sx:{alignItems:"flex-start",py:.5},children:(0,n.jsx)(M.A,{primary:(0,n.jsxs)(a.A,{sx:{display:"flex",alignItems:"center",gap:.75,flexWrap:"wrap"},children:[(0,n.jsxs)(s.A,{variant:"body2",fontWeight:600,children:[A(h.phone,o)," - ",A(h.name,o)]}),(null==(i=e.user)?void 0:i.user_type)&&(0,n.jsx)(ej.A,{label:e.user.user_type===F.ut.PERSONAL?"C\xe1 nh\xe2n":"Tổ chức",size:"small",color:"primary",variant:"outlined",sx:{height:18,fontSize:"11px","& .MuiChip-label":{px:.75}}}),(null==(c=e.user)||null==(l=c.group)?void 0:l.name)&&(0,n.jsx)(ej.A,{label:e.user.group.name,size:"small",color:"primary",variant:"outlined",sx:{height:18,fontSize:"11px","& .MuiChip-label":{px:.75}}})]}),secondary:(0,n.jsxs)(a.A,{sx:{mt:.5},children:[h.misa_account_object_code&&(0,n.jsxs)(s.A,{variant:"body2",color:"text.secondary",children:["M\xe3 KH: ",(0,n.jsx)("strong",{children:A(h.misa_account_object_code,o)})]}),p.email&&(0,n.jsxs)(s.A,{variant:"body2",color:"text.secondary",children:["Email: ",(0,n.jsx)("strong",{children:A(p.email,o)})]}),r===F.ut.PERSONAL&&p.citizen_id&&(0,n.jsxs)(s.A,{variant:"body2",color:"text.secondary",children:["CCCD: ",(0,n.jsx)("strong",{children:A(p.citizen_id,o)})]}),r===F.ut.ORGANIZATION&&(null==(d=e.user)?void 0:d.tax_code)&&(0,n.jsxs)(s.A,{variant:"body2",color:"text.secondary",children:["MST: ",(0,n.jsx)("strong",{children:A(e.user.tax_code,o)})]}),r===F.ut.ORGANIZATION&&(null==(u=e.user)?void 0:u.legal_representative)&&(0,n.jsxs)(s.A,{variant:"body2",color:"text.secondary",children:["Người đại diện: ",(0,n.jsx)("strong",{children:e.user.legal_representative})]}),(0,n.jsxs)(s.A,{variant:"body2",color:"text.secondary",children:["ĐC: ",(0,n.jsx)("strong",{children:j(p)||"Chưa c\xf3 địa chỉ"})]}),e.account_manager&&(0,n.jsxs)(s.A,{variant:"body2",color:"text.secondary",children:["AM: ",(0,n.jsxs)("strong",{children:[e.account_manager.name," - ",e.account_manager.phone]})]})]})})},"".concat(h._id,"-").concat(t))})})]})]})};var eC=r(27360),ew=r(1378),ek=r(51802),eI=r(81645),ez=r(12750);let eM=ek.Ik({id:ek.Yj(),variantCode:ek.Yj(),productName:ek.Yj(),trackingMode:ek.fc(G.t),specificationCode:ek.Yj(),price:ek.ai().min(0,"Gi\xe1 phải >= 0"),discountPercent:ek.ai().min(0,"Chiết khấu phải >= 0").max(100,"Chiết khấu kh\xf4ng được > 100"),discountAmount:ek.ai(),quantity:ek.ai().min(ez.hi,"Số lượng phải > 0").refine(e=>{let t=String(e);if(t.includes("e")||t.includes("E"))return!1;let r=t.indexOf(".");return -1===r||t.length-r-1<=ez.WC},{message:"Số lượng chỉ hỗ trợ tối đa ".concat(ez.WC," chữ số thập ph\xe2n")}),weight:ek.ai(),laborCost:ek.ai(),totalAmount:ek.ai(),sellerStaffId:ek.Yj().min(1,"Vui l\xf2ng chọn người b\xe1n"),warehouseStaffId:ek.Yj(),variantData:ek.bz(),warehouseStaffIds:ek.YO(ek.Yj()).optional()}),eT=ek.Ik({phone:ek.Yj().trim().min(1,"Vui l\xf2ng nhập số điện thoại").regex(/^\d+$/,"Số điện thoại chỉ được chứa số").refine(e=>e.length>=10&&e.length<=11,{message:"SĐT phải c\xf3 từ 10 đến 11 số"}),name:ek.Yj().trim().min(1,"Vui l\xf2ng nhập họ t\xean"),citizen_id:ek.Yj().trim().optional().refine(e=>!e||""===e||/^\d{12}$/.test(e),{message:"CMND/CCCD phải c\xf3 12 chữ số"}),email:ek.Yj().trim().optional().refine(e=>!e||""===e||ek.Yj().email().safeParse(e).success,{message:"Email kh\xf4ng đ\xfang định dạng"}),address:ek.Yj().trim().optional(),cityId:ek.Yj().min(1,"Vui l\xf2ng chọn th\xe0nh phố"),cityName:ek.Yj().optional(),wardId:ek.Yj().optional(),wardName:ek.Yj().optional(),birthday:ek.Yj().trim().optional(),description:ek.Yj().trim().optional(),careStaffId:ek.Yj().min(1,"Vui l\xf2ng chọn nh\xe2n vi\xean chăm s\xf3c"),fulfillment_type:ek.fc(F.er).optional(),delivery_days:ek.ai().nullable().optional(),items:ek.YO(eM).min(1,"Vui l\xf2ng th\xeam \xedt nhất 1 sản phẩm"),user_type:ek.fc(F.ut).default(F.ut.PERSONAL),invoice_same_as_delivery:ek.zM().optional(),invoice_name:ek.Yj().trim().min(1,"Vui l\xf2ng nhập th\xf4ng tin n\xe0y"),invoice_tax_id:ek.Yj().trim().min(1,"Vui l\xf2ng nhập th\xf4ng tin n\xe0y"),invoice_address:ek.Yj().trim().min(1,"Vui l\xf2ng nhập địa chỉ xuất ho\xe1 đơn"),misa_account_object_id:ek.Yj().optional().nullable(),buyer_name:ek.Yj().trim().optional(),buyer_cccd:ek.Yj().trim().optional().refine(e=>!e||""===e||/^\d{12}$/.test(e),{message:"CCCD phải c\xf3 12 chữ số"}),invoice_email:ek.Yj().trim().optional().refine(e=>!e||""===e||ek.Yj().email().safeParse(e).success,{message:"Email ho\xe1 đơn kh\xf4ng đ\xfang định dạng"})}).superRefine((e,t)=>
1{var r;if(e.user_type===F.ut.ORGANIZATION||(null==(r=e.birthday)?void 0:r.trim())||t.addIssue({code:eI.eq.custom,path:["birthday"],message:"Vui l\xf2ng nhập ng\xe0y sinh kh\xe1ch h\xe0ng."}),e.invoice_tax_id&&""!==e.invoice_tax_id){let r=e.invoice_tax_id;if(e.user_type===F.ut.PERSONAL){let e=/^\d{12}$/.test(r),n=/^\d{10}(-\d{3})?$/.test(r);e||n||t.addIssue({code:eI.eq.custom,path:["invoice_tax_id"],message:"Phải l\xe0 CCCD (12 số) hoặc m\xe3 số thuế hợp lệ (VD: 0101234567 hoặc 0101234567-001)"})}else/^\d{10}(-\d{3})?$/.test(r)||t.addIssue({code:eI.eq.custom,path:["invoice_tax_id"],message:"M\xe3 số thuế kh\xf4ng đ\xfang định dạng (10 chữ số hoặc XXXXXXXXXX-YYY)"})}e.fulfillment_type===F.er.PREORDER&&(e.citizen_id||e.user_type===F.ut.ORGANIZATION||t.addIssue({code:eI.eq.custom,path:["citizen_id"],message:"Vui l\xf2ng nhập CMND/CCCD"}),(!e.delivery_days||e.delivery_days<=0)&&t.addIssue({code:eI.eq.custom,path:["delivery_days"],message:"Vui l\xf2ng nhập hạn giao h\xe0ng (phải lớn hơn 0)"})),e.fulfillment_type!==F.er.PREORDER&&Array.isArray(e.items)&&e.items.forEach((e,r)=>{e.warehouseStaffId||t.addIssue({code:eI.eq.custom,path:["items",r,"warehouseStaffId"],message:"Vui l\xf2ng chọn chủ kho"})})});var eE=r(43053),eR=r(43073),eN=r(46061),eO=r(74441);let eV=(0,R.A)((0,n.jsx)("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1 0-1.66-1.34-3-3-3-1.05 0-1.96.54-2.5 1.35l-.5.67-.5-.68C10.96 2.54 10.05 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2m-5-2c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1M9 4c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1m11 15H4v-2h16zm0-5H4V8h5.08L7 10.83 8.62 12 11 8.76l1-1.36 1 1.36L15.38 12 17 10.83 14.92 8H20z"}),"CardGiftcard");var eD=r(16652);let eL=(0,R.A)((0,n.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),eW=(0,R.A)((0,n.jsx)("path",{d:"M20 12c0-1.1.9-2 2-2V6c0-1.1-.9-2-2-2H4c-1.1 0-1.99.9-1.99 2v4c1.1 0 1.99.9 1.99 2s-.89 2-2 2v4c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-4c-1.1 0-2-.9-2-2m-4.42 4.8L12 14.5l-3.58 2.3 1.08-4.12-3.29-2.69 4.24-.25L12 5.8l1.54 3.95 4.24.25-3.29 2.69z"}),"LocalActivity"),eP=e=>e.total>0&&e.loaded<e.total,eH=(e,t)=>{let r=new Set(e.map(e=>e.id)),n=[...e];for(let e of t)r.has(e.id)||(r.add(e.id),n.push(e));return n};var eB=r(45274);let eY=e=>{let{open:t,onClose:r,appliedCodes:o,onApply:l,onRemove:d,isApplying:u=!1}=e,[h,p]=(0,i.useState)(""),[x,m]=(0,i.useState)(""),[f,v]=(0,i.useState)([]),[y,A]=(0,i.useState)(1),[j,b]=(0,i.useState)(0),[_,I]=(0,i.useState)("idle"),z=(0,i.useRef)(null),M=(0,i.useRef)(null),E=e=>o.includes(e),R=eP({loaded:f.length,total:j});(0,i.useEffect)(()=>{t&&p("")},[t]),(0,i.useEffect)(()=>{let e=setTimeout(()=>m(h.trim()),300);return()=>clearTimeout(e)},[h]);let N=(0,i.useCallback)(async(e,t)=>{var r,n,i,a,s;null==(r=z.current)||r.abort();let o=new AbortController;z.current=o,I(t?"pending":"loadingMore");try{let r=await F.Ay.searchVouchers({q:x||void 0,page:e,limit:20},{signal:o.signal});if(o.signal.aborted)return;if(!r.success){(null==(i=r.error)?void 0:i.code)!=="CANCELLED"&&I("error");return}let l=null!=(a=r.data)?a:[];v(e=>t?l:eH(e,l)),b(Number(null!=(s=null==(n=r.pagination)?void 0:n.total)?s:0)),A(e),I("idle")}catch(e){o.signal.aborted||I("error")}},[x]);return(0,i.useEffect)(()=>{if(t)return N(1,!0),()=>{var e;return null==(e=z.current)?void 0:e.abort()}},[t,x,N]),(0,i.useEffect)(()=>{if(!t)return;let e=M.current;if(!e)return;let r=new IntersectionObserver(e=>{let t=e[0];(0,eB.t)({isIntersecting:t.isIntersecting,hasMore:R,loading:_})&&N(y+1,!1)});return r.observe(e),()=>r.disconnect()},[t,R,_,y,N]),(0,n.jsxs)(C.A,{open:t,onClose:r,maxWidth:"xs",fullWidth:!0,children:[(0,n.jsxs)(w.A,{sx:{display:"flex",alignItems:"center",gap:1,color:"error.main",fontWeight:700},children:[(0,n.jsx)(eV,{fontSize:"small"}),"Chọn m\xe3 giảm gi\xe1"]}),(0,n.jsxs)(k.A,{dividers:!0,children:[(0,n.jsx)(s.A,{variant:"caption",color:"text.secondary",children:"Chọn m\xe3 giảm gi\xe1 dưới đ\xe2y để \xe1p dụng cho đơn h\xe0ng của bạn."}),(0,n.jsx)(ey.A,{fullWidth:!0,size:"small",placeholder:"T\xecm kiếm m\xe3 hoặc m\xf4 tả...",value:h,onChange:e=>p(e.target.value),sx:{mt:1.5},InputProps:{startAdornment:(0,n.jsx)(e_.A,{position:"start",children:(0,n.jsx)(eD.A,{fontSize:"small"})}),endAdornment:h?(0,n.jsx)(e_.A,{position:"end",children:(0,n.jsx)(g.A,{size:"small",onClick:()=>p(""),children:(0,n.jsx)(eL,{fontSize:"small"})})}):null}}),(0,n.jsx)(a.A,{sx:{mt:1.5,maxHeight:320,overflowY:"auto",display:"flex",flexDirection:"column",gap:1},children:"pending"===_?(0,n.jsx)(a.A,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,n.jsx)(S.A,{size:22,color:"error"})}):"error"===_?(0,n.jsxs)(a.A,{sx:{textAlign:"center",py:4},children:[(0,n.jsx)(s.A,{variant:"caption",color:"error",sx:{dis
1play:"block",mb:1},children:"Kh\xf4ng tải được danh s\xe1ch m\xe3 giảm gi\xe1."}),(0,n.jsx)(c.A,{size:"small",variant:"outlined",color:"error",onClick:()=>N(1,!0),children:"Thử lại"})]}):f.length>0?(0,n.jsxs)(n.Fragment,{children:[f.map(e=>{let t=E(e.code);return(0,n.jsxs)(a.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:1.5,p:1.25,border:"1px solid",borderColor:t?"success.light":"divider",bgcolor:t?e=>(0,eO.X4)(e.palette.success.main,.08):"transparent",borderRadius:1.5},children:[(0,n.jsxs)(a.A,{sx:{display:"flex",alignItems:"flex-start",gap:1,minWidth:0},children:[(0,n.jsx)(eW,{fontSize:"small",color:t?"success":"error",sx:{mt:.25}}),(0,n.jsxs)(a.A,{sx:{minWidth:0},children:[(0,n.jsx)(s.A,{variant:"body2",sx:{fontWeight:700},noWrap:!0,children:e.code}),e.description&&(0,n.jsx)(s.A,{variant:"caption",color:"text.secondary",sx:{display:"block"},children:e.description})]})]}),t?(0,n.jsx)(c.A,{size:"small",color:"error",variant:"text",disabled:u,onClick:()=>d(e.code),sx:{flexShrink:0},children:"Hủy"}):(0,n.jsx)(c.A,{size:"small",color:"error",variant:"outlined",disabled:u,onClick:()=>l(e.code),sx:{flexShrink:0},children:"\xc1p dụng"})]},e.id)}),(0,n.jsx)(a.A,{ref:M,sx:{height:1}}),"loadingMore"===_&&(0,n.jsx)(a.A,{sx:{display:"flex",justifyContent:"center",py:1},children:(0,n.jsx)(S.A,{size:18,color:"error"})})]}):(0,n.jsx)(s.A,{variant:"caption",color:"text.secondary",sx:{textAlign:"center",py:4},children:"Kh\xf4ng t\xecm thấy m\xe3 giảm gi\xe1 n\xe0o ph\xf9 hợp"})})]}),(0,n.jsx)(T.A,{children:(0,n.jsx)(c.A,{size:"small",variant:"outlined",onClick:r,children:"Đ\xf3ng"})})]})},eq=e=>e.toLocaleString("vi-VN"),eF=e=>{let{appliedVouchers:t,attemptedCodes:r,onApply:o,onRemove:l,isApplying:d=!1,error:u=null,onClearError:h,disabled:p=!1}=e,[x,m]=(0,i.useState)(""),[f,v]=(0,i.useState)(!1),y=t.map(e=>
1e.code||e.voucher_code).filter(Boolean),A=new Set(r&&r.length>0?r:y),j=e=>{let t=e.trim();t&&(A.has(t)||y.includes(t)||(o(t),m("")))};return(0,n.jsxs)(a.A,{sx:{display:"flex",flexDirection:"column",gap:1},children:[(0,n.jsx)(s.A,{variant:"body2",sx:{fontWeight:500,fontSize:"0.8rem"},children:"M\xe3 khuyến mại"}),(0,n.jsxs)(a.A,{sx:{display:"flex",gap:1},children:[(0,n.jsx)(ey.A,{fullWidth:!0,size:"small",placeholder:"Nhập m\xe3 giảm gi\xe1...",value:x,disabled:p||d,onChange:e=>m(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),j(x))}}),(0,n.jsx)(g.A,{color:"error",disabled:p||d,onClick:()=>v(!0),"aria-label":"Chọn từ danh s\xe1ch m\xe3 giảm gi\xe1",title:"Chọn từ danh s\xe1ch m\xe3 giảm gi\xe1",sx:{flexShrink:0,border:"1px solid",borderColor:"error.light",borderRadius:1,bgcolor:e=>(0,eO.X4)(e.palette.error.light,.12)},children:(0,n.jsx)(eV,{fontSize:"small"})}),(0,n.jsx)(c.A,{variant:"contained",size:"small",onClick:()=>j(x),disabled:p||d||!x.trim(),sx:{minWidth:90,flexShrink:0},children:d?(0,n.jsx)(S.A,{size:16,color:"inherit"}):"\xc1p dụng"})]}),u&&(0,n.jsx)(eN.A,{severity:"error",variant:"outlined",onClose:h,sx:{py:0,fontSize:"0.75rem","& .MuiAlert-message":{py:.5},"& .MuiAlert-icon":{py:.5,fontSize:18},"& .MuiAlert-action":{py:0,pl:0}},children:u}),t.length>0&&(0,n.jsx)(a.A,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:t.map(e=>{let t=e.code||e.voucher_code||"";return(0,n.jsx)(ej.A,{size:"small",color:"success",variant:"outlined",icon:(0,n.jsx)(V,{}),label:null!=e.discount_amount&&e.discount_amount>0?"".concat(t," \xb7 -").concat(eq(e.discount_amount),"đ"):t,onDelete:()=>l(t)},t)})}),(0,n.jsx)(eY,{open:f,onClose:()=>v(!1),appliedCodes:y,onApply:j,onRemove:l,isApplying:d})]})},eG=(e,t,r)=>
1Math.min(Math.max(e,t),r),eX=e=>{let t=Math.round(100*e)/100;return t<.01?0:t};var eK=r(10884),eQ=r(28888),eU=r(38993);let e$=(0,R.A)([(0,n.jsx)("path",{d:"M12 5.99 19.53 19H4.47zM12 2 1 21h22z"},"0"),(0,n.jsx)("path",{d:"M13 16h-2v2h2zm0-6h-2v5h2z"},"1")],"WarningAmber");function eZ(){let e=(0,eQ._)(["\n  from { transform: translateY(100%); opacity: 0; }\n  to { transform: translateY(0); opacity: 1; }\n"]);return eZ=function(){return e},e}function eJ(){let e=(0,eQ._)(["\n  0% { box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.4); }\n  70% { box-shadow: 0 0 0 12px rgba(211, 47, 47, 0); }\n  100% { box-shadow: 0 0 0 0 rgba(211, 47, 47, 0); }\n"]);return eJ=function(){return e},e}let e0=(0,eU.i7)(eZ()),e1=(0,eU.i7)(eJ()),e2=e=>{let{hasActiveShift:t,remainingMinutes:r,onOpenClose:i}=e;if(!t||r>30)return null;let o=r<=0;return(0,n.jsxs)(a.A,{sx:{position:"sticky",bottom:0,left:0,right:0,zIndex:1300,display:"flex",alignItems:"center",justifyContent:"space-between",px:{xs:2,sm:3},py:{xs:1.5,sm:2},bgcolor:o?"#b71c1c":"#e65100",color:"white",boxShadow:"0 -4px 20px rgba(0,0,0,0.15)",animation:"".concat(e0," 0.3s ease-out")},children:[(0,n.jsxs)(a.A,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,n.jsx)(e$,{sx:{fontSize:{xs:28,sm:32},animation:"".concat(e1," 2s ease-in-out infinite")}}),(0,n.jsxs)(a.A,{children:[(0,n.jsx)(s.A,{variant:"body1",sx:{fontWeight:700,fontSize:{xs:"0.9rem",sm:"1rem"},lineHeight:1.3},children:o?"CA L\xc0M VIỆC Đ\xc3 KẾT TH\xdaC":"C\xd2N ".concat(r," PH\xdaT")}),(0,n.jsx)(s.A,{variant:"caption",sx:{opacity:.9,fontSize:{xs:"0.75rem",sm:"0.8rem"}},children:"Vui l\xf2ng kết ca trước khi bắt đầu Ca l\xe0m việc mới"})]})]}),(0,n.jsx)(c.A,{variant:"contained",onClick:i,sx:{minWidth:{xs:100,sm:140},py:{xs:1,sm:1.5},px:{xs:2,sm:3},bgcolor:"white",color:o?"#b71c1c":"#e65100",fontWeight:700,fontSize:{xs:"0.85rem",sm:"0.95rem"},borderRadius:"12px",textTransform:"none",boxShadow:"0 4px 12px rgba(0,0,0,0.2)","&:hover":{bgcolor:"#f5f5f5",boxShadow:"0 6px 16px rgba(0,0,0,0.25)",transform:"translateY(-1px)"},transition:"all 0.2s ease"},children:"KẾT CA NGAY"})]})};var e5=r(47712),e4=r(36604),e9=r(61478),e6=r(26972);let e7=e=>Math.round(e||0).toLocaleString("vi-VN"),e3=e=>parseFloat(e.replace(/[^\d]/g,""))||0,e8=e=>{let t=e.replace(/[^\d]/g,"");return t?parseFloat(t).toLocaleString("vi-VN"):""},te=e=>new Date(e).toLocaleTimeString("vi-VN",{hour:"2-digit",minute:"2-digit"}),tt=e=>{let t=Math.floor(e/60),r=e%60;return t>0?"".concat(t,"h").concat(r,"p"):"".concat(r,"p")},tr=e=>{let{icon:t,label:r,selected:i,onClick:o}=e;return(0,n.jsxs)(a.A,{onClick:o,sx:{width:{xs:90,sm:120},height:{xs:80,sm:100},border:"1px solid #d0d0d0",borderRadius:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:{xs:.5,sm:1},cursor:"pointer",backgroundColor:i?"#f5f5f5":"white",position:"relative","&:hover":{backgroundColor:"#f9f9f9"}},children:[i&&(0,n.jsx)(E.A,{sx:{position:"absolute",top:4,right:4,color:"#9c27b0",fontSize:{xs:16,sm:20}}}),(0,n.jsx)(a.A,{sx:{fontSize:{xs:24,sm:32},color:"#666",display:"flex",alignItems:"center",justifyContent:"center"},children:t}),(0,n.jsx)(s.A,{variant:"body2",sx:{color:"#333",fontWeight:500,fontSize:{xs:"0.7rem",sm:"0.875rem"}},children:r})]})},tn=()=>{var e,t,r,E,R,$,en,ei,ea,es,eo,el,ec,ed,eu,eh,ep;let[ex,ey]=(0,i.useState)([]),[eA,ej]=(0,i.useState)(""),[eb,e_]=(0,i.useState)(!1),[ek,eI]=(0,i.useState)(!1),[ez,eM]=(0,i.useState)("bank"),[eN,eO]=(0,i.useState)(null),[eV,eD]=(0,i.useState)({}),[eL,eW]=(0,i.useState)(null),[eP,eH]=(0,i.useState)(""),[eB,eY]=(0,i.useState)(!1),[eq,eQ]=(0,i.useState)(F.er.PREORDER),[eU,e$]=(0,i.useState)(!0),[eZ,eJ]=(0,i.useState)(!0),[e0,e1]=(0,i.useState)([]),[tn,ti]=(0,i.useState)(null),[ta,ts]=(0,i.useState)(!1),[to,tl]=(0,i.useState)(null),[tc,td]=(0,i.useState)(null),tu=(0,i.useRef)(null),[th,tp]=(0,i.useState)(!1),[tx,tm]=(0,i.useState)([]),[tg,tf]=(0,i.useState)(""),[tv,ty]=(0,i.useState)(null),[tA,tj]=(0,i.useState)(!1),[tb,t_]=(0,i.useState)(""),{countdown:tS}=em(),[tC,tw]=(0,i.useState)({serials:[],variants:[]}),[tk,tI]=(0,i.useState)(!1),[tz,tM]=(0,i.useState)({open:!1,errors:[]}),[tT,tE]=(0,i.useState)({open:!1,qrCodes:""}),[tR,tN]=(0,i.useState)(!1),[tO,tV]=(0,i.useState)({open:!1,newMode:null}),tD=(0,ee.useRouter)(),tL=(0,U.j)(),tW=(0,U.G)(e=>e.posAuth.user),tP=(0,U.G)(e=>
1e.posShift.currentShift),tH=(0,U.G)(e=>e.posShift.shiftEnabled),tB=(0,U.G)(e=>e.posShift.hasCheckedShift),tY=(0,U.G)(e=>e.posShift.isLoading),tq=(null==tP?void 0:tP.status)==="OPEN"?tP:null,[tF,tG]=(0,i.useState)(null),[tX,tK]=(0,i.useState)(0);(0,i.useEffect)(()=>{if(tW)tG(tW);else{let e=J.Ay.get(J.d5.POS_USER_INFO);e&&tG(e)}let e=J.Ay.get(J.d5.POS_STORE_ID);e&&(eH(e),tL((0,e5.yi)(e)))},[tW,tL]),(0,i.useEffect)(()=>{if(!(null==tq?void 0:tq.shift_end_at))return;let e=()=>{tK(Math.max(0,Math.floor((new Date(tq.shift_end_at).getTime()-Date.now())/6e4)))};e();let t=setInterval(e,6e4);return()=>clearInterval(t)},[null==tq?void 0:tq.shift_end_at]),(0,i.useEffect)(()=>{tB&&tH&&!tY&&!tq&&tD.push("/pos/mo-ca")},[tq,tB,tY,tD,tH]);let{caps:tQ,refresh:tU}=function(e){let[t,r]=(0,i.useState)({can_edit_price_discount:!1,store_role:null}),[n,a]=(0,i.useState)(!1),s=(0,i.useCallback)(async()=>{if(!e)return void r({can_edit_price_discount:!1,store_role:null});a(!0);try{let e=await e4.y.getCapabilities();r(e)}catch(e){r({can_edit_price_discount:!1,store_role:null})}finally{a(!1)}},[e]);return(0,i.useEffect)(()=>{s()},[s]),{caps:t,loading:n,refresh:s}}(eP),t$=function(){let[e,t]=(0,i.useState)("idle"),[r,n]=(0,i.useState)(null),a=(0,i.useCallback)(()=>t("entering"),[]),s=(0,i.useCallback)(()=>t("idle"),[]),o=(0,i.useCallback)(e=>
1{n({otp_id:e.otp_id,expires_at:e.expires_at,manager_name:e.manager_name}),t("idle")},[]),l=(0,i.useCallback)(()=>n(null),[]);return(0,i.useEffect)(()=>{if(!r)return;let e=new Date(r.expires_at).getTime()-Date.now();if(e<=0)return void n(null);let t=window.setTimeout(()=>n(null),e);return()=>window.clearTimeout(t)},[r]),{stage:e,active:r,openEnter:a,close:s,onVerified:o,clearActive:l}}(),tZ=!tQ.can_edit_price_discount&&!t$.active;null==tF||null==(t=tF.stores)||null==(e=t.find(e=>e.store_id===eP))||e.store_name;let{control:tJ,handleSubmit:t0,formState:{errors:t1},watch:t2,reset:t5,setValue:t4,setError:t9,clearErrors:t6,trigger:t7}=(0,Y.mN)({resolver:(0,q.u)(eT),mode:"onBlur",defaultValues:{phone:"",name:"",citizen_id:"",email:"",address:"",cityId:"",wardId:"",birthday:"",description:"",careStaffId:"",fulfillment_type:F.er.PREORDER,delivery_days:null,items:[],user_type:F.ut.PERSONAL,invoice_same_as_delivery:!1,invoice_name:"",invoice_tax_id:"",invoice_address:"",invoice_email:""}});(0,i.useEffect)(()=>{tj(!0),F.Ay.getActiveLiveSessions().then(e=>tm(e.data||[])).catch(()=>tm([])).finally(()=>tj(!1))},[]);let t3=tx.length>0;(0,i.useEffect)(()=>{var e;if(!tg){ty(null),t_("");return}let t=tx.find(e=>e._id===tg);ty(t),t_(""),(null==t||null==(e=t.sale_ib_staff_ids)?void 0:e.length)===1&&t_((t.sale_ib_staff_ids[0]._id||t.sale_ib_staff_ids[0]).toString())},[tg,tx]);let t8=t2("cityId"),re=null!=(el=t2("user_type"))?el:F.ut.PERSONAL;(0,i.useEffect)(()=>{t4("fulfillment_type",eq,{shouldValidate:!0})},[eq]);let rt=t2("phone"),rr=!!rt&&/^0\d{9,10}$/.test(rt),rn=e0.length>0&&rr?rt:"";(0,i.useEffect)(()=>{if(0===ex.length){var e;null==(e=tu.current)||e.abort(),ti(null),td(null);return}let t=setTimeout(()=>{var e;null==(e=tu.current)||e.abort();let t=new AbortController;tu.current=t,ts(!0),td(null);let r={items:ex.map(e=>{var t,r,n,i,a;return{product_variant_id:(null==(r=e.variantData)||null==(t=r.variant)?void 0:t.variant_id)||"",quantity:e.quantity,price:e.price,discount_amount:e.discountAmount*e.quantity,discount_percent:e.discountPercent,seller_staff_id:e.sellerStaffId||void 0,warehouse_staff_id:e.warehouseStaffId||void 0,serial_id:null!=(a=null==(i=e.variantData)||null==(n=i.stock_serial)?void 0:n.stock_serial_id)?a:null}}),fulfillment_type:eq,vouchers:e0,phone:rn||void 0};F.Ay.estimateOrder(r,{signal:t.signal}).then(e=>{if(t.signal.aborted)return;if(!e.success){var r,n;(null==(r=e.error)?void 0:r.code)!=="CANCELLED"&&td((null==(n=e.error)?void 0:n.message)||"Lỗi t\xednh gi\xe1");return}let i=e.data;if(ti(i),e0.length>0){let e=(i.applied_vouchers||[]).map(e=>
1e.code||e.voucher_code).filter(Boolean),t=i.rejected_vouchers||[],r=t.length>0?t.map(e=>e.code):e0.filter(t=>!e.includes(t));r.length>0?tl(t.length>0?t.map(e=>"".concat(e.code,": ").concat(e.message)).join("; "):"M\xe3 kh\xf4ng hợp lệ: ".concat(r.join(", "))):tl(null)}else to&&tl(null)}).catch(e=>{t.signal.aborted||td((null==e?void 0:e.message)||"Lỗi t\xednh gi\xe1")}).finally(()=>{t.signal.aborted||ts(!1)})},300);return()=>clearTimeout(t)},[ex,e0,rn,eq]);let ri=(0,X.A)(eA,500);(0,i.useEffect)(()=>{(async()=>{if(!ri.trim())return tw({serials:[],variants:[]});tI(!0);try{let e=await F.Ay.searchVariantByQR(ri.trim(),{fulfillmentType:eq});console.log("Search response:",e);let t=null;if(e.data&&("data"in e.data&&e.data.data?t=e.data.data:("serials"in e.data||"variants"in e.data)&&(t=e.data)),t){let e=t.serials||[],r=t.variants||[];tw({serials:e,variants:r})}else console.log("No search data found"),tw({serials:[],variants:[]})}catch(e){console.error("Error searching variants:",e),tw({serials:[],variants:[]})}finally{tI(!1)}})()},[ri,eq]);let ra=(0,i.useCallback)(e=>{var t,r,n,i,a;let s=e.product.tracking_mode,o=e.variant.variant_code,l=(null==(t=e.stock_serial)?void 0:t.serial)||"";if(s===G.t.SERIAL&&eq===F.er.INSTANT){if(ex.some(e=>e.specificationCode===l&&""!==l))return{success:!1,message:'M\xe3 quy c\xe1ch "'.concat(l,'" đ\xe3 tồn tại trong đơn h\xe0ng')};let t=parseFloat((null==(r=e.variant.attrs.weight_g)?void 0:r.value)||"0"),i=Math.round(e.price.price),a=0*i/100,c=e.variant.fees.making_fee,d={product:e.product,variant:e.variant,price:e.price,stock_serial:e.stock_serial||{serial:"",status:"available",warehouse_id:"",received_at:new Date().toISOString()}},u=(null==(n=e.warehouse_staff_ids)?void 0:n.map(e=>
1e.warehouse_staff_id))||[],h={id:"".concat(Date.now(),"-").concat(Math.random()),variantCode:o,productName:e.product.name||e.product.show_name,trackingMode:s,specificationCode:l,price:i,discountPercent:0,discountAmount:a,discountMode:"percent",quantity:1,weight:t,laborCost:c,totalAmount:i-a,sellerStaffId:"",warehouseStaffId:"",variantData:d,warehouseStaffIds:u.length>0?u:void 0};return ey(e=>{let t=[...e,h];return t4("items",t,{shouldValidate:!0}),t}),{success:!0}}if(s===G.t.QUANTITY||eq===F.er.PREORDER){let t=ex.findIndex(e=>e.variantCode===o);if(-1!==t){let e=ex[t],r=e.quantity+1,n=(e.price-e.discountAmount)*r;return ey(i=>{let a=[...i];return a[t]={...e,quantity:r,totalAmount:n},t4("items",a,{shouldValidate:!0}),a}),{success:!0}}{let t=parseFloat((null==(i=e.variant.attrs.weight_g)?void 0:i.value)||"0"),r=Math.round(e.price.price),n=0*r/100,c=e.variant.fees.making_fee,d={product:e.product,variant:e.variant,price:e.price,stock_serial:e.stock_serial||{serial:"",status:"available",warehouse_id:"",received_at:new Date().toISOString()}},u=(null==(a=e.warehouse_staff_ids)?void 0:a.map(e=>
1e.warehouse_staff_id))||[],h={id:"".concat(Date.now(),"-").concat(Math.random()),variantCode:o,productName:e.product.show_name||e.product.name,trackingMode:s,specificationCode:l,price:r,discountPercent:0,discountAmount:n,discountMode:"percent",quantity:1,weight:t,laborCost:c,totalAmount:r-n,sellerStaffId:"",warehouseStaffId:"",variantData:d,warehouseStaffIds:u.length>0?u:void 0};return ey(e=>{let t=[...e,h];return t4("items",t,{shouldValidate:!0}),t}),{success:!0}}}return{success:!1,message:"Tracking mode kh\xf4ng hợp lệ"}},[ex,t4,eq]),rs=(0,i.useCallback)(async e=>{let t=e.serial?"".concat(e.variant.variant_code,"_").concat(e.serial):e.variant.variant_code;e_(!0);try{let e=await F.Ay.getVariantDetails([t],{fulfillmentType:eq});if(e.data){let{items:t=[],item_errors:r=[]}=e.data;if(r.length>0&&tM({open:!0,errors:r}),t.length>0){let e=t[0],r=ra(e);r.success?(0,K.M8)("Đ\xe3 th\xeam sản phẩm v\xe0o đơn h\xe0ng",{variant:"success"}):(0,K.M8)(r.message||"Kh\xf4ng thể th\xeam sản phẩm",{variant:"error"})}}ej("")}catch(e){console.error("Error getting variant details:",e),(0,K.M8)("Lỗi khi lấy th\xf4ng tin sản phẩm",{variant:"error"})}finally{e_(!1)}},[ra,eq]),ro=(0,i.useCallback)(async()=>{if(!eA.trim())return void(0,K.M8)("Vui l\xf2ng nhập m\xe3 QR",{variant:"warning"});if(tC.serials.length>0)rs(tC.serials[0]);else if(tC.variants.length>0)rs(tC.variants[0]);else if(!tk){e_(!0);try{let e=await F.Ay.getVariantDetails([eA.trim()],{fulfillmentType:eq});if(e.data){let{items:t=[],item_errors:r=[]}=e.data;if(r.length>0&&tM({open:!0,errors:r}),t.length>0){let e=t[0],r=ra(e);r.success?((0,K.M8)("Đ\xe3 th\xeam sản phẩm v\xe0o đơn h\xe0ng",{variant:"success"}),ej("")):(0,K.M8)(r.message||"Kh\xf4ng thể th\xeam sản phẩm",{variant:"error"})}else(0,K.M8)("Kh\xf4ng t\xecm thấy sản phẩm, vui l\xf2ng kiểm tra lại m\xe3 QR",{variant:"warning"})}}catch(e){console.error("Error getting variant details:",e),(0,K.M8)("Lỗi khi lấy th\xf4ng tin sản phẩm",{variant:"error"})}finally{e_(!1)}}},[eA,tC,tk,rs,ra,eq]);(0,i.useEffect)(()=>{let e=e=>{if("F3"===e.key){e.preventDefault();let t=document.getElementById("qr-code-input");t&&t.focus()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);let rl=()=>{tE({open:!1,qrCodes:""})},rc=(0,i.useCallback)(async()=>{if(!tT.qrCodes.trim())return void(0,K.M8)("Vui l\xf2ng nhập danh s\xe1ch QR code",{variant:"warning"});let e=tT.qrCodes.split("\n").map(e=>e.trim()).filter(e=>e.length>0);if(0===e.length)return void(0,K.M8)("Kh\xf4ng c\xf3 QR code hợp lệ",{variant:"warning"});tN(!0);try{let t=await F.Ay.getVariantDetails(e,{fulfillmentType:eq});if(t.data){let{items:e=[],item_errors:r=[]}=t.data,n=0,i=0;for(let t of e)ra(t).success?n++:i++;n>0&&(0,K.M8)("Đ\xe3 th\xeam ".concat(n," sản phẩm v\xe0o đơn h\xe0ng"),{variant:"success"}),i>0&&(0,K.M8)("".concat(i," sản phẩm đ\xe3 tồn tại trong đơn h\xe0ng"),{variant:"warning"}),r.length>0&&tM({open:!0,errors:r}),0===r.length&&rl()}}catch(e){console.error("Error processing bulk QR codes:",e),(0,K.M8)("Lỗi khi xử l\xfd danh s\xe1ch QR code",{variant:"error"})}finally{tN(!1)}},[tT.qrCodes,ra,eq]),rd=()=>{tV({open:!1,newMode:null})},ru=ex.reduce((e,t)=>t.trackingMode===G.t.QUANTITY||eq===F.er.PREORDER?e+t.weight*t.quantity:e+t.weight,0),rh=ex.reduce((e,t)=>e+t.price*t.quantity,0),rp=ex.reduce((e,t)=>e+t.discountAmount*t.quantity,0),rx=rh-rp,rm=(e,t)=>{let r=ex.map(r=>{var n;if(r.id!==e)return r;let i={...r,...t};"price"in t&&t.price!==r.price&&void 0===r.systemPrice&&(i.systemPrice=r.price);let a=null!=(n=i.discountMode)?n:"percent",{discountPercent:s,discountAmount:o,priceRounded:l}=function(e){let t=Math.round(Number(e.price)||0);if("amount"===e.mode){let r=eG(Math.ceil(Number(e.amount)||0),0,t);return{discountPercent:eX(t>0?r/t*100:0),discountAmount:r,priceRounded:t}}let r=eX(eG(Number(e.percent)||0,0,100)),n=eG(Math.ceil(t*r/100),0,t);return{discountPercent:r,discountAmount:n,priceRounded:t}}({price:i.price,quantity:i.quantity,mode:a,percent:i.discountPercent,amount:i.discountAmount});return{...i,discountMode:a,price:l,discountPercent:s,discountAmount:o,totalAmount:(l-o)*i.quantity}});ey(r),t4("items",r,{shouldValidate:!0})},rg=e=>{ey(t=>{let r=t.filter(t=>t.id!==e);return t4("items",r,{shouldValidate:!0}),r})},rf=()=>{eW(null)},rv=e=>{e!==eP?(J.Ay.set(J.d5.POS_STORE_ID,e),eH(e),t$.clearActive(),tU(),rf(),tD.reload()):rf()},ry=async()=>{eY(!0),rf();try{var e,t;let r=await tL((0,et.H)()).unwrap();r&&r.success?((0,K.M8)((null==(e=r.data)?void 0:e.message)||"Đăng xuất th\xe0nh c\xf4ng",{variant:"success"}),tL((0,er.T_)()),tD.push("/pos/dang-nhap")):(0,K.M8)((null==r||null==(t=r.error)?void 0:t.message)||"Đăng xuất thất bại",{variant:"error"})}catch(e){console.error("Logout error:",e),(0,K.M8)(e||"Đăng xuất thất bại",{variant:"error"}),tL((0,er.T_)()),tD.push("/pos/dang-nhap")}finally{eY(!1)}},rA=async e=>{var t,r,n;if(th&&!tg)return void(0,K.M8)("Vui l\xf2ng chọn phi\xean livestream",{variant:"warning"});if(th&&(null==tv||null==(t=tv.sale_ib_staff_ids)?void 0:t.length)>1&&!tb)return void(0,K.M8)("Vui l\xf2ng chọn NV chốt đơn",{variant:"warning"});if(e.birthday&&!function(e){let[t,r,n]=e.split("-").map(Number);if(!t||!r||!n)return!1;let i=new Date(t,r-1,n);if(Number.isNaN(i.getTime())||i.getFullYear()!==t||i.getMonth()!==r-1||i.getDate()!==n)return!1;let a=new Date;return i<=new Date(a.getFullYear()-18,a.getMonth(),a.getDate())}(e.birthday))return void t9("birthday",{type:"manual",message:"Kh\xe1ch h\xe0ng phải đủ 18 tuổi trở l\xean"});eI(!0);
1try{let t=(e.citizen_id||"").trim(),r={customer_name:e.name,customer_phone:e.phone,customer_address:e.address||"",customer_city_id:e.cityId,customer_ward_id:e.wardId||"",customer_email:e.email||"",customer_birthday:e.birthday||"",citizen_id:t||void 0,description:e.description||"",care_staff_id:e.careStaffId,payment_method:ez,pricing_method:"weight",fulfillment_type:eq,delivery_days:e.delivery_days||void 0,user_type:e.user_type,invoice_name:e.invoice_name||"",invoice_tax_id:e.invoice_tax_id||"",invoice_address:e.invoice_address||"",invoice_email:e.invoice_email||"",misa_account_object_id:e.misa_account_object_id||void 0,buyer_name:e.buyer_name||void 0,buyer_cccd:e.buyer_cccd||void 0,vouchers:e0.length>0?e0:void 0,...th&&tv?{live_session_id:tg,commission_staff:(()=>{let e=[];if(tv.streamer_staff_id){let t=tv.streamer_staff_id._id||tv.streamer_staff_id;e.push({role_code:"STREAMER",staff_id:t.toString()})}for(let t of tv.assistant_staff_ids||[]){let r=t._id||t;e.push({role_code:"PHU_LIVE",staff_id:r.toString()})}let t=tv.sale_ib_staff_ids||[];if(1===t.length){let r=t[0]._id||t[0];e.push({role_code:"SALE_IB",staff_id:r.toString()})}else tb&&e.push({role_code:"SALE_IB",staff_id:tb});return e})()}:{},items:ex.map(e=>{let t,r=e.variantData.stock_serial.serial||"";return{variant_code_serial:e.trackingMode!==G.t.QUANTITY||r?"".concat(e.variantCode,"_").concat(r):e.variantCode,price:e.price,discount_amount:e.discountAmount*e.quantity,discount_percent:e.discountPercent,seller_staff_id:e.sellerStaffId,warehouse_staff_id:e.warehouseStaffId,quantity:e.quantity,...void 0!==e.systemPrice?{system_price:e.systemPrice}:{}}}),...t$.active?{otp_id:t$.active.otp_id}:{}},n=await F.Ay.createOrder(r);if(n.success)(0,K.M8)("Tạo đơn h\xe0ng th\xe0nh c\xf4ng",{variant:"success"}),t5({phone:"",name:"",citizen_id:"",email:"",address:"",cityId:"",wardId:"",birthday:"",description:"",careStaffId:"",fulfillment_type:eq,delivery_days:null,items:[],user_type:F.ut.PERSONAL,invoice_same_as_delivery:!1,invoice_name:"",invoice_tax_id:"",invoice_address:"",invoice_email:"",misa_account_object_id:null}),ey([]),ej(""),e1([]),ti(null),tl(null),td(null),t$.clearActive();else{let e=n.error,t=(null==e?void 0:e.code)||(null==e?void 0:e.error);["otp_required","otp_expired","otp_state_invalid","otp_owner_mismatch","otp_store_mismatch"].includes(t)?((0,K.M8)((null==e?void 0:e.message)||"OTP hết hạn hoặc kh\xf4ng hợp lệ — vui l\xf2ng nhập m\xe3 mới",{variant:"warning"}),t$.clearActive(),t$.openEnter()):(0,K.M8)((null==e?void 0:e.message)||"Lỗi khi tạo đơn h\xe0ng",{variant:"error"})}}catch(t){let e=null==t||null==(n=t.response)||null==(r=n.data)?void 0:r.error;["otp_required","otp_expired","otp_state_invalid","otp_owner_mismatch","otp_store_mismatch"].includes((null==e?void 0:e.code)||e)?((0,K.M8)((null==e?void 0:e.message)||"OTP hết hạn hoặc kh\xf4ng hợp lệ — vui l\xf2ng nhập m\xe3 mới",{variant:"warning"}),t$.clearActive(),t$.openEnter()):(console.error("Error creating order:",t),(0,K.M8)("Lỗi khi tạo đơn h\xe0ng",{variant:"error"}))}finally{eI(!1)}};return(0,n.jsxs)(a.A,{sx:{height:"100vh",display:"flex",flexDirection:"column",overflow:{xs:"auto",md:"hidden"}},children:[(0,n.jsx)(o.A,{position:"sticky",sx:{backgroundColor:"#fff",boxShadow:1,top:0,zIndex:e=>e.zIndex.appBar},children:(0,n.jsxs)(l.A,{sx:{justifyContent:"space-between",minHeight:{xs:"56px",sm:"64px"},px:{xs:1,sm:2}},children:[(0,n.jsxs)(a.A,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:0,mb:{xs:.5,sm:1}},children:[(0,n.jsx)(Z(),{src:"/icons/logo.png",alt:"Ancarat Logo",width:80,height:27,style:{width:"auto",height:"auto",maxWidth:"120px",maxHeight:"40px"}}),tF&&eP&&(0,n.jsx)(s.A,{variant:"body2",noWrap:!0,sx:{color:"#666",fontSize:{xs:"0.7rem",sm:"0.875rem"},fontWeight:500,display:"block",maxWidth:{xs:160,sm:"none"}},children:(null==(r=tF.stores.find(e=>e.store_id===eP))?void 0:r.store_name)||""})]}),(0,n.jsxs)(a.A,{sx:{display:"flex",alignItems:"center",gap:{xs:.75,sm:1},ml:"auto"},children:[tH&&tq&&(0,n.jsxs)(a.A,{sx:{px:{xs:1,sm:1.25},py:.5,borderRadius:"10px",bgcolor:tX<30?"#fff7ed":"#f4f7fb",border:"1px solid",borderColor:tX<30?"#fb923c":"#dbe3ee",minWidth:{xs:96,sm:178},maxWidth:{xs:160,sm:260},display:"flex",flexDirection:"column",gap:.25},children:[(0,eK.U)(tq.shift_start_at)&&(0,n.jsxs)(s.A,{variant:"caption",noWrap:!0,sx:{alignSelf:"stretch",px:.5,py:.125,borderRadius:"4px",bgcolor:"#fef3c7",color:"#b45309",fontWeight:700,fontSize:{xs:"0.62rem",sm:"0.7rem"},lineHeight:1.3,textAlign:"center"},children:["Ca ng\xe0y ",(0,eK.Y)(tq.shift_start_at)]}),(0,n.jsxs)(a.A,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",gap:{xs:.25,sm:1}},children:[(0,n.jsxs)(a.A,{sx:{minWidth:0},children:[(0,n.jsx)(s.A,{variant:"caption",noWrap:!0,sx:{color:"#1f2937",display:"block",fontWeight:700,fontSize:{xs:"0.68rem",sm:"0.78rem"},lineHeight:1.15},children:tq.shift_name}),(0,n.jsxs)(s.A,{variant:"caption",noWrap:!0,sx:{color:"#64748b",display:{xs:"none",md:"block"},fontSize:"0.7rem",lineHeight:1.15},children:[te(tq.shift_start_at)," - ",te(tq.shift_end_at)]})]}),(0,n.jsx)(s.A,{variant:"caption",noWrap:!0,sx:{color:tX<30?"#c2410c":"#2563eb",fontWeight:800,fontSize:{xs:"0.66rem",sm:"0.76rem"},lineHeight:1.15,flexShrink:0},children:tX>0?tt(tX):"Hết giờ"}),(0,n.jsx)(c.A,{size:"small",variant:"contained",color:"warning",onClick:()=>tD.push("/pos/ket-ca"),sx:{minWidth:0,px:{xs:.75,sm:1},py:.25,borderRadius:"8px",fontSize:{xs:"0.62rem",sm:"0.7rem"},fontWeight:800,lineHeight:1.2,textTransform:"none",boxShadow:"none",flexShrink:0,"&:hover":{boxShadow:"none"}},children:"Kết ca"})]})]}),tF&&(0,n.jsxs)(a.A,{onClick:e=>{eW(e.currentTarget)},sx:{display:"flex",alignItems:"center",gap:{xs:.5,sm:1},cursor:"pointer",padding:{xs:"4px 6px",sm:"8px 12px"},borderRadius:1,"&:hover":{backgroundColor:"#f5f5f5"}},children:[(0,n.jsx)(d.A,{sx:{width:{xs:28,sm:32},height:{xs:28,sm:32},bgcolor:"#9c27b0"},children:tF.name.charAt(0).toUpperCase()}),(0,n.jsx)(s.A,{variant:"body1",sx:{color:"#333",fontWeight:500,fontSize:{xs:"0.8rem",sm:"1rem"},display:{xs:"none",sm:"block"}},children:tF.name}),(0,n.jsx)(N,{sx:{color:"#666",fontSize:{xs:"1.2rem",sm:"1.5rem"}}})]})]}),(0,n.jsxs)(u.A,{anchorEl:eL,open:!!eL,onClose:rf,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},PaperProps:{sx:{mt:1,minWidth:250}},children:[(0,n.jsx)(a.A,{sx:{px:2,py:1,borderBottom:"1px solid #e0e0e0"},children:(0,n.jsx)(s.A,{variant:"subtitle2",fontWeight:"bold",color:"text.secondary",children:"Cửa h\xe0ng"})}),(null==tF?void 0:tF.stores)&&tF.stores.length>0?(0,n.jsxs)(n.Fragment,{children:[tF.stores.map(e=>{let t=e.store_id===eP;return(0,n.jsxs)(h.A,{onClick:()=>rv(e.store_id),sx:{backgroundColor:t?"#f5f5f5":"transparent","&:hover":{backgroundColor:t?"#eeeeee":"#f9f9f9"}},children:[(0,n.jsx)(O.A,{sx:{mr:1,color:"#9c27b0"}}),(0,n.jsxs)(a.A,{sx:{flex:1},children:[(0,n.jsx)(s.A,{variant:"body2",fontWeight:t?700:500,children:e.store_name}),(0,n.jsx)(s.A,{variant:"caption",color:"text.secondary",children:e.code})]}),t&&(0,n.jsx)(V,{sx:{ml:1,color:"#9c27b0",fontSize:20}})]},e.store_id)}),(0,n.jsx)(p.A,{sx:{my:1}}),(0,n.jsxs)(h.A,{onClick:ry,disabled:eB,sx:{color:"#d32f2f","&:hover":{backgroundColor:"#ffebee"}},children:[(0,n.jsx)(D,{sx:{mr:1,color:"#d32f2f"}}),(0,n.jsx)(s.A,{variant:"body2",fontWeight:500,children:"Đăng xuất"})]})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(h.A,{disabled:!0,children:(0,n.jsx)(s.A,{variant:"body2",color:"text.secondary",children:"Kh\xf4ng c\xf3 cửa h\xe0ng"})}),(0,n.jsx)(p.A,{sx:{my:1}}),(0,n.jsxs)(h.A,{onClick:ry,disabled:eB,sx:{color:"#d32f2f","&:hover":{backgroundColor:"#ffebee"}},children:[(0,n.jsx)(D,{sx:{mr:1,color:"#d32f2f"}}),(0,n.jsx)(s.A,{variant:"body2",fontWeight:500,children:"Đăng xuất"})]})]})]})]})}),(0,n.jsx)(x.A,{maxWidth:!1,sx:{flex:1,overflow:{xs:"visible",md:"hidden"},p:{xs:1,sm:2},minHeight:{xs:"auto",md:0}},children:(0,n.jsxs)(m.A,{direction:{xs:"column",md:"row"},spacing:2,sx:{width:"100%",height:{xs:"auto",md:"100%"}
1,minHeight:{xs:"calc(100vh - 56px)",md:"auto"}},children:[(0,n.jsx)(a.A,{sx:{width:{xs:"100%",md:"300px"},order:{xs:1,md:1}},children:(0,n.jsxs)(m.A,{direction:"column",gap:1,sx:{backgroundColor:"white",p:{xs:1,sm:2},height:{xs:"auto",md:"100%"},overflowY:{xs:"visible",md:"auto"}},children:[(0,n.jsxs)(m.A,{direction:"column",gap:1,children:[(0,n.jsxs)(a.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:{xs:"pointer",md:"default"}},onClick:()=>{window.innerWidth<900&&e$(!eU)},children:[(0,n.jsx)(s.A,{variant:"h6",fontWeight:"bold",children:"Th\xf4ng Tin Kh\xe1ch H\xe0ng"}),(0,n.jsx)(g.A,{sx:{display:{xs:"block",md:"none"}},size:"small",children:eU?(0,n.jsx)(L.A,{}):(0,n.jsx)(W.A,{})})]}),(0,n.jsx)(p.A,{}),(0,n.jsx)(a.A,{sx:{mt:1},children:(0,n.jsx)(eS,{setValue:t4,userType:re})}),(0,n.jsx)(a.A,{sx:{my:1},children:(0,n.jsxs)(f.A,{value:re,exclusive:!0,onChange:(e,t)=>{null!==t&&(t4("phone",""),t4("name",""),t4("citizen_id",""),t4("email",""),t4("address",""),t4("cityId",""),t4("cityName",""),t4("wardId",""),t4("wardName",""),t4("birthday",""),t4("description",""),t4("invoice_same_as_delivery",!1),t4("invoice_name",""),t4("invoice_tax_id",""),t4("invoice_address",""),t4("invoice_email",""),t4("buyer_name",""),t4("buyer_cccd",""),t4("user_type",t))},size:"small",sx:{height:"36px",width:"100%","& .MuiToggleButton-root":{flex:1},"& .MuiToggleButton-root.Mui-selected":{backgroundColor:e=>e.palette.primary.main,color:e=>e.palette.primary.contrastText,"&:hover":{backgroundColor:e=>e.palette.primary.dark,color:e=>e.palette.primary.contrastText}}},children:[(0,n.jsx)(v.A,{value:F.ut.PERSONAL,children:"C\xe1 nh\xe2n"}),(0,n.jsx)(v.A,{value:F.ut.ORGANIZATION,children:"Tổ chức"})]})}),(0,n.jsx)(a.A,{sx:{display:{xs:"block",md:"none"}},children:(0,n.jsx)(y.A,{in:eU,timeout:"auto",children:(0,n.jsx)(eE.default,{control:tJ,errors:t1,setValue:t4,setError:t9,clearErrors:t6,trigger:t7,cityId:t8,fulfillmentMode:eq,userType:re})})}),(0,n.jsx)(a.A,{sx:{display:{xs:"none",md:"block"}},children:(0,n.jsx)(eR.default,{control:tJ,errors:t1,setValue:t4,setError:t9,clearErrors:t6,trigger:t7,cityId:t8,fulfillmentMode:eq,userType:re})})]}),(0,n.jsx)(a.A,{sx:{display:{xs:"block",md:"none"},mt:0},children:(0,n.jsxs)(m.A,{direction:"column",gap:1,children:[(0,n.jsxs)(a.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer"},onClick:()=>eJ(!eZ),children:[(0,n.jsxs)(a.A,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,n.jsx)(s.A,{variant:"h6",fontWeight:"bold",children:"Tỉ Gi\xe1"}),(0,n.jsxs)(s.A,{variant:"caption",sx:{color:"#666",fontSize:"0.75rem"},children:["(",tS,"s)"]})]}),(0,n.jsx)(g.A,{size:"small",children:eZ?(0,n.jsx)(L.A,{}):(0,n.jsx)(W.A,{})})]}),(0,n.jsx)(p.A,{}),(0,n.jsx)(y.A,{in:eZ,timeout:"auto",children:(0,n.jsx)(eg,{showHeader:!1})})]})}),(0,n.jsx)(a.A,{sx:{display:{xs:"none",md:"flex"},flexDirection:"column",flexGrow:1,minHeight:0,mt:"auto",flexShrink:0},children:(0,n.jsx)(eg,{showHeader:!0})})]})}),(0,n.jsx)(a.A,{sx:{flex:1,overflowY:{xs:"visible",md:"auto"},minHeight:{xs:"auto",md:0},display:"flex",flexDirection:"column",order:{xs:2,md:2}},children:(0,n.jsxs)(m.A,{direction:"column",gap:2,sx:{pb:{xs:"calc(80px + env(safe-area-inset-bottom))",md:0}},children:[(0,n.jsxs)(m.A,{direction:"column",gap:2,sx:{backgroundColor:"white",p:{xs:1,sm:2}},children:[(0,n.jsx)(a.A,{sx:{px:{xs:0,sm:2},pt:{xs:0,sm:2}},children:(0,n.jsxs)(A.Ay,{container:!0,spacing:2,alignItems:"center",children:[(0,n.jsx)(A.Ay,{item:!0,xs:12,md:7,children:(0,n.jsxs)(m.A,{direction:{xs:"column",sm:"row"},gap:1,sx:{position:"relative"},children:[(0,n.jsx)(a.A,{sx:{flex:{xs:1,sm:"auto"},width:{xs:"100%",sm:"auto"}}
1,children:(0,n.jsx)(ef.default,{qrCode:eA,onQrCodeChange:ej,searchResults:tC,onSelectItem:rs,isSearching:tk,onEnter:ro})}),(0,n.jsxs)(m.A,{direction:"row",gap:1,sx:{width:{xs:"100%",sm:"auto"}},children:[(0,n.jsx)(c.A,{variant:"outlined",color:"primary",onClick:()=>{tE({open:!0,qrCodes:""})},sx:{minWidth:{xs:"auto",sm:100},width:{xs:"auto",sm:"auto"},height:"36px",flex:{xs:"none",sm:"none"},whiteSpace:"nowrap"},children:"Nhập DS"}),(0,n.jsxs)(f.A,{value:eq,exclusive:!0,onChange:(e,t)=>{null!==t&&t!==eq&&(ex.length>0?tV({open:!0,newMode:t}):(eQ(t),t4("fulfillment_type",t,{shouldValidate:!0})))},size:"small",sx:{height:"36px",width:{xs:"100%",sm:"auto"},flex:{xs:1,sm:"none"},"& .MuiToggleButton-root":{flex:{xs:1,sm:"none"}},"& .MuiToggleButton-root.Mui-selected":{backgroundColor:e=>e.palette.primary.main,color:e=>e.palette.primary.contrastText,"&:hover":{backgroundColor:e=>e.palette.primary.dark,color:e=>e.palette.primary.contrastText}}},children:[(0,n.jsx)(v.A,{value:"INSTANT","aria-label":"Giao ngay",sx:{whiteSpace:"nowrap"},children:"Giao Ngay"}),(0,n.jsx)(v.A,{value:"PREORDER","aria-label":"Đặt trước",sx:{whiteSpace:"nowrap"},children:"Đặt Trước"})]}),(0,n.jsx)(v.A,{value:"livestream",selected:th,disabled:!t3,onChange:()=>tp(!th),size:"small",sx:{height:"36px",whiteSpace:"nowrap",...th?{backgroundColor:"#7c3aed !important",color:"#fff !important","&:hover":{backgroundColor:"#6d28d9 !important"}}:{}},title:t3?"":"Chưa c\xf3 phi\xean live n\xe0o đang hoạt động",children:"Livestream"})]})]})}),(0,n.jsx)(A.Ay,{item:!0,xs:12,md:5,sx:{display:{xs:"none",md:"block"}},children:(0,n.jsxs)(m.A,{direction:"row",gap:2,justifyContent:"flex-end",alignItems:"center",children:[(0,n.jsxs)(s.A,{variant:"body2",sx:{fontSize:"0.875rem"},children:["Ng\xe0y: ",(0,Q.GP)(new Date,"dd-MM-yyyy")]}),(0,n.jsx)(c.A,{variant:"contained",color:"primary",sx:{width:200,height:"36px"},onClick:()=>window.open("https://giavang.ancarat.com","_blank"),children:"Gi\xe1 V\xe0ng"})]})})]})}),th&&(0,n.jsxs)(a.A,{sx:{px:2,py:1,bgcolor:"#faf5ff",borderBottom:"1px solid #e9d5ff",display:"flex",alignItems:"center",gap:2,flexWrap:"wrap"},children:[(0,n.jsxs)(j.A,{size:"small",sx:{minWidth:250},children:[(0,n.jsx)(b.A,{children:"Phi\xean livestream"}),(0,n.jsx)(_.A,{value:tg,onChange:e=>tf(e.target.value),label:"Phi\xean livestream",children:tx.map(e=>{var t;let r="APPROVED"===e.status;return(0,n.jsxs)(h.A,{value:e._id,children:[e.title,(null==(t=e.streamer_staff_id)?void 0:t.name)?" — ".concat(e.streamer_staff_id.name):"",r&&(0,n.jsx)("span",{style:{marginLeft:8,fontSize:"0.7rem",padding:"1px 6px",borderRadius:4,background:"#e5e7eb",color:"#6b7280"},children:"Đ\xc3 Đ\xd3NG"})]},e._id)})})]}),tv&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a.A,{sx:{fontSize:"0.75rem",color:"#6b21a8",display:"flex",gap:2,flexWrap:"wrap"},children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("strong",{children:"Streamer:"})," ",(null==(E=tv.streamer_staff_id)?void 0:E.name)||"—"]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("strong",{children:"Phụ live:"})," ",(null==(R=tv.assistant_staff_ids)?void 0:R.map(e=>e.name).filter(Boolean).join(", "))||"—"]})]}),(null==($=tv.sale_ib_staff_ids)?void 0:$.length)>1?(0,n.jsxs)(j.A,{size:"small",sx:{minWidth:180},children:[(0,n.jsx)(b.A,{children:"NV chốt đơn"}),(0,n.jsx)(_.A,{value:tb,onChange:e=>t_(e.target.value),label:"NV chốt đơn",children:tv.sale_ib_staff_ids.map(e=>(0,n.jsx)(h.A,{value:(e._id||e).toString(),children:e.name||e._id||e},e._id||e))})]}):(null==(en=tv.sale_ib_staff_ids)?void 0:en.length)===1?(0,n.jsxs)(a.A,{sx:{fontSize:"0.75rem",color:"#6b21a8"},children:[(0,n.jsx)("strong",{children:"NV chốt đơn:"})," ",(null==(ei=tv.sale_ib_staff_ids[0])?void 0:ei.name)||"—"]}):null]})]}),(0,n.jsx)(p.A,{}),t1.items&&!Array.isArray(t1.items)&&(0,n.jsx)(a.A,{sx:{px:2,py:1,backgroundColor:"#ffebee"},children:(0,n.jsx)(s.A,{variant:"caption",color:"error",children:t1.items.message})}),!tQ.can_edit_price_discount&&(0,n.jsx)(e9.default,{locked:tZ,managerName:null==(ea=t$.active)?void 0:ea.manager_name,expiresAtIso:null!=(ec=null==(es=t$.active)?void 0:es.expires_at)?ec:null,onRequestOtp:t$.openEnter}),(0,n.jsx)(a.A,{sx:{display:{xs:"none",md:"block"},flex:1},children:(0,n.jsx)(eC.default,{orderItems:ex,fulfillmentMode:eq,errors:t1,editingPriceId:eN,priceInputValues:eV,formatPrice:e7,formatPriceInput:e8,parsePrice
1:e3,setEditingPriceId:eO,setPriceInputValues:eD,updateItem:rm,removeItem:rg,priceLocked:tZ})}),(0,n.jsx)(a.A,{sx:{display:{xs:"block",md:"none"}},children:(0,n.jsx)(ew.default,{orderItems:ex,fulfillmentMode:eq,errors:t1,editingPriceId:eN,priceInputValues:eV,formatPrice:e7,formatPriceInput:e8,parsePrice:e3,setEditingPriceId:eO,setPriceInputValues:eD,updateItem:rm,removeItem:rg,priceLocked:tZ})}),(0,n.jsxs)(A.Ay,{container:!0,spacing:2,alignItems:"center",sx:{py:{xs:1,sm:2}},children:[(0,n.jsx)(A.Ay,{item:!0,xs:12,md:6,children:(0,n.jsxs)(m.A,{direction:"column",spacing:1,alignItems:"flex-start",children:[(0,n.jsx)(s.A,{variant:"h6",sx:{fontSize:{xs:"1rem",sm:"1.25rem"}},children:"H\xecnh thức thanh to\xe1n:"}),(0,n.jsxs)(m.A,{direction:"row",gap:1,sx:{flexWrap:{xs:"wrap",sm:"nowrap"},width:"100%"},children:[(0,n.jsx)(tr,{icon:(0,n.jsx)(P,{sx:{fontSize:{xs:24,sm:32}}}),label:"Ng\xe2n H\xe0ng",selected:"bank"===ez,onClick:()=>eM("bank")}),(0,n.jsx)(tr,{icon:(0,n.jsx)(H.A,{sx:{fontSize:{xs:24,sm:32}}}),label:"Tiền Mặt",selected:"cash"===ez,onClick:()=>eM("cash")}),(0,n.jsx)(tr,{icon:(0,n.jsx)(B,{sx:{fontSize:{xs:24,sm:32}}}),label:"Cả hai",selected:"both"===ez,onClick:()=>eM("both")})]})]})}),(0,n.jsx)(A.Ay,{item:!0,xs:12,md:6,children:(0,n.jsxs)(A.Ay,{container:!0,spacing:1,children:[ex.length>0&&(0,n.jsx)(A.Ay,{item:!0,xs:12,children:(0,n.jsx)(eF,{appliedVouchers:((null==tn?void 0:tn.applied_vouchers)||[]).map(e=>({code:e.code||e.voucher_code,voucher_code:e.voucher_code,description:e.description,discount_amount:e.discount_amount})),attemptedCodes:e0,onApply:e=>{e1(t=>t.includes(e)?t:[...t,e]),tl(null)},onRemove:e=>{e1(t=>t.filter(t=>t!==e)),tl(null)},isApplying:ta,error:to,onClearError:()=>{let e=((null==tn?void 0:tn.rejected_vouchers)||[]).map(e=>e.code);e.length>0&&e1(t=>t.filter(t=>!e.includes(t))),tl(null)}})}),(0,n.jsx)(A.Ay,{item:!0,xs:12,children:(0,n.jsx)(p.A,{})}),(0,n.jsx)(A.Ay,{item:!0,xs:6,children:(0,n.jsx)(s.A,{variant:"body2",sx:{fontSize:{xs:"0.75rem",sm:"0.875rem"}},children:"H\xecnh thức t\xednh tiền:"})}),(0,n.jsx)(A.Ay,{item:!0,xs:6,children:(0,n.jsx)(c.A,{size:"small",variant:"contained",color:"primary",disableRipple:!0,tabIndex:-1,sx:{height:{xs:"20px",sm:"24px"},fontSize:{xs:"0.65rem",sm:"0.75rem"},pointerEvents:"none",cursor:"default"},children:(0,n.jsx)(s.A,{sx:{fontSize:{xs:"0.65rem",sm:"0.75rem"}},children:"Trọng Lượng"})})}),(0,n.jsx)(A.Ay,{item:!0,xs:12,children:(0,n.jsx)(p.A,{})}),(0,n.jsx)(A.Ay,{item:!0,xs:6,children:(0,n.jsx)(s.A,{variant:"body2",sx:{fontSize:{xs:"0.75rem",sm:"0.875rem"}},children:"Tổng Trọng lượng:"})}),(0,n.jsx)(A.Ay,{item:!0,xs:6,children:(0,n.jsx)(s.A,{variant:"body2",sx:{fontSize:{xs:"0.75rem",sm:"0.875rem"}},children:(0,n.jsx)("strong",{children:ru.toFixed(2)})})}),(0,n.jsx)(A.Ay,{item:!0,xs:12,children:(0,n.jsx)(p.A,{})}),(0,n.jsx)(A.Ay,{item:!0,xs:6,children:(0,n.jsx)(s.A,{variant:"body2",sx:{fontSize:{xs:"0.75rem",sm:"0.875rem"}},children:"Tổng tiền h\xe0ng:"})}),(0,n.jsx)(A.Ay,{item:!0,xs:6,children:(0,n.jsx)(s.A,{variant:"body2",sx:{fontSize:{xs:"0.75rem",sm:"0.875rem"}},children:(0,n.jsx)("strong",{children:e7(null!=(ed=null==tn?void 0:tn.pricing.original_price_with_vat)?ed:rh)})})}),(0,n.jsx)(A.Ay,{item:!0,xs:12,children:(0,n.jsx)(p.A,{})}),(0,n.jsx)(A.Ay,{item:!0,xs:6,children:(0,n.jsx)(s.A,{variant:"body2",sx:{fontSize:{xs:"0.75rem",sm:"0.875rem"}},children:"Chiết khấu sản phẩm:"})}),(0,n.jsx)(A.Ay,{item:!0,xs:6,children:(0,n.jsx)(s.A,{variant:"body2",sx:{fontSize:{xs:"0.75rem",sm:"0.875rem"},color:"error.main"},children:(0,n.jsxs)("strong",{children:["-",e7(null!=(eu=null==tn?void 0:tn.pricing.direct_discount)?eu:rp)]})})}),(0,n.jsx)(A.Ay,{item:!0,xs:12,children:(0,n.jsx)(p.A,{})}),(null==tn?void 0:tn.pricing.voucher_discount)!=null&&tn.pricing.voucher_discount>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A.Ay,{item:!0,xs:6,children:(0,n.jsxs)(s.A,{variant:"body2",sx:{fontSize:{xs:"0.75rem",sm:"0.875rem"}},children:["Giảm gi\xe1 KM",(null==(eo=tn.applied_vouchers)?void 0:eo.length)?" (".concat(tn.applied_vouchers.map(e=>e.code||e.voucher_code).join(", "),")"):"",":"]})}),(0,n.jsx)(A.Ay,{item:!0,xs:6,children:(0,n.jsx)(s.A,{variant:"body2",sx:{fontSize:{xs:"0.75rem",sm:"0.875rem"},color:"error.main"},children:(0,n.jsxs)("strong",{children:["-",e7(tn.pricing.voucher_discount)]})})}),(0,n.jsx)(A.Ay,{item:!0,xs:12,children:(0,n.jsx)(p.A,{})})]}),(0,n.jsx)(A.Ay,{item:!0,xs:6,children:(0,n.jsx)(s.A,{variant:"body2",sx:{fontSize:{xs:"0.75rem",sm:"0.875rem"}},children:"Tổng chiết khấu:"})}),(0,n.jsx)(A.Ay,{item:!0,xs:6,children:(0,n.jsx)(s.A,{variant:"body2",sx:{fontSize:{xs:"0.75rem",sm:"0.875rem"},color:"error.main"},children:(0,n.jsxs)("strong",{children:["-",e7(null!=(eh=null==tn?void 0:tn.pricing.total_discount)?eh:rp)]})})}),(0,n.jsx)(A.Ay,{item:!0,xs:12,children:(0,n.jsx)(p.A,{})}),(0,n.jsx)(A.Ay,{item:!0,xs:6,children:(0,n.jsx)(s.A,{variant:"body2",sx:{fontSize:{xs:"0.75rem",sm:"0.875rem"}},children:"Tổng tiền thanh to\xe1n:"})}),(0,n.jsx)(A.Ay,{item:!0,xs:6,children:(0,n.jsxs)(s.A,{variant:"body2",sx:{fontSize:{xs:"0.75rem",sm:"0.875rem"},display:"flex",alignItems:"center",gap:.5},children:[(0,n.jsx)("strong",{children:e7(null!=(ep=null==tn?void 0:tn.pricing.total)?ep:rx)}),ta&&(0,n.jsx)(S.A,{size:12})]})}),tc&&(0,n.jsx)(A.Ay,{item:!0,xs:12,children:(0,n.jsxs)(s.A,{variant:"caption",sx:{color:"error.main"},children:["⚠ ",tc]})})]})})]})]}),(0,n.jsx)(a.A,{sx:{width:"100%",position:{xs:"fixed",md:"static"},bottom:{xs:0,md:"auto"},left:{xs:0,md:"auto"},right:{xs:0,md:"auto"},backgroundColor:{xs:"white",md:"transparent"},p:{xs:2,md:0},mt:{xs:0,md:2},boxShadow:{xs:"0 -2px 10px rgba(0,0,0,0.1)",md:"none"},zIndex:{xs:1100,md:"auto"},paddingBottom:{xs:"calc(16px + env(safe-area-inset-bottom))",md:0}},children:(0,n.jsx)(m.A,{direction:"row",justifyContent:"flex-end",alignItems:"center",children:(0,n.jsx)(c.A,{sx:{width:{xs:"100%",sm:"300px"},fontSize:{xs:"0.875rem",sm:"1rem"},height:{xs:"48px",sm:"42px"}},variant:"contained",color:"success",size:"large",onClick:t0(rA),disabled:ek||0===ex.length||ta||!!tc,children:"Ghi ho\xe1 đơn v\xe0 thanh to\xe1n"})})})]})})]})}),(0,n.jsxs)(C.A,{open:tz.open,onClose:()=>tM({open:!1,errors:[]}),maxWidth:"sm",fullWidth:!0,children:[(0,n.jsx)(w.A,{children:(0,n.jsx)(s.A,{variant:"h6",color:"error",children:"Lỗi khi th\xeam sản phẩm"})}),(0,n.jsx)(k.A,{children:(0,n.jsx)(I.A,{children:tz.errors.map((e,t)=>(0,n.jsx)(z.Ay,{sx:{px:0},children:(0,n.jsx)(M.A,{primary:(0,n.jsx)(s.A,{variant:"body2",color:"error",children:e.qr_code}),secondary:(0,n.jsx)(s.A,{variant:"body2",color:"text.secondary",children:e.error})})},t))})}),(0,n.jsx)(T.A,{children:(0,n.jsx)(c.A,{onClick:()=>tM({open:!1,errors:[]}),children:"Đ\xf3ng"})})]}),(0,n.jsxs)(C.A,{open:tO.open,onClose:rd,maxWidth:"sm",fullWidth:!0,children:[(0,n.jsx)(w.A,{children:(0,n.jsx)(s.A,{variant:"h6",color:"warning.main",children:"X\xe1c nhận chuyển chế độ"})}),(0,n.jsxs)(k.A,{children:[(0,n.jsxs)(s.A,{variant:"body1",sx:{mb:2},children:["Bạn c\xf3 muốn chuyển sang đơn h\xe0ng"," ",(0,n.jsx)("strong",{children:tO.newMode===F.er.INSTANT?"Giao Ngay":"Đặt Trước"})," ","kh\xf4ng?"]}),(0,n.jsx)(s.A,{variant:"body2",color:"error",children:"C\xe1c sản phẩm trong đơn h\xe0ng hiện tại sẽ bị loại bỏ."})]}),(0,n.jsxs)(T.A,{children:[(0,n.jsx)(c.A,{onClick:rd,color:"inherit",children:"Hủy"}),(0,n.jsx)(c.A,{onClick:()=>
1{if(null!==tO.newMode){let e=tO.newMode;eQ(e),t4("fulfillment_type",e,{shouldValidate:!0}),ey([]),t4("items",[],{shouldValidate:!0}),tV({open:!1,newMode:null})}},color:"warning",variant:"contained",children:"Đồng \xfd"})]})]}),(0,n.jsx)(ev.default,{open:tT.open,onClose:rl,qrCodes:tT.qrCodes,onQrCodesChange:e=>tE({...tT,qrCodes:e}),onConfirm:rc,isProcessing:tR}),(0,n.jsx)(e2,{hasActiveShift:tH&&!!tq,remainingMinutes:tX,onOpenClose:()=>tD.push("/pos/ket-ca")}),(0,n.jsx)(e6.default,{open:"entering"===t$.stage,onClose:t$.close,onVerified:t$.onVerified})]})},ti=()=>(0,n.jsx)(eo,{children:(0,n.jsx)(ex,{children:(0,n.jsx)(tn,{})})})},6003:(e,t,r)=>{"use strict";r.d(t,{A:()=>k});var n=r(40670),i=r(44501),a=r(14232),s=r(69241),o=r(4697),l=r(97613),c=r(54773),d=r(68275),u=r(52196),h=r(99003),p=r(72497),x=r(91411),m=r(66313),g=r(78630),f=r(23368),v=r(632),y=r(47951),A=r(45879);function j(e){return(0,A.Ay)("MuiMenuItem",e)}let b=(0,y.A)("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]);var _=r(37876);let S=["autoFocus","component","dense","divider","disableGutters","focusVisibleClassName","role","tabIndex","className"],C=e=>{let{disabled:t,dense:r,divider:n,disableGutters:a,selected:s,classes:l}=e,c=(0,o.A)({root:["root",r&&"dense",t&&"disabled",!a&&"gutters",n&&"divider",s&&"selected"]},j,l);return(0,i.A)({},l,c)},w=(0,c.Ay)(p.A,{shouldForwardProp:e=>(0,d.A)(e)||"classes"===e,name:"MuiMenuItem",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,r.dense&&t.dense,r.divider&&t.divider,!r.disableGutters&&t.gutters]}})(e=>{let{theme:t,ownerState:r}=e;return(0,i.A)({},t.typography.body1,{display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:"border-box",whiteSpace:"nowrap"},!r.disableGutters&&{paddingLeft:16,paddingRight:16},r.divider&&{borderBottom:"1px solid ".concat((t.vars||t).palette.divider),backgroundClip:"padding-box"},{"&:hover":{textDecoration:"none",backgroundColor:(t.vars||t).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},["&.".concat(b.selected)]:{backgroundColor:t.vars?"rgba(".concat(t.vars.palette.primary.mainChannel," / ").concat(t.vars.palette.action.selectedOpacity,")"):(0,l.X4)(t.palette.primary.main,t.palette.action.selectedOpacity),["&.".concat(b.focusVisible)]:{backgroundColor:t.vars?"rgba(".concat(t.vars.palette.primary.mainChannel," / calc(").concat(t.vars.palette.action.selectedOpacity," + ").concat(t.vars.palette.action.focusOpacity,"))"):(0,l.X4)(t.palette.primary.main,t.palette.action.selectedOpacity+t.palette.action.focusOpacity)}},["&.".concat(b.selected,":hover")]:{backgroundColor:t.vars?"rgba(".concat(t.vars.palette.primary.mainChannel," / calc(").concat(t.vars.palette.action.selectedOpacity," + ").concat(t.vars.palette.action.hoverOpacity,"))"):(0,l.X4)(t.palette.primary.main,t.palette.action.selectedOpacity+t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:t.vars?"rgba(".concat(t.vars.palette.primary.mainChannel," / ").concat(t.vars.palette.action.selectedOpacity,")"):(0,l.X4)(t.palette.primary.main,t.palette.action.selectedOpacity)}},["&.".concat(b.focusVisible)]:{backgroundColor:(t.vars||t).palette.action.focus},["&.".concat(b.disabled)]:{opacity:(t.vars||t).palette.action.disabledOpacity},["& + .".concat(g.A.root)]:{marginTop:t.spacing(1),marginBottom:t.spacing(1)},["& + .".concat(g.A.inset)]:{marginLeft:52},["& .".concat(v.A.root)]:{marginTop:0,marginBottom:0},["& .".concat(v.A.inset)]:{paddingLeft:36},["& .".concat(f.A.root)]:{minWidth:36}},!r.dense&&{[t.breakpoints.up("sm")]:{minHeight:"auto"}},r.dense&&(0,i.A)({minHeight:32,paddingTop:4,paddingBottom:4},t.typography.body2,{["& .".concat(f.A.root," svg")]:{fontSize:"1.25rem"}}))}),k=a.forwardRef(function(e,t){let r,o=(0,u.b)({props:e,name:"MuiMenuItem"}),{autoFocus:l=!1,component:c="li",dense:d=!1,divider:p=!1,disableGutters:g=!1,focusVisibleClassName:f,role:v="menuitem",tabIndex:y,className:A}=o,j=(0,n.A)(o,S),b=a.useContext(h.A),k=a.useMemo(()=>({dense:d||b.dense||!1,disableGutters:g}),[b.dense,d,g]),I=a.useRef(null);(0,x.A)(()=>{l&&I.current&&I.current.focus()},[l]);let z=(0,i.A)({},o,{dense:k.dense,divider:p,disableGutters:g}),M=C(o),T=(0,m.A)(I,t);return o.disabled||(r=void 0!==y?y:-1),(0,_.jsx)(h.A.Provider,{value:k,children:(0,_.jsx)(w,(0,i.A)({ref:T,role:v,tabIndex:r,component:c,focusVisibleClassName:(0,s.A)(M.focusVisible,f),className:(0,s.A)(M.root,A)},j,{ownerState:z,classes:M}))})})},7069:(e,t,r)=>{"use strict";r.d(t,{A:()=>h});var n=r(37876);r(14232);var i=r(5596),a=r(47866),s=r(49794),o=r(63009),l=r(12398),c=r(93256),d=r(98246),u=r(41982);let h=e=>{let{open:t,stores:r,onSelect:h}=e;return(0,n.jsxs)(i.A,{open:t,disableEscapeKeyDown:!0,onClose:()=>{},maxWidth:"xs",fullWidth:!0,children:[(0,n.jsx)(a.A,{sx:{fontWeight:800,textAlign:"center",pb:.5},children:"Chọn cửa h\xe0ng để bắt đầu"}),(0,n.jsx)(s.A,{sx:{textAlign:"center",fontSize:14,color:"#6b7280",mb:1},children:"Bạn thuộc nhiều cửa h\xe0ng, h\xe3y chọn 1 chi nh\xe1nh để tiếp tục"}),(0,n.jsx)(o.A,{sx:{pt:0},children:r.map(e=>(0,n.jsxs)(l.A,{onClick:()=>h(e.store_id),sx:{py:1.5},children:[(0,n.jsx)(d.A,{sx:{mr:1.5,color:"#7a1f2b"}}),(0,n.jsx)(c.A,{primary:(0,u.H)(e),primaryTypographyProps:{fontWeight:600}})]},e.store_id))})]})}},10884:(e,t,r)=>{"use strict";r.d(t,{U:()=>n,Y:()=>i});let n=e=>{if(!e)return!1;let t=new Date(e);return!Number.isNaN(t.getTime())&&t.toDateString()!==new Date().toDateString()},i=e=>{if(!e)return"";let t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString("vi-VN",{day:"2-digit",month:"2-digit",year:"numeric"})}},13152:(e,t,r)=>{"use strict";var n=r(29563);t.A=void 0;var i=n(r(31405)),a=r(37876);t.A=(0,i.default)((0,a.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"Search")},14628:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(31057),i=r(37876);let a=(0,n.A)((0,i.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"}),"CheckCircle")},16652:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(31057),i=r(37876);let a=(0,n.A)((0,i.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"Search")},21436:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(14232);
1let i=function(e,t){let[r,i]=(0,n.useState)(e);return(0,n.useEffect)(()=>{let r=setTimeout(()=>{i(e)},t);return()=>{clearTimeout(r)}},[e,t]),r}},23368:(e,t,r)=>{"use strict";r.d(t,{A:()=>s,f:()=>a});var n=r(47951),i=r(45879);function a(e){return(0,i.Ay)("MuiListItemIcon",e)}let s=(0,n.A)("MuiListItemIcon",["root","alignItemsFlexStart"])},26972:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>m});var n=r(37876),i=r(14232),a=r(5596),s=r(47866),o=r(3034),l=r(49794),c=r(68284),d=r(67578),u=r(78523),h=r(2487),p=r(7957),x=r(36604);let m=e=>{let{open:t,onClose:r,onVerified:m}=e,[g,f]=(0,i.useState)(""),[v,y]=(0,i.useState)(!1),[A,j]=(0,i.useState)(null),[b,_]=(0,i.useState)([]),[S,C]=(0,i.useState)("");(0,i.useEffect)(()=>{t&&(f(""),j(null),x.y.listManagers().then(e=>{_(e),C(e.length>0?e[0].staff_id:"")}).catch(()=>{_([]),C("")}))},[t]);let w=async e=>{if(6===e.length){y(!0),j(null);try{let t=await x.y.verifyOtp(e);m(t)}catch(n){var t,r;let e=null==n||null==(t=n.response)?void 0:t.data;j((null==e||null==(r=e.error)?void 0:r.message)||"M\xe3 kh\xf4ng hợp lệ — vui l\xf2ng thử lại"),f("")}finally{y(!1)}}};return(0,n.jsxs)(a.A,{open:t,onClose:r,fullWidth:!0,maxWidth:"xs",children:[(0,n.jsx)(s.A,{children:"Nhập m\xe3 mở kho\xe1"}),(0,n.jsxs)(o.A,{children:[(0,n.jsx)(l.A,{variant:"caption",sx:{display:"block",mb:1.5,color:"text.secondary"},children:"Nhập m\xe3 6 số do quản l\xfd cung cấp."}),(0,n.jsx)(c.A,{autoFocus:!0,fullWidth:!0,placeholder:"• • • • • •",inputProps:{maxLength:6,inputMode:"numeric",style:{textAlign:"center",fontFamily:"monospace",fontSize:24,letterSpacing:"0.4em"}},value:g,onChange:e=>{let t=e.target.value.replace(/\D/g,"").slice(0,6);f(t),6===t.length&&w(t)},disabled:v}),A&&(0,n.jsx)(d.A,{sx:{mt:1.5,color:"error.main",fontSize:"0.8rem"},children:A})]}),(0,n.jsxs)(u.A,{children:[(0,n.jsx)(h.A,{onClick:r,disabled:v,children:"Đ\xf3ng"}),(0,n.jsx)(h.A,{onClick:()=>w(g),variant:"contained",disabled:v||6!==g.length,children:v?(0,n.jsx)(p.A,{size:18}):"Mở kh\xf3a"})]})]})}},36604:(e,t,r)=>{"use strict";r.d(t,{y:()=>i});var n=r(10929);let i={getCapabilities:async()=>{let e=await (0,n.UF)({url:"/pos/me/capabilities",method:"GET"});if(!e.data)throw Error("No capabilities returned");return e.data},listManagers:async()=>{var e,t;return null!=(t=null==(e=(await (0,n.UF)({url:"/pos/otp/managers",method:"GET"})).data)?void 0:e.managers)?t:[]},requestOtp:async e=>{let t=await (0,n.UF)({url:"/pos/otp/request",method:"POST",options:{body:{manager_staff_id:e}}});if(!t.data)throw Error("No OTP response");return t.data},verifyOtp:async e=>{let t=await (0,n.UF)({url:"/pos/otp/verify",method:"POST",options:{body:{code:e}}});if(!t.data)throw Error("No verify response");return t.data},cancelOtp:async e=>{await (0,n.UF)({url:"/pos/otp/cancel",method:"POST",options:{body:{otp_id:e}}})}}},41982:(e,t,r)=>{"use strict";function n(e,t){let r=null!=e?e:[];return t&&r.some(e=>e.store_id===t)?{action:"ready"}:0===r.length?{action:"none"}:1===r.length?{action:"auto",storeId:r[0].store_id}:{action:"prompt"}}function i(e){return(null==e?void 0:e.store_name)||(null==e?void 0:e.name)||"Cửa h\xe0ng"}r.d(t,{H:()=>i,v:()=>n})},43053:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>s});var n=r(37876);r(14232);var i=r(22474),a=r(69);let s=e=>(0,n.jsx)(i.A,{direction:"column",gap:1,children:(0,n.jsx)(a.default,{...e})})},43073:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>s});var n=r(37876);r(14232);var i=r(22474),a=r(69);let s=e=>(0,n.jsx)(i.A,{direction:"column",gap:1,children:(0,n.jsx)(a.default,{...e})})},45274:(e,t,r)=>{"use strict";r.d(t,{t:()=>n});let n=e=>e.isIntersecting&&e.hasMore&&"pending"!==e.loading&&"loadingMore"!==e.loading},47863:()=>{},50141:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(31057),i=r(37876);let a=(0,n.A)((0,i.jsx)("path",{d:"M20 4H4v2h16zm1 10v-2l-1-5H4l-1 5v2h1v6h10v-6h4v6h2v-6zm-9 4H6v-4h6z"}),"Store")},58299:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(31057),i=r(37876);let a=(0,n.A)((0,i.jsx)("path",{d:"M11.8 10.9c-2.27-.59-3-1.2-3-2.15 0-1.09 1.01-1.85 2.7-1.85 1.78 0 2.44.85 2.5 2.1h2.21c-.07-1.72-1.12-3.3-3.21-3.81V3h-3v2.16c-1.94.42-3.5 1.68-3.5 3.61 0 2.31 1.91 3.46 4.7 4.13 2.5.6 3 1.48 3 2.41 0 .69-.49 1.79-2.7 1.79-2.06 0-2.87-.92-2.98-2.1h-2.2c.12 2.19 1.76 3.42 3.68 3.83V21h3v-2.15c1.95-.37 3.5-1.5 3.5-3.55 0-2.84-2.43-3.81-4.7-4.4"}),"AttachMoney")},59945:(e,t,r)=>{"use strict";r.d(t,{G:()=>i});let n=e=>{try{let t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(t).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(r)}catch(e){return console.error("Invalid token:",e),null}},i=e=>{if(!e)return!1;try{let t=n(e);if(!t||!t.exp)return!1;let r=Date.now()/1e3;return t.exp>r}catch(e){return!1}}},61478:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>d});var n=r(37876),i=r(14232),a=r(67578),s=r(49794),o=r(2487),l=r(87241),c=r(93
1607);let d=e=>{let{locked:t,managerName:r,expiresAtIso:d,onRequestOtp:u}=e,[,h]=(0,i.useState)(0);return((0,i.useEffect)(()=>{if(!d||t)return;let e=window.setInterval(()=>h(e=>e+1),1e3);return()=>window.clearInterval(e)},[d,t]),t)?(0,n.jsxs)(a.A,{sx:{display:"flex",alignItems:"center",gap:1.5,bgcolor:"#fef3c7",border:"1px solid #fcd34d",borderRadius:1.5,px:1.5,py:1,mb:1,color:"#92400e"},children:[(0,n.jsx)(l.A,{fontSize:"small"}),(0,n.jsx)(s.A,{variant:"body2",sx:{flex:1,fontSize:"0.85rem"},children:"Gi\xe1 / chiết khấu đang kh\xf3a với vai tr\xf2 Thu Ng\xe2n"}),(0,n.jsx)(o.A,{size:"small",variant:"contained",sx:{bgcolor:"#f59e0b","&:hover":{bgcolor:"#d97706"}},onClick:u,children:"Nhập m\xe3 mở kho\xe1"})]}):(0,n.jsxs)(a.A,{sx:{display:"flex",alignItems:"center",gap:1.5,bgcolor:"#d1fae5",border:"1px solid #6ee7b7",borderRadius:1.5,px:1.5,py:1,mb:1,color:"#065f46"},children:[(0,n.jsx)(c.A,{fontSize:"small"}),(0,n.jsxs)(s.A,{variant:"body2",sx:{flex:1,fontSize:"0.85rem"},children:["Đ\xe3 mở kh\xf3a bởi ",(0,n.jsx)("strong",{children:r}),d?" \xb7 c\xf2n ".concat(function(e){let t=new Date(e).getTime()-Date.now();if(t<=0)return"00:00";let r=Math.floor(t/6e4),n=Math.floor(t%6e4/1e3);return"".concat(String(r).padStart(2,"0"),":").concat(String(n).padStart(2,"0"))}(d)):""]})]})}},69390:(e,t,r)=>{"use strict";r.d(t,{A:()=>f});var n=r(40670),i=r(44501),a=r(14232),s=r(69241),o=r(4697),l=r(52196),c=r(54773),d=r
1(47951),u=r(45879);function h(e){return(0,u.Ay)("MuiToolbar",e)}(0,d.A)("MuiToolbar",["root","gutters","regular","dense"]);var p=r(37876);let x=["className","component","disableGutters","variant"],m=e=>{let{classes:t,disableGutters:r,variant:n}=e;return(0,o.A)({root:["root",!r&&"gutters",n]},h,t)},g=(0,c.Ay)("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,!r.disableGutters&&t.gutters,t[r.variant]]}})(e=>{let{theme:t,ownerState:r}=e;return(0,i.A)({position:"relative",display:"flex",alignItems:"center"},!r.disableGutters&&{paddingLeft:t.spacing(2),paddingRight:t.spacing(2),[t.breakpoints.up("sm")]:{paddingLeft:t.spacing(3),paddingRight:t.spacing(3)}},"dense"===r.variant&&{minHeight:48})},e=>{let{theme:t,ownerState:r}=e;return"regular"===r.variant&&t.mixins.toolbar}),f=a.forwardRef(function(e,t){let r=(0,l.b)({props:e,name:"MuiToolbar"}),{className:a,component:o="div",disableGutters:c=!1,variant:d="regular"}=r,u=(0,n.A)(r,x),h=(0,i.A)({},r,{component:o,disableGutters:c,variant:d}),f=m(h);return(0,p.jsx)(g,(0,i.A)({as:o,className:(0,s.A)(f.root,a),ref:t,ownerState:h},u))})},74817:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/pos/ban-hang",function(){return r(1381)}])},75500:(e,t,r)=>{"use strict";r.d(t,{A:()=>A});var n=r(40670),i=r(44501),a=r(14232),s=r(69241),o=r(4697),l=r(54773),c=r(52196),d=r(80027),u=r(2799),h=r(47951),p=r(45879);function x(e){return(0,p.Ay)("MuiAppBar",e)}(0,h.A)("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);var m=r(37876);let g=["className","color","enableColorOnDark","position"],f=e=>{let{color:t,position:r,classes:n}=e,i={root:["root","color".concat((0,d.A)(t)),"position".concat((0,d.A)(r))]};return(0,o.A)(i,x,n)},v=(e,t)=>e?"".concat(null==e?void 0:e.replace(")",""),", ").concat(t,")"):t,y=(0,l.Ay)(u.A,{name:"MuiAppBar",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,t["position".concat((0,d.A)(r.position))],t["color".concat((0,d.A)(r.color))]]}})(e=>{let{theme:t,ownerState:r}=e,n="light"===t.palette.mode?t.palette.grey[100]:t.palette.grey[900];return(0,i.A)({display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box",flexShrink:0},"fixed"===r.position&&{position:"fixed",zIndex:(t.vars||t).zIndex.appBar,top:0,left:"auto",right:0,"@media print":{position:"absolute"}},"absolute"===r.position&&{position:"absolute",zIndex:(t.vars||t).zIndex.appBar,top:0,left:"auto",right:0},"sticky"===r.position&&{position:"sticky",zIndex:(t.vars||t).zIndex.appBar,top:0,left:"auto",right:0},"static"===r.position&&{position:"static"},"relative"===r.position&&{position:"relative"},!t.vars&&(0,i.A)({},"default"===r.color&&{backgroundColor:n,color:t.palette.getContrastText(n)},r.color&&"default"!==r.color&&"inherit"!==r.color&&"transparent"!==r.color&&{backgroundColor:t.palette[r.color].main,color:t.palette[r.color].contrastText},"inherit"===r.color&&{color:"inherit"},"dark"===t.palette.mode&&!r.enableColorOnDark&&{backgroundColor:null,color:null},"transparent"===r.color&&(0,i.A)({backgroundColor:"transparent",color:"inherit"},"dark"===t.palette.mode&&{backgroundImage:"none"})),t.vars&&(0,i.A)({},"default"===r.color&&{"--AppBar-background":r.enableColorOnDark?t.vars.palette.AppBar.defaultBg:v(t.vars.palette.AppBar.darkBg,t.vars.palette.AppBar.defaultBg),"--AppBar-color":r.enableColorOnDark?t.vars.palette.text.primary:v(t.vars.palette.AppBar.darkColor,t.vars.palette.text.primary)},r.color&&!r.color.match(/^(default|inherit|transparent)$/)&&{"--AppBar-background":r.enableColorOnDark?t.vars.palette[r.color].main:v(t.vars.palette.AppBar.darkBg,t.vars.palette[r.color].main),"--AppBar-color":r.enableColorOnDark?t.vars.palette[r.color].contrastText:v(t.vars.palette.AppBar.darkColor,t.vars.palette[r.color].contrastText)},!["inherit","transparent"].includes(r.color)&&{backgroundColor:"var(--AppBar-background)"},{color:"inherit"===r.color?"inherit":"var(--AppBar-color)"},"transparent"===r.color&&{backgroundImage:"none",backgroundColor:"transparent",color:"inherit"}))}),A=a.forwardRef(function(e,t){let r=(0,c.b)({props:e,name:"MuiAppBar"}),{className:a,color:o="primary",enableColorOnDark:l=!1,position:d="fixed"}=r,u=(0,n.A)(r,g),h=(0,i.A)({},r,{color:o,position:d,enableColorOnDark:l}),p=f(h);return(0,m.jsx)(y,(0,i.A)({square:!0,component:"header",ownerState:h,elevation:4,className:(0,s.A)(p.root,a,"fixed"===d&&"mui-fixed"),ref:t},u))})},87241:(e,t,r)=>{"use strict";var n=r(29563);t.A=void 0;var i=n(r(31405)),a=r(37876);t.A=(0,i.default)((0,a.jsx)("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2M9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9zm9 14H6V10h12zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2"}),"LockOutlined")},87505:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(31057),i=r(37876);let a=(0,n.A)((0,i.jsx)("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore")},87905:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(31057),i=r(37876);let a=(0,n.A)((0,i.jsx)("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58
1L18 14z"}),"ExpandLess")},90229:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>D});var n=r(37876),i=r(14232),a=r(5596),s=r(47866),o=r(49794),l=r(3034),c=r(67578),d=r(78523),u=r(2487),h=r(44501),p=r(40670),x=r(4727),m=function(e,t){if("function"==typeof e)return void e(t);e.current=t},g=function(e,t){var r=i.useRef();return i.useCallback(function(n){e.current=n,r.current&&m(r.current,null),r.current=t,t&&m(t,n)},[t])},f={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},v=function(e){Object.keys(f).forEach(function(t){e.style.setProperty(t,f[t],"important")})},y=null,A=function(e,t){var r=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?r+t.borderSize:r-t.paddingSize},j=function(){},b=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],_=!!document.documentElement.currentStyle,S=function(e){var t=window.getComputedStyle(e);if(null===t)return null;var r=b.reduce(function(e,r){return e[r]=t[r],e},{}),n=r.boxSizing;if(""===n)return null;_&&"border-box"===n&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var i=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),a=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:i,borderSize:a}};function C(e,t,r){var n=(0,x.A)(r);i.useLayoutEffect(function(){var r=function(e){return n.current(e)};if(e)return e.addEventListener(t,r),function(){return e.removeEventListener(t,r)}},[])}var w=function(e,t){C(document.body,"reset",function(r){e.current.form===r.target&&t(r)})},k=function(e){C(window,"resize",e)},I=function(e){C(document.fonts,"loadingdone",e)},z=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],M=i.forwardRef(function(e,t){var r=e.cacheMeasurements,n=e.maxRows,a=e.minRows,s=e.onChange,o=void 0===s?j:s,l=e.onHeightChange,c=void 0===l?j:l,d=(0,p.A)(e,z),u=void 0!==d.value,x=i.useRef(null),m=g(x,t),f=i.useRef(0),b=i.useRef(),_=function(){var e=x.current,t=r&&b.current?b.current:S(e);if(t){b.current=t;var i,s,o,l,d,u,h,p,m,g,j,_=(i=e.value||e.placeholder||"x",void 0===(s=a)&&(s=1),void 0===(o=n)&&(o=1/0),y||((y=document.createElement("textarea")).setAttribute("tabindex","-1"),y.setAttribute("aria-hidden","true"),v(y)),null===y.parentNode&&document.body.appendChild(y),l=t.paddingSize,d=t.borderSize,h=(u=t.sizingStyle).boxSizing,Object.keys(u).forEach(function(e){y.style[e]=u[e]}),v(y),y.value=i,p=A(y,t),y.value=i,p=A(y,t),y.value="x",g=(m=y.scrollHeight-l)*s,"border-box"===h&&(g=g+l+d),p=Math.max(g,p),j=m*o,"border-box"===h&&(j=j+l+d),[p=Math.min(j,p),m]),C=_[0],w=_[1];f.current!==C&&(f.current=C,e.style.setProperty("height",C+"px","important"),c(C,{rowHeight:w}))}};return i.useLayoutEffect(_),w(x,function(){if(!u){var e=x.current.value;requestAnimationFrame(function(){var t=x.current;t&&e!==t.value&&_()})}}),k(_),I(_),i.createElement("textarea",(0,h.A)({},d,{onChange:function(e){u||_(),o(e)},ref:m}))}),T=r(24063),E=r(22112),R=r(62532),N=r(23845),O=r(73691);let V=(0,E.R)((e,t)=>{let{propsWithDefaults:r}=(0,N.l)("Textarea",e),{rows:n=3,classPrefix:a="textarea",className:s,size:o="md",autosize:l,maxRows:c,minRows:d,resize:u,style:p,...x}=r,{withPrefix:m,merge:g,cssVar:f}=(0,O.I)(a),v=g(s,m()),y=(0,R.Zq)(p,f("resize",u));return i.createElement(T.A,(0,h.A)({as:l?M:"textarea",ref:t,size:o,rows:n,className:v,style:y},l?{maxRows:c,minRows:d}:{},x))});V.displayName="Textarea",r(47863);let D=e=>{let{open:t,onClose:r,qrCodes:i,onQrCodesChange:h,onConfirm:p,isProcessing:x}=e,m=i.split("\n").map(e=>e.trim()).filter(e=>e.length>0).length;return(0,n.jsxs)(a.A,{open:t,onClose:r,maxWidth:"md",fullWidth:!0,children:[(0,n.jsx)(s.A,{children:(0,n.jsx)(o.A,{variant:"h6",children:"Nhập Danh s\xe1ch QR Code"})}),(0,n.jsx)(l.A,{children:(0,n.jsxs)(c.A,{sx:{mt:2},children:[(0,n.jsx)(o.A,{variant:"body2",color:"text.secondary",sx:{mb:1},children:"Nhập danh s\xe1ch QR code, mỗi QR code tr\xean một d\xf2ng:"}),(0,n.jsx)(c.A,{sx:{mt:1},children:(0,n.jsx)(V,{rows:10,value:i,onChange:h,placeholder:"",disabled:x,style:{width:"100%"}})}),m>0&&(0,n.jsx)(c.A,{sx:{mt:1,textAlign:"right"},children:(0,n.jsxs)(o.A,{variant:"caption",color:"text.secondary",children:["Tổng số QR code: ",m]})})]})}),(0,n.jsxs)(d.A,{children:[(0,n.jsx)(u.A,{onClick:r,disabled:x,children:"Hủy"}),(0,n.jsx)(u.A,{onClick:p,variant:"contained",color:"primary",disabled:x||!i.trim(),children:x?"Đang xử l\xfd...":"X\xe1c nhận"})]})]})}},93607:(e,t,r)=>{"use strict";var n=r(29563);t.A=void 0;var i=n(r(31405)),a=r(37876);t.A=(0,i.default)((0,a.jsx)("path",{d:"M12 17c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m6-9h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6h1.9c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m0 12H6V10h12z"}),"LockOpen")},98246:(e,t,r)=>{"use strict";var n=r(29563);t.A=void 0;var i=n(r(31405)),a=r(37876);t.A=(0,i.default)((0,a.jsx)("path",{d:"m21.9 8.89-1.05-4.37c-.22-.9-1-1.52-1.91-1.52H5.05c-.9 0-1.69.63-1.9 1.52L2.1 8.89c-.24 1.02-.02 2.06.62 2.88.08.11.19.19.28.29V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-6.94c.09-.09.2-.18.28-.28.64-.82.87-1.87.62-2.89m-2.99-3.9 1.05 4.37c.1.42.01.84-.25 1.17-.14.18-.44.47-.94.47-.61 0-1.14-.49-1.21-1.14L16.98 5zM13 5h1.96l.54 4.52c.05.39-.07.78-.33 1.07-.22.26-.54.41-.95.41-.67 0-1.22-.59-1.22-1.31zM8.49 9.52 9.04 5H11v4.69c0 .72-.55 1.31-1.29 1.31-.34 0-.65-.15-.89-.41-.25-.29-.37-.68-.33-1.07m-4.45-.16L5.05 5h1.97l-.58 4.86c-.08.65-.6 1.14-1.21 1.14-.49 0-.8-.29-.93-.47-.27-.32-.36-.75-.26-1.17M5 19v-6.03c.08.01.15.03.23.03.87 0 1.66-.36 2.24-.95.6.6 1.4.95 2.31.95.87 0 1.65-.36 2.23-.93.59.57 1.39.93 2.29.93.84 0 1.64-.35 2.24-.95.58.59 1.37.95 2.24.95.08 0 .15-.02.23-.03V19z"}),"StorefrontOutlined")}},e=>{var t=t=>e(e.s=t);e.O(0,[9017,2088,1814,8992,6333,1215,4063,5654,4378,69,1378,4979,6448,636,6593,8792],()=>t(74817)),_N_E=e.O()}]);

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.