????
Current Path : C:/inetpub/vhost/qlk.nextform.vn/www/wwwroot/static/js/ |
Current File : C:/inetpub/vhost/qlk.nextform.vn/www/wwwroot/static/js/1043.cd5f1389.chunk.js |
"use strict";(self.webpackChunkgdt=self.webpackChunkgdt||[]).push([[1043],{3908:(n,e,s)=>{s.d(e,{m:()=>i.A});s(48274);var i=s(46499)},37746:(n,e,s)=>{s.d(e,{A:()=>r});var i=s(9950),a=s(78854),t=s(9330),l=s(44414);const h=i.forwardRef(((n,e)=>(0,l.jsx)(t.A,{direction:"up",ref:e,...n})));function r(n){const{children:e,onClose:s,open:i,className:t}=n;return(0,l.jsx)(a.A,{className:t,fullScreen:!0,open:i,onClose:s,TransitionComponent:h,children:e})}},82376:(n,e,s)=>{s.d(e,{A:()=>T});var i=s(9950),a=s(37746),t=s(69994),l=s(87092),h=s(29312),r=s(81270),o=s(39886),d=s(33322),c=s(44414);const x=(0,t.A)((n=>(0,l.A)({appBar:{position:"relative",backgroundColor:"rgb(3,56,99)"},toolbar:{minHeight:40},title:{marginLeft:n.spacing(2),flex:1}})));function g(n){const e=x(),{renderCustom:s,renderButton:i,title:a,onClose:t}=n;return(0,c.jsx)(h.A,{className:e.appBar,children:(0,c.jsxs)(r.A,{className:e.toolbar,variant:"dense",children:[s,(0,c.jsx)(o.A,{variant:"h6",className:e.title,children:a}),i,(0,c.jsx)(d.A,{onClick:t,children:"\u0110\xf3ng"})]})})}var m=s(77766);function j(n){return(0,c.jsx)(m.A,{style:{backgroundColor:"#eee",paddingTop:20,overflow:"unset"},children:n.children})}function u(n){const{renderCustom:e,renderButton:s,children:t,title:l,onClose:h,open:r,className:o}=n;return(0,i.useEffect)((()=>{}),[r]),(0,c.jsxs)(a.A,{className:o,open:r,onClose:h,children:[(0,c.jsx)(g,{renderCustom:e,renderButton:s,title:l,onClose:h}),(0,c.jsx)(j,{children:t})]})}const T=i.memo(u)},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),r=s(67116),o=s(4370),d=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 ".concat(n," and KhuyenMai_Id ne null")).then((n=>this.setState({dataKhuyenMai:n.value}))).catch((n=>(0,r.a3)(n.Message))):"DonHang"===e&&(0,o.Pq)("ChiTietDonHangs?&$expand=DM_SanPhamDichVu,DM_DonViTinh,&$filter=DonHang_Id eq ".concat(n," and KhuyenMai_Id ne null")).then((n=>this.setState({dataKhuyenMai:n.value}))).catch((n=>(0,r.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,d.jsx)(a.A,{className:"mt-3",children:0!==n.length&&(0,d.jsxs)(t.A,{md:"12",children:[(0,d.jsx)("div",{children:(0,d.jsx)("b",{children:i})}),(0,d.jsxs)(l.A,{bordered:!0,size:"sm",className:"table-khuyen-mai",children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:"M\xe3 s\u1ea3n ph\u1ea9m"}),(0,d.jsx)("th",{children:"T\xean s\u1ea3n ph\u1ea9m"}),(0,d.jsx)("th",{children:"S\u1ed1 l\u01b0\u1ee3ng"}),(0,d.jsx)("th",{children:"\u0110VT"})]})}),(0,d.jsx)("tbody",{children:n.map(((n,e)=>(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:{width:"15%"},children:n.DM_SanPhamDichVu.MaSanPham}),(0,d.jsx)("td",{style:{width:"30%"},children:n.DM_SanPhamDichVu.TenSanPham}),(0,d.jsx)("td",{className:"text-right",style:{width:"10%"},children:(0,h.vv)(n.SoLuong)}),(0,d.jsx)("td",{style:{width:"10%"},children:n.DM_DonViTinh.Ten})]},e)))})]})]})})}}},26124:(n,e,s)=>{s.d(e,{c:()=>i});const i={DM:"don-moi",HT:"hoan-thanh",DH:"da-huy"}},21812:(n,e,s)=>{s.d(e,{A:()=>M});var i=s(9950),a=s(45418),t=s.n(a),l=s(50651),h=s(76991),r=s(70349),o=s(23931),d=s(19247),c=s(76152),x=s(55627),g=s(85077),m=s(18849),j=s(36841),u=s(67116),T=s(82376),p=s(73613),A=s(85560),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=(null===n||void 0===n?void 0:n.DiemKinhDoanhId)||n.DiemKinhDoanh_Id;(0,D.Pq)("DiemKinhDoanhs(".concat(e,")"),"GET",null).then((n=>this.setState({TenDiemKinhDoanh:n.Ten}))).catch((n=>(0,u.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)(r.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)(r.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,j.Rt)(n.NgayTao)]})]})}),(0,H.jsx)(r.A,{style:{marginBottom:5},children:(0,H.jsxs)(o.A,{xs:"12",md:"12",children:[(0,H.jsxs)(r.A,{style:{marginBottom:5},children:[(0,H.jsx)(o.A,{xs:"6",md:"5",children:(0,H.jsx)(x.A,{className:"font-weight-bold",children:"\u0110i\u1ec3m kinh doanh:"})}),(0,H.jsx)(o.A,{xs:"6",md:"7",children:e})]}),(0,H.jsxs)(r.A,{style:{marginBottom:5},children:[(0,H.jsx)(o.A,{xs:"6",md:"5",children:(0,H.jsx)(x.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,j.vv)(n.DonGia)})}),(0,H.jsx)("td",{style:{textAlign:"right",verticalAlign:"bottom",paddingBottom:5},children:(0,j.vv)(n.SoLuong)}),(0,H.jsx)("td",{style:{textAlign:"right",verticalAlign:"bottom",paddingBottom:5},children:(0,j.vv)(n.ThanhTien)})]},e)))})]}),n&&0!==s.length&&(0,H.jsxs)(r.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)(d.A,{children:[(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{xs:"8",md:"8",children:(0,H.jsx)(x.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,j.vv)(i)})]}),(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{xs:"8",md:"8",children:(0,H.jsx)(x.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,j.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)(x.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,j.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)(x.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,j.vv)(n.ThanhTien)})]})]})})]}),(0,H.jsx)(r.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)(x.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)(r.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)(x.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)(r.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 N=[{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,j.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,j.vv)(n.DonGia)},{title:"Th\xe0nh ti\u1ec1n",field:"ThanhTien",type:"numeric",hidden:!1,editable:"never",render:n=>(0,j.vv)(n.ThanhTien)}];var b=s(65597),w=s(3908),C=s(55002),I=s(38512);const L=i.createRef();class M 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=".concat(this.props.IdDonTraHang,"&lyDo=").concat(n),"POST",null,!1).then((n=>{(0,u.nw)(n).then((()=>{this.props.statusTraHang?(this.props.closeDetailTraHang(),this.props.getDataDonHang(),this.props.reloadTableIndexDonHang()):(this.props.closeDetailTraHang(),this.props.reloadTableIndex())}))})).catch((n=>(0,u.AB)(n.Message))):(0,u.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(".concat(n,")?$expand=Sale_ChiTietDonTraHang/DM_SanPhamDichVu,DM_DiemKinhDoanh,DM_LienHe"),"GET",null).then((n=>this.setState({data:n}))).catch((n=>(0,u.a3)(n.Message)))}render(){var n,e;const{openDetailTraHang:s,closeDetailTraHang:i,IdDonTraHang:a,MaTraHang:u,isDetailTheKho:D,className:y}=this.props,{data:v,openInPhieuTraHang:f,openLyDoHuyDonTraHang:C,textLyDo:M}=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)(T.A,{className:y,open:s,title:"CHI TI\u1ebeT \u0110\u01a0N TR\u1ea2 H\xc0NG ".concat(u),onClose:i,children:(0,H.jsx)(l.A,{children:(0,H.jsxs)(h.A,{children:[(0,H.jsxs)(r.A,{children:[(0,H.jsx)(o.A,{md:"4",children:(0,H.jsxs)(d.A,{children:[(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{md:"5",children:(0,H.jsx)(x.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)(x.A,{className:"font-weight-bold",children:"Th\u1eddi gian:"})}),(0,H.jsx)(o.A,{md:"7",children:(0,j.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)(x.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)(x.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)(d.A,{children:[(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{md:"5",children:(0,H.jsx)(x.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)(x.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)(x.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)(x.A,{className:"font-weight-bold",for:"exampleText",children:"Ghi ch\xfa:"}),(0,H.jsx)(g.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:L,url:"ChiTietDonTraHangs",columns:N,where:"DonTraHang_Id eq ".concat(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)(r.A,{style:{marginTop:20},children:[(0,H.jsx)(o.A,{md:"8",xs:"8",children:(0,H.jsx)(d.A,{children:(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{md:"2",style:{textAlign:"left"},children:(0,H.jsx)(x.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,j.vv)(_)})]})})}),(0,H.jsx)(o.A,{md:"4",children:(0,H.jsxs)(d.A,{children:[(0,H.jsxs)(c.A,{row:!0,children:[(0,H.jsx)(o.A,{md:"5",style:{textAlign:"right"},children:(0,H.jsx)(x.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,j.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)(x.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,j.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)(x.A,{className:"font-weight-bold",children:"Ti\u1ec1n tr\u1ea3 kh\xe1ch :"})}),(0,H.jsx)(o.A,{md:"7",style:{textAlign:"right"},children:(0,j.vv)(null===v||void 0===v?void 0:v.ThanhTien)})]})]})})]}),!D&&(0,H.jsx)(r.A,{children:(0,H.jsxs)(o.A,{children:[(0,H.jsxs)(m.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)(m.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)(b.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)(r.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(M)]}),(0,H.jsx)(T.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)(m.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})})})]})}}},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),r=s(76991),o=s(36841),d=s(67116),c=s(82376),x=s(4370),g=s(60666),m=s(86803),j=s.n(m),u=s(75490),T=s(18849),p=s(73613),A=s(44414);function D(n){const{dataDonHang:e,dataChiTietDonHang:s,closeTraDonHang:a,reloadTableIndex:c,statusTraHang:g,handleClose:m}=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}),[N,b]=i.useState(0),[w,C]=i.useState(0),[I,L]=i.useState("");i.useEffect((()=>{y(s)}),[s]),i.useEffect((()=>{(0,x.Pq)("DonHangs(".concat(e.Id,")?$expand=DM_LienHe")).then((n=>f({Ten:n.DM_LienHe.Ten,CongNo:n.DM_LienHe.CongNo}))).catch((n=>(0,d.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 M=i.useCallback((n=>{b(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:N,ThanhTien:w||H.TongTienTra,HinhThucThanhToan_Id:e.DM_HinhThucThanhToan.Id,GhiChu:I};(0,x.Pq)("DonHang/TraDonHang","POST",JSON.stringify(n),!1).then((n=>{(0,d.nw)(n.Message).then((()=>{g?(a("",!0),c(),m()):(a("",!0),c())}))})).catch((n=>(0,d.a3)(n.Message)))}),[D,e,H,N,w,I,g,a,c,m]);return(0,A.jsxs)(h.A,{style:{height:"100%"},children:[(0,A.jsx)(u.A,{className:"bg-primary",children:(0,A.jsxs)("b",{children:["Tr\u1ea3 h\xe0ng ",e.MaDonHang," - ",e.NguoiTao]})}),(0,A.jsxs)(r.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)(j(),{style:{width:100,textAlign:"right"},className:"font-weight-bold input-phi-tra-hang",onFocus:n=>n.target.select(),thousandSeparator:".",decimalSeparator:",",value:N,onValueChange:n=>M(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=>L(n.target.value),rows:"8"})]})]})}),(0,A.jsx)(T.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:m,reloadTableIndex:j,statusTraHang:u,handleClose:T}=n,[p,f]=i.useState([]);i.useEffect((()=>{(0,x.Pq)("ChiTietDonHangs?&$expand=DM_SanPhamDichVu/DM_DonViTinh&$filter=DonHang_Id eq ".concat(s.Id)).then((n=>f(n.value.map((n=>({...n,isDisabledNumber:!0,newDonGia:S(n)})))))).catch((n=>(0,d.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:N(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(),N=(n,e)=>n*e,b=i.useCallback(((n,e)=>(0,A.jsx)(g.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:[b(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:[b(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"})})})]})),[b]);return(0,A.jsx)(c.A,{open:e,title:"Tr\u1ea3 \u0111\u01a1n h\xe0ng ".concat(s.MaDonHang),onClose:m,children:(0,A.jsxs)(t.A,{children:[(0,A.jsx)(l.A,{md:"8",children:(0,A.jsx)(h.A,{children:(0,A.jsxs)(r.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:u,handleClose:T,reloadTableIndex:j,closeTraDonHang:m,dataDonHang:s,dataChiTietDonHang:p})})]})})}},32385:(n,e,s)=>{s.d(e,{A:()=>l});var i=s(9950),a=s(23931),t=s(44414);class l extends i.Component{render(){let{children:n,className:e,FilterSearchAdvanced:s,FilterNoHeader:i,NoTabs:l}=this.props,h=[];return e&&h.push(e),h.push("filter-datatable"),s&&h.push("filter-search-advanced"),i&&h.push("filter-no-header"),l&&h.push("filter-no-tabs"),(0,t.jsx)(a.A,{className:h.join(" "),md:"9",children:n})}}l.defaultProps={className:"",FilterSearchAdvanced:"",FilterNoHeader:"",NoTabs:""}}}]);