????
Current Path : C:/inetpub/vhost/lantha.gdtsolutions.vn/wwwtest/wwwroot/static/js/ |
Current File : C:/inetpub/vhost/lantha.gdtsolutions.vn/wwwtest/wwwroot/static/js/971.3c3e2686.chunk.js |
"use strict";(self.webpackChunkgdt=self.webpackChunkgdt||[]).push([[971],{3908:(n,e,s)=>{s.d(e,{m:()=>i.A});s(48274);var i=s(46499)},21812:(n,e,s)=>{s.d(e,{A:()=>L});var i=s(9950),a=s(45418),t=s.n(a),l=s(50651),h=s(76991),d=s(70349),o=s(23931),r=s(19247),c=s(76152),g=s(55627),x=s(85077),j=s(18849),m=s(36841),T=s(67116),u=s(29933),p=s(73613),A=s(10077),D=s(4370),y=s(21205),v=s(53744),f=s(51963),H=s(44414);class S extends i.Component{constructor(n){super(n),this.state={data:[],TenDiemKinhDoanh:null}}componentDidMount(){const{dataInPhieu:n}=this.props,e=n.DiemKinhDoanhId||n.DiemKinhDoanh_Id;(0,D.Pq)(`DiemKinhDoanhs(${e})`,"GET",null).then((n=>this.setState({TenDiemKinhDoanh:n.Ten}))).catch((n=>(0,T.a3)(n)))}render(){const{dataInPhieu:n}=this.props,{TenDiemKinhDoanh:e}=this.state,s=n.chiTiet||n.Sale_ChiTietDonTraHang;let i=0;return s.forEach((n=>(i+=+n.SoLuong,i))),(0,H.jsxs)("div",{children:[(0,H.jsx)(d.A,{className:"profile-don-vi",children:(0,H.jsxs)(o.A,{style:{textAlign:"center"},children:[(0,H.jsx)("img",{src:"/assets/Logo/logoQLBH.png",alt:""}),(0,H.jsx)("h5",{style:{marginBottom:5},children:v.lg.TenDonVi}),(0,H.jsxs)("p",{style:{marginBottom:5,fontWeight:600},children:["S\u0110T: ",v.lg.DienThoai]}),(0,H.jsxs)("p",{style:{marginBottom:0,fontWeight:600},children:["\u0110\u1ecba ch\u1ec9: ",v.lg.DiaChi]})]})}),(0,H.jsx)(d.A,{style:{marginBottom:10},children:(0,H.jsxs)(o.A,{xs:"12",md:"12",children:[(0,H.jsx)("h3",{style:{textAlign:"center"},children:"H\xd3A \u0110\u01a0N TR\u1ea2 H\xc0NG"}),(0,H.jsxs)("h6",{style:{textAlign:"center"},children:["S\u1ed1 H\u0110: ",n.MaTraHang]}),(0,H.jsxs)("h6",{style:{textAlign:"center"},children:["Th\u1eddi gian: ",(0,m.Rt)(n.NgayTao)]})]})}),(0,H.jsx)(d.A,{style:{marginBottom:5},children:(0,H.jsxs)(o.A,{xs:"12",md:"12",children:[(0,H.jsxs)(d.A,{style:{marginBottom:5},children:[(0,H.jsx)(o.A,{xs:"6",md:"5",children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"\u0110i\u1ec3m kinh doanh:"})}),(0,H.jsx)(o.A,{xs:"6",md:"7",children:e})]}),(0,H.jsxs)(d.A,{style:{marginBottom:5},children:[(0,H.jsx)(o.A,{xs:"6",md:"5",children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"Thu ng\xe2n:"})}),(0,H.jsx)(o.A,{xs:"6",md:"7",children:n.NguoiTao})]})]})}),(0,H.jsxs)(y.A,{responsive:!0,size:"sm",className:"table-hoa-don",children:[(0,H.jsx)("thead",{children:(0,H.jsxs)("tr",{children:[(0,H.jsx)("th",{style:{textAlign:"left"},children:"T\xean s\u1ea3n ph\u1ea9m"}),(0,H.jsx)("th",{style:{textAlign:"left"},children:"\u0110\u01a1n gi\xe1"}),(0,H.jsx)("th",{style:{textAlign:"right"},children:"SL"}),(0,H.jsx)("th",{style:{textAlign:"right"},children:"Th\xe0nh ti\u1ec1n"})]})}),(0,H.jsx)("tbody",{children:0!==s.length&&s.map(((n,e)=>(0,H.jsxs)("tr",{children:[(0,H.jsx)("td",{style:{textAlign:"left"},children:(0,H.jsx)("span",{children:n.Ten||n.DM_SanPhamDichVu.TenSanPham})}),(0,H.jsx)("td",{style:{textAlign:"left"},children:(0,H.jsx)("span",{style:{display:"block"},children:(0,m.vv)(n.DonGia)})}),(0,H.jsx)("td",{style:{textAlign:"right",verticalAlign:"bottom",paddingBottom:5},children:(0,m.vv)(n.SoLuong)}),(0,H.jsx)("td",{style:{textAlign:"right",verticalAlign:"bottom",paddingBottom:5},children:(0,m.vv)(n.ThanhTien)})]},e)))})]}),n&&0!==s.length&&(0,H.jsxs)(d.A,{style:{marginTop:15,marginBottom:5},children:[(0,H.jsx)(o.A,{xs:"4",md:"4"}),(0,H.jsx)(o.A,{xs:"8",md:"8",children:(0,H.jsxs)(r.A,{children:[(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{xs:"8",md:"8",children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"T\u1ed5ng s\u1ed1 l\u01b0\u1ee3ng:"})}),(0,H.jsx)(o.A,{xs:"4",md:"4",style:{textAlign:"right"},children:(0,m.vv)(i)})]}),(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{xs:"8",md:"8",children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"T\u1ed5ng ti\u1ec1n tr\u1ea3:"})}),(0,H.jsx)(o.A,{xs:"4",md:"4",style:{textAlign:"right"},children:(0,m.vv)(n.TongTienTra||n.TienHangTra)})]}),(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{xs:"8",md:"8",children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"Ph\xed tr\u1ea3 h\xe0ng (VN\u0110):"})}),(0,H.jsxs)(o.A,{xs:"4",md:"4",style:{textAlign:"right"},children:[(0,m.vv)(n.PhiTraHang||n.PhiTra)," "]})]}),(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{xs:"8",md:"8",children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"Ti\u1ec1n tr\u1ea3 kh\xe1ch:"})}),(0,H.jsx)(o.A,{xs:"4",md:"4",style:{textAlign:"right"},children:(0,m.vv)(n.ThanhTien)})]})]})})]}),(0,H.jsx)(d.A,{style:{marginBottom:5},children:(0,H.jsx)(o.A,{children:(0,H.jsx)(c.A,{row:!0,children:(0,H.jsx)(o.A,{xs:"12",md:"12",style:{textAlign:"center"},children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:(0,H.jsxs)("i",{children:["(",(0,H.jsxs)("span",{className:"bang-chu",children:[(0,f.q)(+n.ThanhTien).split(" ")[0]," "]}),(0,f.q)(+n.ThanhTien).split(" ").splice(1,(0,f.q)(+n.ThanhTien).split(" ").length).join(" ")," \u0111\u1ed3ng)"]})})})})})}),(0,H.jsx)(d.A,{children:(0,H.jsx)(o.A,{children:(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{xs:"6",md:"6",children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"H\xecnh th\u1ee9c thanh to\xe1n:"})}),(0,H.jsx)(o.A,{xs:"6",md:"6",style:{textAlign:"right"},children:"Ti\u1ec1n m\u1eb7t(VN\u0110)"})]})})}),(0,H.jsx)(d.A,{style:{marginBottom:5},children:(0,H.jsx)(o.A,{children:(0,H.jsx)("h5",{style:{textAlign:"center"},children:(0,H.jsx)("i",{children:"C\u1ea3m \u01a1n v\xe0 h\u1eb9n g\u1eb7p l\u1ea1i!"})})})})]})}}const b=[{title:"Id",field:"Id",type:"numeric",hidden:!0,editable:"never"},{title:"S\u1ea3n ph\u1ea9m, d\u1ecbch v\u1ee5",field:"DM_SanPhamDichVu.TenSanPham",type:"string",hidden:!1,editable:"never",searchable:!0},{field:"SanPhamDichVu_Id",hidden:!0,editable:"never"},{title:"S\u1ed1 l\u01b0\u1ee3ng",field:"SoLuong",type:"numeric",hidden:!1,editable:"never",render:n=>(0,m.vv)(n.SoLuong)},{title:"\u0110VT",field:"DM_DonViTinh.Ten",type:"string",hidden:!1,editable:"never"},{title:"\u0110\u01a1n gi\xe1",field:"DonGia",type:"numeric",hidden:!1,editable:"never",render:n=>(0,m.vv)(n.DonGia)},{title:"Th\xe0nh ti\u1ec1n",field:"ThanhTien",type:"numeric",hidden:!1,editable:"never",render:n=>(0,m.vv)(n.ThanhTien)}];var N=s(65597),w=s(3908),C=s(13650),I=s(38512);const M=i.createRef();class L extends i.Component{constructor(n){super(n),this.inPhieuTraHang=()=>{this.setState({openInPhieuTraHang:!0})},this.openHuyTraHang=()=>{this.setState({openLyDoHuyDonTraHang:!0})},this.onChangeLyDo=n=>{this.setState({textLyDo:n})},this.renderButton=n=>(0,H.jsxs)("div",{style:{float:"right"},children:[(0,H.jsx)(C.f8,{onClick:()=>this.setState({openLyDoHuyDonTraHang:!1}),children:"H\u1ee7y"}),(0,H.jsx)(C.QB,{onClick:()=>this.saveHuyDonTraHang(n),children:"Ch\u1ea5p nh\u1eadn"})]}),this.saveHuyDonTraHang=n=>{n?(0,D.Pq)(`DonHang/HuyDonTraHang?donTraHangId=${this.props.IdDonTraHang}&lyDo=${n}`,"POST",null,!1).then((n=>{(0,T.nw)(n).then((()=>{this.props.statusTraHang?(this.props.closeDetailTraHang(),this.props.getDataDonHang(),this.props.reloadTableIndexDonHang()):(this.props.closeDetailTraHang(),this.props.reloadTableIndex())}))})).catch((n=>(0,T.AB)(n.Message))):(0,T.AB)("Vui l\xf2ng nh\u1eadp l\xfd do h\u1ee7y \u0111\u01a1n h\xe0ng","TH\xd4NG B\xc1O")},this.state={data:[],openInPhieuTraHang:!1,openLyDoHuyDonTraHang:!1,textLyDo:""}}componentDidMount(){const{IdDonTraHang:n}=this.props;(0,D.Pq)(`DonTraHangs(${n})?$expand=Sale_ChiTietDonTraHang/DM_SanPhamDichVu,DM_DiemKinhDoanh,DM_LienHe`,"GET",null).then((n=>this.setState({data:n}))).catch((n=>(0,T.a3)(n.Message)))}render(){var n,e;const{openDetailTraHang:s,closeDetailTraHang:i,IdDonTraHang:a,MaTraHang:T,isDetailTheKho:D,className:y}=this.props,{data:v,openInPhieuTraHang:f,openLyDoHuyDonTraHang:C,textLyDo:L}=this.state;let _=0,P=0;return 0!==v.length&&v.Sale_ChiTietDonTraHang.forEach((n=>(_+=+n.SoLuong,P+=+n.ThanhTien,P))),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u.A,{className:y,open:s,title:`CHI TI\u1ebeT \u0110\u01a0N TR\u1ea2 H\xc0NG ${T}`,onClose:i,children:(0,H.jsx)(l.A,{children:(0,H.jsxs)(h.A,{children:[(0,H.jsxs)(d.A,{children:[(0,H.jsx)(o.A,{md:"4",children:(0,H.jsxs)(r.A,{children:[(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{md:"5",children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"M\xe3 tr\u1ea3 h\xe0ng:"})}),(0,H.jsx)(o.A,{md:"7",children:null===v||void 0===v?void 0:v.MaTraHang})]}),(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{md:"5",children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"Th\u1eddi gian:"})}),(0,H.jsx)(o.A,{md:"7",children:(0,m.Rt)(null===v||void 0===v?void 0:v.NgayTao)})]}),(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{md:"5",children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"\u0110i\u1ec3m kinh doanh:"})}),(0,H.jsx)(o.A,{md:"7",children:null===v||void 0===v||null===(n=v.DM_DiemKinhDoanh)||void 0===n?void 0:n.Ten})]}),(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{md:"5",children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"Thu ng\xe2n:"})}),(0,H.jsx)(o.A,{md:"7",children:null===v||void 0===v?void 0:v.NguoiTao})]})]})}),(0,H.jsx)(o.A,{md:"4",children:(0,H.jsxs)(r.A,{children:[(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{md:"5",children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"Kh\xe1ch h\xe0ng:"})}),(0,H.jsx)(o.A,{md:"7",children:null===v||void 0===v||null===(e=v.DM_LienHe)||void 0===e?void 0:e.Ten})]}),(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{md:"5",children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"H\xecnh th\u1ee9c tr\u1ea3:"})}),(0,H.jsx)(o.A,{md:"7",children:"Ti\u1ec1n m\u1eb7t (VN\u0110)"})]}),(null===v||void 0===v?void 0:v.IsDeleted)&&(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{md:"5",children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"L\xfd do h\u1ee7y:"})}),(0,H.jsx)(o.A,{md:"7",children:null===v||void 0===v?void 0:v.LyDo})]})]})}),(0,H.jsxs)(o.A,{md:"4",children:[(0,H.jsx)(g.A,{className:"font-weight-bold",for:"exampleText",children:"Ghi ch\xfa:"}),(0,H.jsx)(x.A,{style:{resize:"none",height:"120px",pointerEvents:"none"},type:"textarea",name:"text",id:"exampleText",value:null===v||void 0===v?void 0:v.GhiChu})]})]}),(0,H.jsx)(A.A,{unRefresDatatable:!0,tableRef:M,url:"ChiTietDonTraHangs",columns:b,where:`DonTraHang_Id eq ${a} and KhuyenMai_Id eq null`,selectType:"withColumns",search:!1}),(0,H.jsx)(I.A,{Id:a,status:"DonTraHang"}),0!==v.length&&0!==v.Sale_ChiTietDonTraHang.length&&(0,H.jsxs)(d.A,{style:{marginTop:20},children:[(0,H.jsx)(o.A,{md:"8",xs:"8",children:(0,H.jsx)(r.A,{children:(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{md:"2",style:{textAlign:"left"},children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"T\u1ed5ng s\u1ed1 l\u01b0\u1ee3ng :"})}),(0,H.jsx)(o.A,{md:"2",style:{textAlign:"left"},children:(0,m.vv)(_)})]})})}),(0,H.jsx)(o.A,{md:"4",children:(0,H.jsxs)(r.A,{children:[(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{md:"5",style:{textAlign:"right"},children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"T\u1ed5ng ti\u1ec1n tr\u1ea3 h\xe0ng :"})}),(0,H.jsx)(o.A,{md:"7",style:{textAlign:"right"},children:(0,m.vv)(null===v||void 0===v?void 0:v.TienHangTra)})]}),(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{md:"5",style:{textAlign:"right"},children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"Ph\xed tr\u1ea3 h\xe0ng (VN\u0110): "})}),(0,H.jsxs)(o.A,{md:"7",style:{textAlign:"right"},children:[(0,m.vv)(null===v||void 0===v?void 0:v.PhiTra)," "]})]}),(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{md:"5",style:{textAlign:"right"},children:(0,H.jsx)(g.A,{className:"font-weight-bold",children:"Ti\u1ec1n tr\u1ea3 kh\xe1ch :"})}),(0,H.jsx)(o.A,{md:"7",style:{textAlign:"right"},children:(0,m.vv)(null===v||void 0===v?void 0:v.ThanhTien)})]})]})})]}),!D&&(0,H.jsx)(d.A,{children:(0,H.jsxs)(o.A,{children:[(0,H.jsxs)(j.A,{disabled:null===v||void 0===v?void 0:v.IsDeleted,className:"cus-btn",color:"secondary",onClick:this.inPhieuTraHang,children:[(0,H.jsx)(p.A,{fa:"print"})," ","In phi\u1ebfu"]}),(0,H.jsxs)(j.A,{disabled:null===v||void 0===v?void 0:v.IsDeleted,className:"cus-btn",color:"danger",onClick:this.openHuyTraHang,children:[(0,H.jsx)(p.A,{fa:"print"})," ","H\u1ee7y \u0111\u01a1n tr\u1ea3"]})]})})]})})}),(0,H.jsxs)(N.A,{open:C,handleClose:()=>this.setState({openLyDoHuyDonTraHang:!1}),title:"Nh\u1eadp l\xfd do h\u1ee7y \u0111\u01a1n h\xe0ng",maxWidth:"xs",children:[(0,H.jsxs)(d.A,{children:[(0,H.jsx)(w.m,{xs:"4",children:"L\xfd do"}),(0,H.jsx)(o.A,{xs:"8",children:(0,H.jsx)("textarea",{type:"text",autoFocus:!0,className:"form-control",onBlur:n=>this.onChangeLyDo(n.target.value)})})]}),this.renderButton(L)]}),(0,H.jsx)(u.A,{open:f,title:"IN PHI\u1ebeU TR\u1ea2 H\xc0NG",onClose:()=>this.setState({openInPhieuTraHang:!1}),renderButton:(0,H.jsx)(t(),{trigger:()=>(0,H.jsx)(j.A,{style:{height:"27px",padding:"0 10px"},color:"primary",children:"In phi\u1ebfu"}),content:()=>this.componentRef}),children:(0,H.jsx)("div",{ref:n=>this.componentRef=n,className:"inPhieuHD page-phieu",children:(0,H.jsx)(S,{dataInPhieu:v})})})]})}}},26124:(n,e,s)=>{s.d(e,{c:()=>i});const i={DM:"don-moi",HT:"hoan-thanh",DH:"da-huy"}},38512:(n,e,s)=>{s.d(e,{A:()=>c});var i=s(9950),a=s(70349),t=s(23931),l=s(21205),h=s(36841),d=s(67116),o=s(4370),r=s(44414);class c extends i.Component{constructor(n){super(n),this.getChiTietKhuyenMai=(n,e)=>{"DonTraHang"===e?(0,o.Pq)(`ChiTietDonTraHangs?&$expand=DM_SanPhamDichVu,DM_DonViTinh,Sale_DonTraHang&$filter=DonTraHang_Id eq ${n} and KhuyenMai_Id ne null`).then((n=>this.setState({dataKhuyenMai:n.value}))).catch((n=>(0,d.a3)(n.Message))):"DonHang"===e&&(0,o.Pq)(`ChiTietDonHangs?&$expand=DM_SanPhamDichVu,DM_DonViTinh,&$filter=DonHang_Id eq ${n} and KhuyenMai_Id ne null`).then((n=>this.setState({dataKhuyenMai:n.value}))).catch((n=>(0,d.a3)(n)))},this.state={dataKhuyenMai:[]}}componentDidMount(){const{Id:n,status:e}=this.props;this.getChiTietKhuyenMai(n,e)}render(){const{dataKhuyenMai:n}=this.state,{status:e,statusDaTraHang:s}=this.props;let i=s?"H\xe0ng khuy\u1ebfn m\xe3i sau khi \u0111i\u1ec1u ch\u1ec9nh":"H\xe0ng khuy\u1ebfn m\xe3i";return(0,r.jsx)(a.A,{className:"mt-3",children:0!==n.length&&(0,r.jsxs)(t.A,{md:"12",children:[(0,r.jsx)("div",{children:(0,r.jsx)("b",{children:i})}),(0,r.jsxs)(l.A,{bordered:!0,size:"sm",className:"table-khuyen-mai",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"M\xe3 s\u1ea3n ph\u1ea9m"}),(0,r.jsx)("th",{children:"T\xean s\u1ea3n ph\u1ea9m"}),(0,r.jsx)("th",{children:"S\u1ed1 l\u01b0\u1ee3ng"}),(0,r.jsx)("th",{children:"\u0110VT"})]})}),(0,r.jsx)("tbody",{children:n.map(((n,e)=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{style:{width:"15%"},children:n.DM_SanPhamDichVu.MaSanPham}),(0,r.jsx)("td",{style:{width:"30%"},children:n.DM_SanPhamDichVu.TenSanPham}),(0,r.jsx)("td",{className:"text-right",style:{width:"10%"},children:(0,h.vv)(n.SoLuong)}),(0,r.jsx)("td",{style:{width:"10%"},children:n.DM_DonViTinh.Ten})]},e)))})]})]})})}}},44709:(n,e,s)=>{s.d(e,{A:()=>f});var i=s(9950),a=s(21205),t=s(70349),l=s(23931),h=s(50651),d=s(76991),o=s(36841),r=s(67116),c=s(29933),g=s(4370),x=s(60666),j=s(86803),m=s.n(j),T=s(75490),u=s(18849),p=s(73613),A=s(44414);function D(n){const{dataDonHang:e,dataChiTietDonHang:s,closeTraDonHang:a,reloadTableIndex:c,statusTraHang:x,handleClose:j}=n,[D,y]=i.useState([]),[v,f]=i.useState({Ten:null,CongNo:null}),[H,S]=i.useState({tongSoLuong:0,tongSoLuongTra:0,TongTienTra:0,TongTienHang:0}),[b,N]=i.useState(0),[w,C]=i.useState(0),[I,M]=i.useState("");i.useEffect((()=>{y(s)}),[s]),i.useEffect((()=>{(0,g.Pq)(`DonHangs(${e.Id})?$expand=DM_LienHe`).then((n=>f({Ten:n.DM_LienHe.Ten,CongNo:n.DM_LienHe.CongNo}))).catch((n=>(0,r.a3)(n.Message)))}),[e]),i.useEffect((()=>{let n=0,e=0,s=0,i=0;D.forEach((a=>{n+=parseFloat(a.SoLuong),e+=parseFloat(a.newSoLuong||0),s+=parseFloat((a.newDonGia||0)*(a.newSoLuong||0)),i+=parseFloat((parseFloat(a.newDonGia)||0)*(parseFloat(a.SoLuong)||0))})),S({tongSoLuong:n,tongSoLuongTra:e,TongTienTra:s,TongTienHang:i})}),[D]);const L=i.useCallback((n=>{N(n||0);let e=H.TongTienTra-parseFloat(n);C(e)}),[H]),_=i.useCallback((()=>{let n={chiTiet:D.filter((n=>n.newSoLuong>0)).map((n=>({SanPhamDichVu_Id:n.SanPhamDichVu_Id,DonHang_Id:n.DonHang_Id,DonViTinh_Id:n.DonViTinh_Id,GiaVon:n.GiaVon,DonGia:n.newDonGia||n.DonGia,SoLuong:n.newSoLuong||0,ThanhTien:n.newThanhTien||0,KhuyenMai_Id:n.KhuyenMai_Id}))),DiemKinhDoanhId:e.DM_DiemKinhDoanh.Id,DonHang_Id:e.Id,TongTienTra:H.TongTienTra,PhiTraHang:b,ThanhTien:w||H.TongTienTra,HinhThucThanhToan_Id:e.DM_HinhThucThanhToan.Id,GhiChu:I};(0,g.Pq)("DonHang/TraDonHang","POST",JSON.stringify(n),!1).then((n=>{(0,r.nw)(n.Message).then((()=>{x?(a("",!0),c(),j()):(a("",!0),c())}))})).catch((n=>(0,r.a3)(n.Message)))}),[D,e,H,b,w,I,x,a,c,j]);return(0,A.jsxs)(h.A,{style:{height:"100%"},children:[(0,A.jsx)(T.A,{className:"bg-primary",children:(0,A.jsxs)("b",{children:["Tr\u1ea3 h\xe0ng ",e.MaDonHang," - ",e.NguoiTao]})}),(0,A.jsxs)(d.A,{className:"card-body-tra-hang-thanh-toan",children:[(0,A.jsx)(t.A,{children:(0,A.jsxs)(l.A,{md:"12",children:[(0,A.jsxs)("div",{className:"d-flex-justify",children:[(0,A.jsxs)("p",{children:["Kh\xe1ch h\xe0ng: ",(0,A.jsx)("span",{className:"font-weight-bold",style:{paddingLeft:5},children:v.Ten})]}),(0,A.jsxs)("p",{children:["N\u1ee3: ",(0,A.jsx)("span",{className:"font-weight-bold",style:{paddingLeft:5},children:(0,o.vv)(v.CongNo)})]})]}),(0,A.jsxs)("div",{className:"d-flex-justify",children:[(0,A.jsxs)("p",{children:["T\u1ed5ng gi\xe1 g\u1ed1c h\xe0ng tr\u1ea3: ",(0,A.jsx)("span",{className:"badge-tra-hang",children:(0,o.vv)(H.tongSoLuong)})]}),(0,A.jsx)("span",{className:"font-weight-bold",children:(0,o.vv)(H.TongTienHang)})]}),(0,A.jsxs)("div",{className:"d-flex-justify",children:[(0,A.jsxs)("p",{children:["T\u1ed5ng ti\u1ec1n tr\u1ea3 h\xe0ng:",(0,A.jsx)("span",{className:"badge-tra-hang",children:(0,o.vv)(H.tongSoLuongTra)})]}),(0,A.jsx)("span",{className:"font-weight-bold",children:(0,o.vv)(H.TongTienTra)})]}),!(0,o.EP)()&&(0,A.jsxs)("div",{className:"d-flex-justify",children:[(0,A.jsx)("p",{children:"Gi\u1ea3m gi\xe1:"}),(0,A.jsx)("span",{className:"font-weight-bold"})]}),(0,A.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"15px"},children:[(0,A.jsx)("span",{children:"Ph\xed tr\u1ea3 h\xe0ng"}),(0,A.jsx)("span",{children:(0,A.jsx)(m(),{style:{width:100,textAlign:"right"},className:"font-weight-bold input-phi-tra-hang",onFocus:n=>n.target.select(),thousandSeparator:".",decimalSeparator:",",value:b,onValueChange:n=>L(n.floatValue)})})]}),(0,A.jsxs)("div",{className:"d-flex-justify",style:{marginBottom:"15px"},children:[(0,A.jsx)("span",{className:"font-weight-bold",style:{fontSize:20},children:"C\u1ea7n tr\u1ea3 kh\xe1ch"}),(0,A.jsx)("span",{className:"font-weight-bold",style:{fontSize:20,color:"#3ea662"},children:(0,o.vv)(H.TongTienTra)})]}),(0,A.jsxs)("div",{className:"d-flex-justify",children:[(0,A.jsx)("span",{style:{fontSize:15},children:"Ti\u1ec1n tr\u1ea3 kh\xe1ch"}),(0,A.jsx)("span",{style:{fontSize:15},className:"font-weight-bold",children:(0,o.vv)(w||H.TongTienTra)})]}),(0,A.jsxs)("div",{className:"textarea-ghi-chu",children:[(0,A.jsx)(p.A,{fa:"pencil"}),(0,A.jsx)("textarea",{className:"textarea-tra-hang",placeholder:"Ghi ch\xfa",onChange:n=>M(n.target.value),rows:"8"})]})]})}),(0,A.jsx)(u.A,{onClick:_,block:!0,color:"success",className:"custom-btn-tra-hang",children:"Tr\u1ea3 h\xe0ng (F9)"})]})]})}const y=[{name:"STT"},{name:"T\xean s\u1ea3n ph\u1ea9m"},{name:"S\u1ed1 l\u01b0\u1ee3ng"},{name:"\u0110VT"},{name:"Chi\u1ebft kh\u1ea5u"},{name:"\u0110\u01a1n gi\xe1"},{name:"Th\xe0nh ti\u1ec1n"}],v=[{name:"S\u1ea3n ph\u1ea9m khuy\u1ebfn m\xe3i"},{name:"S\u1ed1 l\u01b0\u1ee3ng"},{name:"\u0110\u01a1n v\u1ecb t\xednh"}];function f(n){const{openTraDonHang:e,dataDonHang:s,closeTraDonHang:j,reloadTableIndex:m,statusTraHang:T,handleClose:u}=n,[p,f]=i.useState([]);i.useEffect((()=>{(0,g.Pq)(`ChiTietDonHangs?&$expand=DM_SanPhamDichVu/DM_DonViTinh&$filter=DonHang_Id eq ${s.Id}`).then((n=>f(n.value.map((n=>({...n,isDisabledNumber:!0,newDonGia:S(n)})))))).catch((n=>(0,r.a3)("L\u1ea5y d\u1eef li\u1ec7u chi ti\u1ebft \u0111\u01a1n h\xe0ng l\u1ed7i")))}),[s]);const H=i.useCallback(((n,e)=>{let s=p.findIndex((n=>n.SanPhamDichVu_Id===e.SanPhamDichVu_Id&&n.DonViTinh_Id===e.DonViTinh_Id)),i={...e,newSoLuong:n<=parseFloat(e.SoLuongConLai)||!n?n:parseFloat(e.SoLuongConLai),newSoLuongConLai:parseFloat(e.SoLuongConLai)-n,newDonGia:S(e),newThanhTien:b(n,S(e)),isDisabledNumber:0===n};p[s]=i,f([...p])}),[p]),S=n=>parseFloat(n.DonGia)-((parseFloat(n.GiamGia)||0)/parseFloat(n.SoLuongConLai)).toFixed(),b=(n,e)=>n*e,N=i.useCallback(((n,e)=>(0,A.jsx)(x.A,{onFocus:n=>n.target.select(),thousandSeparator:".",decimalSeparator:",",value:parseFloat(n.newSoLuong)||0,invalid:!!e&&n.isDisabledNumber,onValueChange:e=>H(e.floatValue,n)})),[H]),w=i.useCallback(((n,e)=>(0,A.jsxs)(a.A,{striped:!0,size:"sm",bordered:!0,className:"table-tra-hang",children:[(0,A.jsx)("thead",{children:(0,A.jsx)("tr",{children:e?y.map(((n,e)=>(0,A.jsx)("th",{children:n.name},e))):v.map(((n,e)=>(0,A.jsx)("th",{children:n.name},e)))})}),(0,A.jsx)("tbody",{children:e?n.map(((n,s)=>(0,A.jsxs)("tr",{children:[(0,A.jsx)("td",{children:s+1}),(0,A.jsx)("td",{children:n.DM_SanPhamDichVu.TenSanPham}),(0,A.jsxs)("td",{children:[N(n,e),(0,A.jsxs)("span",{style:{fontSize:9,display:n.isDisabledNumber?"none":""},children:["C\xf2n l\u1ea1i: ",n.newSoLuongConLai||0]}),(0,A.jsx)("span",{style:{fontSize:9,display:n.isDisabledNumber?"":"none",color:"red"},children:"* Vui l\xf2ng nh\u1eadp s\u1ed1 l\u01b0\u1ee3ng"})]}),(0,A.jsx)("td",{children:n.DM_SanPhamDichVu.DM_DonViTinh.Ten}),(0,A.jsx)("td",{children:(0,o.vv)(n.GiamGia)}),(0,A.jsx)("td",{children:(0,o.vv)(n.DonGia)}),(0,A.jsx)("td",{children:(0,o.vv)(n.newThanhTien||0)})]},s))):0!==n.length?n.map(((n,s)=>(0,A.jsxs)("tr",{children:[(0,A.jsx)("td",{children:n.DM_SanPhamDichVu.TenSanPham}),(0,A.jsxs)("td",{className:"text-right",children:[N(n,e),(0,A.jsxs)("span",{style:{fontSize:9},children:["C\xf2n l\u1ea1i: ",n.newSoLuongConLai||0]})]}),(0,A.jsx)("td",{children:n.DM_SanPhamDichVu.DM_DonViTinh.Ten})]},s))):(0,A.jsx)("tr",{children:(0,A.jsx)("td",{style:{textAlign:"center"},colSpan:"3",children:"Kh\xf4ng c\xf3 h\xe0ng khuy\u1ebfn m\xe3i"})})})]})),[N]);return(0,A.jsx)(c.A,{open:e,title:`Tr\u1ea3 \u0111\u01a1n h\xe0ng ${s.MaDonHang}`,onClose:j,children:(0,A.jsxs)(t.A,{children:[(0,A.jsx)(l.A,{md:"8",children:(0,A.jsx)(h.A,{children:(0,A.jsxs)(d.A,{className:"card-body-tra-hang-table",children:[w(p.filter((n=>!n.KhuyenMai_Id)),!0),(0,A.jsx)("div",{children:"H\xe0ng khuy\u1ebfn m\xe3i"}),w(p.filter((n=>n.KhuyenMai_Id)),!1)]})})}),(0,A.jsx)(l.A,{md:"4",children:(0,A.jsx)(D,{statusTraHang:T,handleClose:u,reloadTableIndex:m,closeTraDonHang:j,dataDonHang:s,dataChiTietDonHang:p})})]})})}},65597:(n,e,s)=>{s.d(e,{A:()=>T});s(9950);var i=s(33720),a=s(78854),t=s(96918),l=s(77766),h=s(43510),d=s(97226),o=s(13144),r=s(39886),c=s(86006),g=s(44414);const x=(0,i.A)((n=>({root:{margin:0,backgroundColor:"rgb(3,56,99)",color:"#FFF",padding:"6px 12px"},closeButton:{position:"absolute",right:n.spacing(1),top:n.spacing(1),color:n.palette.grey[500],padding:"0 6px"}})))((n=>{const{children:e,classes:s,onClose:i}=n;return(0,g.jsxs)(t.A,{disableTypography:!0,className:s.root,children:[(0,g.jsx)(r.A,{variant:"subtitle2",children:e}),i?(0,g.jsx)(d.A,{"aria-label":"close",className:s.closeButton,onClick:i,children:(0,g.jsx)(o.A,{fontSize:"small"})}):null]})})),j=(0,i.A)((n=>({root:{padding:n.spacing(2)}})))(l.A),m=(0,i.A)((n=>({root:{margin:0,padding:n.spacing(1),marginLeft:0}})))(h.A);function T(n){const{title:e,open:s,children:i,renderButton:t,handleClose:l,maxWidth:h,className:d,zIndex:o,renderButtonHeader:r,transferToModal:c}=n;let T=[];return d&&T.push(d),c&&T.push("Dialog-Transfer-To-Modal"),(0,g.jsx)("div",{children:(0,g.jsxs)(a.A,{className:T.join(" "),style:{zIndex:o||9999},onClose:l,open:s,fullWidth:!0,maxWidth:h,children:[e&&(0,g.jsxs)(x,{onClose:l,children:[e," ",r&&(0,g.jsx)(u,{children:r})]}),(0,g.jsx)(j,{dividers:!0,children:i}),t&&(0,g.jsx)(m,{children:t})]})})}T.defaultProps={open:!1};const u=c.Ay.div` display: inline; `}}]);