????

Your IP : 13.59.235.245


Current Path : C:/inetpub/vhost/lantha.gdtsolutions.vn/wwwtest/wwwroot/static/js/
Upload File :
Current File : C:/inetpub/vhost/lantha.gdtsolutions.vn/wwwtest/wwwroot/static/js/6708.f5943113.chunk.js

"use strict";(self.webpackChunkgdt=self.webpackChunkgdt||[]).push([[6708],{428:(e,t,n)=>{n.d(t,{A5:()=>h,G5:()=>a,Is:()=>m,UI:()=>i,V$:()=>u,Yv:()=>r,Z5:()=>c,e9:()=>p,gn:()=>l,jB:()=>d,xz:()=>g});n(67116);const a=e=>e.filter((e=>e.dataID))[0],i=e=>a(e).field,l=e=>e&&e.includes("."),s=e=>e.split(".").join("/"),o=(e,t)=>e?t.field:t,r=(e,t,n)=>{const i=a(t);return`${e}(${"guid"===i.type?"guid":""}'${n[i.field]}')`},d=function(e,t,n){return arguments.length>3&&void 0!==arguments[3]&&arguments[3]?`substringof('${n}', ${e})`:`${e} eq ${((e,t)=>"string"===e?`'${t}'`:"datetime"===e?`datetime'${t}'`:"guid"===e?`guid'${t}'`:`${t}`)(t,n)}`},h=(e,t)=>{if(e.filters&&e.filters.length>0){const t=e.filters.filter((e=>e.column.field&&e.column.type)).map((e=>{const t=`${l(e.column.field)?e.column.dataRef?e.column.dataRef[0]:s(e.column.field):e.column.field}`;return d(t,e.column.type,e.value)}));return t&&t.join(" and ")}if(e.search&&e.search.length>=1){const n=t.filter((e=>e.searchable&&e.field&&e.type)).map((t=>{const n=`${l(t.field)?s(t.field):t.field}`;return d(n,t.type,e.search,!0)}));return n&&n.join(" or ")}return""},c=(e,t)=>`$top=${t}&$skip=${e*t}&$inlinecount=allpages`,u=(e,t)=>`&$orderby=${l(e)?s(e):e} ${t}`,p=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=e.filter((e=>l(o(t,e))));return 0===n.length?"":`&$expand=${function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=[];return e.forEach(((e,a)=>{let i=o(t,e).split(".").reverse().splice(1).reverse().join("/");0===a?n.push(i):n.some((e=>e===i))||n.push(i)})),n.join(",")}(n,t)}`},m=function(e){const t=function(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return t?"withColumns"===t?`${e.reduce(((e,t,a,i)=>{let r=o(n,t),d=`${e}`;return l(r)?d+=`${void 0===t.dataRef?"":t.dataRef[0]+","}${s(r)}`:d+=`${r}`,`${d}${a===i.length-1?"":","}`}),"")}`:"":`${e.filter((e=>l(e.field))).reduce(((e,t)=>`${e},${s(o(n,t))}`),"*")}`}(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"withColumns",!(arguments.length>2&&void 0!==arguments[2])||arguments[2]);return t?`&$select=${t}`:""},g=function(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"withColumns";return`${p(e,n)}${m(e,a,n)}${t?"&$filter="+t:""}`}},8434:(e,t,n)=>{n.d(t,{M:()=>a});const a={KH:"khachhang",NCC:"nhacungcap"}},10077:(e,t,n)=>{n.d(t,{A:()=>x});var a=n(9950),i=n(15255);const l={body:{emptyDataSourceMessage:"Kh\xf4ng c\xf3 d\u1eef li\u1ec7u \u0111\u1ec3 hi\u1ec3n th\u1ecb",addTooltip:"Th\xeam",editTooltip:"S\u1eeda",deleteTooltip:"X\xf3a",editRow:{deleteText:"B\u1ea1n c\xf3 ch\u1eafc ch\u1eafn x\xf3a d\xf2ng n\xe0y kh\xf4ng?",cancelTooltip:"H\u1ee7y",saveTooltip:"L\u01b0u"}},toolbar:{exportTitle:"Xu\u1ea5t file",searchTooltip:"T\xecm ki\u1ebfm",showColumnsTitle:"Hi\u1ec7n c\u1ed9t",addRemoveColumns:"Th\xeam v\xe0 hi\u1ec3n th\u1ecb c\xe1c c\u1ed9t",searchPlaceholder:"T\xecm ki\u1ebfm"},pagination:{labelRowsPerPage:"S\u1ed1 d\xf2ng cho 1 trang",labelRowsSelect:"d\xf2ng",labelDisplayedRows:" {from}-{to} c\u1ee7a {count}",firstTooltip:"Trang \u0111\u1ea7u ti\xean",previousTooltip:"Trang tr\u01b0\u1edbc",nextTooltip:"Trang sau",lastTooltip:"Trang cu\u1ed1i c\xf9ng"},header:{actions:"Thao t\xe1c"}};var s=n(44414);const o=a.lazy((()=>Promise.all([n.e(9818),n.e(8185),n.e(3130),n.e(783),n.e(7930),n.e(7608),n.e(7476),n.e(484),n.e(7925),n.e(5060),n.e(2026),n.e(8190),n.e(537),n.e(1105)]).then(n.bind(n,38671)))),r=a.lazy((()=>Promise.all([n.e(9818),n.e(3130),n.e(783),n.e(7930),n.e(5060),n.e(5897)]).then(n.bind(n,46350)))),d=a.lazy((()=>Promise.all([n.e(9818),n.e(3435)]).then(n.bind(n,33435)))),h={color:"#000",padding:"2px",fontSize:"12px",fontWeight:"bold",textAlign:"center",backgroundColor:"powderblue",borderLeft:"0.5px solid rgb(224, 224, 224)",zIndex:99},c={even:"#FFF",odd:"rgb(247, 248, 255)"},u={fontSize:"12px",borderLeft:"0.5px solid rgba(224, 224, 224, 1)"};class p extends a.Component{render(){const{addMoreRows:e,pageSize:t,search:n,CustumToolbar:a,CustumCell:i,SearchAdvanced:c,onRowClick:p,dataCount:m,rowStyle:g,rowsPerPage:f,page:x,...T}=this.props;return(0,s.jsx)(o,{...T,addMoreRows:e,localization:l,options:{exportButton:!1,search:n,actionsColumnIndex:-1,pageSize:t,headerStyle:h,rowStyle:g},onRowClick:void 0===p?void 0:(e,t)=>p(e,t),components:(()=>{let e={Toolbar:e=>(0,s.jsx)(r,{...e,SearchAdvanced:c}),Cell:e=>(0,s.jsx)(d,{...e,style:u})};return a&&(e.Toolbar=a),i&&(e.Cell=i),e})()})}}p.defaultProps={rowStyle:(e,t,n)=>({backgroundColor:t%2===0?c.even:c.odd}),pageSize:10,search:!0};var m=n(428),g=n(4370),f=n(67116);class x extends a.Component{render(){const{tableRef:e,url:t,title:n,columns:a,pageSize:l,detailPanel:o,where:r,search:d,selectType:h,rowStyle:c,onAdd:u,onEdit:x,onDelete:T,onActions:y,onRowClick:j,SearchAdvanced:v,CustumToolbar:C,CustumCell:b,urlExt:S,unRefresDatatable:D,notCreateUUID:A,messageCustomDetele:w}=this.props,N=e=>a.filter((e=>m.gn(e.field)&&e.dataRef)).map((e=>({column:e,field_split:e.field.split(".")}))).forEach((t=>{delete e[t.field_split[0]]})),k=e=>{let t=a.filter((e=>e.dataCheck));for(var n=0;n<t.length;n++)if(m.gn(t[n].field)&&t[n].dataRef){if(null===e[t[n].dataRef[0]]||void 0===e[t[n].dataRef[0]]||""===e[t[n].field])return(0,f.AB)("Vui l\xf2ng nh\u1eadp d\u1eef li\u1ec7u c\u1ed9t "+t[n].title),!1}else if(void 0===e[t[n].field]||null===e[t[n].field]||""===e[t[n].field])return(0,f.AB)("Vui l\xf2ng nh\u1eadp d\u1eef li\u1ec7u c\u1ed9t "+t[n].title),!1;return!0};return(0,s.jsx)(p,{search:d,pageSize:l,title:n,columns:a,tableRef:e,SearchAdvanced:v,CustumToolbar:C,CustumCell:b,data:e=>S?(0,g.g3)((e=>`${S}${r?"?"+r:"&"}skip=${e.page*e.pageSize}&take=${e.pageSize}`)(e),"GET",null,!1).then((t=>({data:void 0===t.value?[]:t.value,page:e.page,totalCount:Number(t.count)}))):(0,g.g3)((e=>{let n=`${t}?${m.Z5(e.page,e.pageSize)}`;n+=`${m.e9(a)}${m.Is(a,h)}`,e.orderBy&&void 0!==e.orderBy&&e.orderDirection&&""!==e.orderDirection&&(n+=m.V$(e.orderBy.field,e.orderDirection));let i=m.A5(e,a);return n+=i?r?`&$filter=(${i}) and ${r}`:`&$filter=${i}`:r?"&$filter="+r:"",n})(e)).then((t=>({data:void 0===t.value?[]:t.value,page:e.page,totalCount:Number(t["odata.count"])}))),rowStyle:c,detailPanel:o,editable:(()=>{let e={};return u&&void 0===u.onClick&&!1===u.disabled&&(void 0===u.onRowAdd?e.onRowAdd=e=>new Promise(((n,l)=>{let s=m.G5(a);s.type&&"numeric"!==s.type&&(A?delete e[m.UI(a)]:s.dataIdCustom||(e[m.UI(a)]=(0,i.A)())),N(e),u.defaultValues&&u.defaultValues.forEach((t=>e[t.field]=t.value)),k(e)?(0,g.g3)(`${t}`,"POST",JSON.stringify(e)).then((e=>n(e))).catch((e=>{e.json().then((e=>(0,f.AB)(e.value))),l(e)})).finally((()=>{this.props.updateCountRadioList&&this.props.updateCountRadioList(),this.props.addCallback&&this.props.addCallback()})):l()})).then((e=>this.props.addCallbackWithResponse&&this.props.addCallbackWithResponse(e))).catch((e=>console.log(e))):e.onRowAdd=e=>u.onRowAdd(e)),x&&void 0===x.onClick&&(x.hidden&&("function"===typeof x.hidden?e.onUpdateHidden=e=>x.hidden(e):e.onUpdateHidden=x.hidden),x.disabled&&(e.isEditable=e=>x.disabled(e)),void 0===x.onRowUpdate?e.onRowUpdate=(e,n)=>new Promise(((i,l)=>{N(e),k(e)?(0,g.g3)(m.Yv(t,a,n),"PATCH",JSON.stringify(e)).then((()=>i())).catch((e=>{e.json().then((e=>(0,f.AB)(e.value))),l(e)})).finally((()=>{this.props.updateCountRadioList&&this.props.updateCountRadioList(),this.props.updateCallback&&this.props.updateCallback()})):l()})):e.onRowUpdate=(e,t)=>x.onRowUpdate(e,t)),T&&void 0===T.onClick&&(T.hidden&&("function"===typeof T.hidden?e.onDeleteHidden=e=>T.hidden(e):e.onDeleteHidden=T.hidden),T.disabled&&(e.isDeletable=e=>T.disabled(e)),void 0===T.onRowDelete?e.onRowDelete=e=>new Promise(((n,i)=>(0,g.g3)(m.Yv(t,a,e),"DELETE").then((()=>{T.messageSuccess?n(null,T.messageSuccess):n("X\xf3a d\u1eef li\u1ec7u th\xe0nh c\xf4ng !")})).catch((e=>{w?(0,f.a3)(w,"Th\xf4ng b\xe1o"):(0,f.a3)("X\xf3a d\u1eef li\u1ec7u kh\xf4ng th\xe0nh c\xf4ng !"),T.messageError?i(e,T.messageError):i("X\xf3a d\u1eef li\u1ec7u th\u1ea5t b\u1ea1i !")})).finally((()=>{this.props.updateCountRadioList&&this.props.updateCountRadioList(),this.props.deleteCallback&&this.props.deleteCallback()})))):e.onRowDelete=e=>T.onRowDelete(e)),e})(),actions:(()=>{let e=[];return y&&y.map((t=>e.push(t))),u&&u.onClick&&(u.icon="add_box",u.tooltip="Th\xeam",u.isAdd=!0,u.isFreeAction=!0,e.push(u)),x&&x.onClick&&(x.icon="edit",x.tooltip="S\u1eeda",x.isEdit=!0,e.push(x)),T&&T.onClick&&(T.icon="delete",T.tooltip="X\xf3a",T.isDelete=!0,e.push(T)),e})(),onRowClick:void 0===j?void 0:(e,t)=>j(e,t)})}}x.defaultProps={title:"",columns:[],pageSize:10,search:!0,tableRef:a.createRef()}},22161:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(9950),i=n(73613),l=n(44414);const s=e=>{const t=(0,a.useRef)(),{onSearch:n,className:s,placeholder:o}=e;(0,a.useEffect)((()=>{window.addEventListener("keydown",r),window.addEventListener("keyup",d)}),[]);const r=e=>{if(114===e.which)return e.preventDefault(),!1},d=e=>{114===e.which&&t.current&&t.current.focus()};return(0,l.jsxs)("div",{className:"search-box-XH pull-right "+(s||""),children:[(0,l.jsx)("input",{className:"form-control-sm form-control",ref:t,onChange:e=>{return t=e.target.value.trim(),void(n&&n(t));var t},placeholder:o||"T\xecm s\u1ea3n ph\u1ea9m theo m\xe3 ho\u1eb7c t\xean (F3)"}),(0,l.jsx)("span",{className:"btn-tim-kiem-XH",children:(0,l.jsx)(i.A,{fa:"search"})})]})}},29079:()=>{},29933:(e,t,n)=>{n.d(t,{A:()=>j});var a=n(9950),i=n(78854),l=n(9330),s=n(44414);const o=a.forwardRef(((e,t)=>(0,s.jsx)(l.A,{direction:"up",ref:t,...e})));function r(e){const{children:t,onClose:n,open:a,className:l}=e;return(0,s.jsx)(i.A,{className:l,fullScreen:!0,open:a,onClose:n,TransitionComponent:o,children:t})}var d=n(69994),h=n(87092),c=n(29312),u=n(81270),p=n(39886),m=n(33322);const g=(0,d.A)((e=>(0,h.A)({appBar:{position:"relative",backgroundColor:"rgb(3,56,99)"},toolbar:{minHeight:40},title:{marginLeft:e.spacing(2),flex:1}})));function f(e){const t=g(),{renderCustom:n,renderButton:a,title:i,onClose:l}=e;return(0,s.jsx)(c.A,{className:t.appBar,children:(0,s.jsxs)(u.A,{className:t.toolbar,variant:"dense",children:[n,(0,s.jsx)(p.A,{variant:"h6",className:t.title,children:i}),a,(0,s.jsx)(m.A,{onClick:l,children:"\u0110\xf3ng"})]})})}var x=n(77766);function T(e){return(0,s.jsx)(x.A,{style:{backgroundColor:"#eee",paddingTop:20,overflow:"unset"},children:e.children})}function y(e){const{renderCustom:t,renderButton:n,children:i,title:l,onClose:o,open:d,className:h}=e;return(0,a.useEffect)((()=>{}),[d]),(0,s.jsxs)(r,{className:h,open:d,onClose:o,children:[(0,s.jsx)(f,{renderCustom:t,renderButton:n,title:l,onClose:o}),(0,s.jsx)(T,{children:i})]})}const j=a.memo(y)},32385:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(9950),i=n(23931),l=n(44414);class s extends a.Component{render(){let{children:e,className:t,FilterSearchAdvanced:n,FilterNoHeader:a,NoTabs:s}=this.props,o=[];return t&&o.push(t),o.push("filter-datatable"),n&&o.push("filter-search-advanced"),a&&o.push("filter-no-header"),s&&o.push("filter-no-tabs"),(0,l.jsx)(i.A,{className:o.join(" "),md:"9",children:e})}}s.defaultProps={className:"",FilterSearchAdvanced:"",FilterNoHeader:"",NoTabs:""}},33322:(e,t,n)=>{n.d(t,{A:()=>o});n(9950);var a=n(71984),i=n(73613),l=n(44414);const s=e=>{const{children:t,...n}=e;return(0,l.jsxs)(a.A,{color:"danger",...n,children:[(0,l.jsx)(i.A,{fa:"times-circle"})," ",t]})};s.defaultProps={};const o=s},38886:(e,t,n)=>{n.d(t,{A:()=>o});n(9950);var a=n(86006),i=n(36841),l=n(44414);const s=e=>{let{label:t,value:n,className:a,style:s}=e;return(0,l.jsxs)(r,{style:s,className:"comp-thanh-tien "+a,children:[(0,l.jsxs)("span",{className:"mr-2",children:[t,":"]}),(0,l.jsx)("span",{children:(0,i.vv)(n)})]})},o=s,r=a.Ay.div`
    span:first-child{
        font-weight: 500
    }
    span:last-child{
        letter-spacing: 0.2px
    }
`;s.defaultProps={className:"pull-right",label:"Th\xe0nh ti\u1ec1n",value:0}},45248:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(9950),i=n(73613),l=n(44414);class s extends a.Component{constructor(e){super(e),this.state={},this.keyUpPress=this.keyUpPress.bind(this),this.keyDownPress=this.keyDownPress.bind(this)}componentDidMount(){window.addEventListener("keydown",this.keyDownPress),window.addEventListener("keyup",this.keyUpPress)}keyDownPress(e){if(113===e.which)return e.preventDefault(),!1}keyUpPress(e){113===e.which&&this.props.toggledisplayColTimKiemSanPham()}render(){const{toggledisplayColTimKiemSanPham:e,displayColTimKiemSanPham:t}=this.props;return(0,l.jsxs)("span",{className:"d-flex pull-right btn-expand",style:{alignItems:"center"},onClick:e,children:[(0,l.jsx)(i.A,{fa:t?"arrow-circle-right":"arrow-circle-left"})," "," (F2)"]})}}},96708:(e,t,n)=>{n.r(t),n.d(t,{default:()=>W});var a=n(9950),i=n(76115),l=n(53744),s=n(18383),o=n(30616),r=n(28412),d=n(62181),h=n(32385),c=n(10077),u=n(7175);const p={value:"luu_tam",label:"L\u01b0u t\u1ea1m"},m={value:"hoan_thanh",label:"Ho\xe0n th\xe0nh"};var g=n(44414);const f=[{field:"Id",type:"numeric",dataID:!0,hidden:!0,editable:"never"},{title:"Ng\xe0y ch\u1ee9ng t\u1eeb",field:"NgayTao",type:"datetime",editable:"never",defaultSort:"desc",cellStyle:{textAlign:"left"}},{title:"M\xe3 ch\u1ee9ng t\u1eeb",field:"MaXuatHuy",type:"string"},{title:"T\u1ed5ng gi\xe1 tr\u1ecb h\u1ee7y",field:"TongGiaTri",type:"currency"},{title:"Kho h\u1ee7y",field:"DM_Kho.Ten",type:"string",dataRef:["Kho_Id"]},{title:"Tr\u1ea1ng th\xe1i",field:"TrangThai",type:"string",cellStyle:{textAlign:"center"},render:e=>{switch(e.TrangThai){case p.value:return(0,g.jsx)(u.A,{color:"primary",children:p.label});case m.value:return(0,g.jsx)(u.A,{color:"success",children:m.label});default:return(0,g.jsx)(u.A,{color:"danger",children:"L\u1ed7i"})}}}];n(29079);var x=n(39051),T=n(18849),y=n(70349),j=n(23931),v=n(67116),C=n(29933),b=n(73613),S=n(4370),D=n(50651),A=n(75490),w=n(76991),N=n(27220),k=n(86006),$=n(36841),I=n(34849),P=n(38886),R=n(22161),H=n(45248),E=n(15986),_=n(73032),L=n(16272),M=n(8434);const V={MaXuatHuy:{field_name:"MaXuatHuy",title:"M\xe3 ch\u1ee9ng t\u1eeb:",displayWarning:"M\xe3 ch\u1ee9ng t\u1eeb",type:"label"},NgayTao:{field_name:"NgayTao",title:"Ng\xe0y ch\u1ee9ng t\u1eeb:",displayWarning:"Ng\xe0y ch\u1ee9ng t\u1eeb",type:"datetime",icon:!0,isDetail:!0,defaultValue:new Date},GhiChu:{field_name:"GhiChu",title:"Ghi ch\xfa:",type:"textarea",rows:"4"},NhaCungCap_Id:{field_name:"NhaCungCap_Id",title:"Nh\xe0 cung c\u1ea5p:",type:"data-select",required:!0,dataSelect:{url:"DM_LienHe",where:`NhomLienHe_Id eq '${M.M.NCC}' and IsDeleted ne true`,column:["Id","Ten"],value_field:"Id",text_field:"Ten",placeholder:"Ch\u1ecdn nh\xe0 cung c\u1ea5p.."}},NhomDonViTinh_Id:{field_name:"NhomDonViTinh_Id",title:"Nh\xf3m \u0111\u01a1n v\u1ecb t\xednh:",type:"data-select",dataSelect:{url:"DM_NhomDonViTinh",column:["MaNhom","TenNhom"],value_field:"MaNhom",text_field:"TenNhom",placeholder:"Ch\u1ecdn nh\xf3m \u0111\u01a1n v\u1ecb t\xednh"}}},G=e=>{const{data:t,onChange:n,isDetail:a,ID:i}=e;return(0,g.jsxs)(_.A,{md:"6",className:"mb-0",children:[(0,g.jsxs)(E.A,{children:[i&&(0,g.jsx)(L.A,{data:V.MaXuatHuy,value:t.MaXuatHuy,inline:!1,style:{paddingTop:4}}),(0,g.jsx)(L.A,{data:V.NgayTao,value:t.NgayTao,isDetail:a,inline:!1})]}),(0,g.jsx)(E.A,{children:(0,g.jsx)(L.A,{data:V.GhiChu,value:t.GhiChu,isDetail:a,onChange:n,inline:!1})})]})},K=(0,a.forwardRef)(((e,t)=>{const{OnAddDataChiTiet:n,ID:i,handleChange:l,data:s,toggleLDH:o,OnToggleLDH:r,TongGiaTri:d}=e,[h,c]=(0,a.useState)([]),[u,p]=(0,a.useState)([]);(0,a.useImperativeHandle)(t,(()=>({add(e){let t={...e,SanPhamXuatHuy_Id:e.Id,SoLuong:1,GiaTriHuy:e.GiaVon};c([...h,t])}}))),(0,a.useEffect)((()=>{i&&m()}),[i]),(0,a.useEffect)((()=>{p(h),n&&n(h)}),[h]);const m=()=>{(0,S.Pq)(`ChiTietXuatHuys?$filter=XuatHuy_Id eq ${i}&$expand=DM_SanPhamDichVu,DM_DonViTinh`,"GET",null).then((e=>c(e.value.map(((e,t)=>({...e,TenSanPham:e.DM_SanPhamDichVu.TenSanPham,DonViTinh:e.DM_DonViTinh.Ten})))))).catch((e=>(0,v.a3)("Kh\xf4ng th\u1ec3 t\u1ea3i d\u1eef li\u1ec7u chi ti\u1ebft xu\u1ea5t h\u1ee7y","Th\xf4ng b\xe1o")))};return(0,g.jsxs)(D.A,{children:[(0,g.jsxs)(A.A,{children:[(0,g.jsx)("b",{children:"Chi ti\u1ebft phi\u1ebfu xu\u1ea5t h\xe0ng"}),(0,g.jsx)(H.A,{displayColTimKiemSanPham:o,toggledisplayColTimKiemSanPham:()=>r&&r()}),(0,g.jsx)(R.A,{className:"mr-2",onSearch:e=>(e=>{let t=h.filter((t=>t.TenSanPham.toUpperCase().includes(e.toUpperCase().trim())));p(t)})(e)})]}),(0,g.jsxs)(w.A,{children:[(0,g.jsx)(G,{data:s,onChange:l,ID:i}),(0,g.jsxs)("table",{width:"100%",children:[(0,g.jsx)("thead",{children:(0,g.jsxs)("tr",{children:[(0,g.jsx)("td",{children:"STT"}),(0,g.jsx)("td",{children:"T\xean h\xe0ng"}),(0,g.jsx)("td",{children:"\u0110VT"}),(0,g.jsx)("td",{style:{width:150},children:"SL h\u1ee7y"}),(0,g.jsx)("td",{children:"Gi\xe1 v\u1ed1n"}),(0,g.jsx)("td",{children:"Gi\xe1 tr\u1ecb h\u1ee7y"}),(0,g.jsx)("td",{})]})}),(0,g.jsx)("tbody",{children:u&&u.map(((e,t)=>(0,g.jsxs)("tr",{children:[(0,g.jsx)("td",{children:t+1}),(0,g.jsx)("td",{className:"text-left",children:e.TenSanPham}),(0,g.jsx)("td",{children:e.DonViTinh}),(0,g.jsx)("td",{className:"text-right",children:(0,g.jsx)(I.YI,{min:"1",onFocus:e=>e.target.select(),value:parseFloat(e.SoLuong),onChange:e=>((e,t)=>{let n=h.slice(),a=n[t];a={...a,SoLuong:e,GiaTriHuy:parseInt(e||0)*parseFloat(a.GiaVon)},n[t]=a,c(n)})(e.target.value,t)})}),(0,g.jsx)("td",{children:(0,$.vv)(e.GiaVon)}),(0,g.jsx)("td",{children:(0,$.vv)(e.GiaTriHuy)}),(0,g.jsx)("td",{className:"text-center",children:(0,g.jsx)(X,{onClick:()=>(e=>{let t=h.filter(((t,n)=>n!==e));c(t)})(t),children:(0,g.jsx)(b.A,{fa:"times",style:{cursor:"pointer",color:"#f64846",fontSize:"15px"}})})})]},t)))})]})]}),(0,g.jsx)(N.A,{children:(0,g.jsx)(P.A,{label:"T\u1ed5ng gi\xe1 tr\u1ecb h\u1ee7y",value:d})})]})})),X=k.Ay.span`
`;var B=n(1254);const U=(0,a.forwardRef)(((e,t)=>{const n=e=>{if(115===e.which)return e.preventDefault(),!1;13===e.which?(u&&(null===u||void 0===u?void 0:u.length)>0&&o(u[m]),k()):40===e.which?m<u.length-1&&f(++m):38===e.which&&m>0&&f(--m)},i=e=>{115===e.which&&k()},{NhanVienBanHang_Id:s,OnAddItem:o,OnCheckExsist:r}=e,d=(0,a.useRef)(),[h,c]=(0,a.useState)([]),[u,p]=(0,a.useState)([]);let[m,f]=(0,a.useState)(0);const[x,T]=(0,a.useState)(""),[y,j]=(0,a.useState)(null),[C,N]=(0,a.useState)(null);(0,a.useEffect)((()=>(window.addEventListener("keydown",n),window.addEventListener("keyup",i),()=>{window.removeEventListener("keydown",n),window.removeEventListener("keyup",i)})),[n,i]),(0,a.useEffect)((()=>{t.current.getData()}),[s]),(0,a.useEffect)((()=>{I("")}),[h]),(0,a.useEffect)((()=>{t.current.getData()}),[C,y]),(0,a.useImperativeHandle)(t,(()=>({getData(){(0,S.Pq)(`SanPham/ThongTinSanPhamTonKho?diemKinhDoanhId=${l.b9.DiemKinhDoanhId}&nccId=${y||""}&nhomDonViTinh=${C||""}`,"GET",null,!1).then((e=>c(e.filter((e=>parseInt(e.SoLuongTon||0)>0))))).catch((e=>(0,v.a3)("Kh\xf4ng th\u1ec3 t\u1ea3i d\u1eef li\u1ec7u xu\u1ea5t h\xe0ng","Th\xf4ng b\xe1o")))}})));const k=()=>{d.current&&d.current.focus()},I=e=>{T(e),f(0),p(h.filter((t=>t.MaSanPham.toUpperCase().includes(e.toUpperCase().trim())||t.TenSanPham.toUpperCase().includes(e.toUpperCase().trim())))),0===h.length&&(d.current.value="")},P=u||h;return(0,g.jsx)(a.Fragment,{children:(0,g.jsxs)(D.A,{className:"tim-kiem-san-pham xuat-huy",children:[(0,g.jsx)(A.A,{children:(0,g.jsx)("b",{children:"T\xecm ki\u1ebfm s\u1ea3n ph\u1ea9m"})}),(0,g.jsxs)(w.A,{children:[(0,g.jsx)(L.A,{inline:!0,data:V.NhaCungCap_Id,value:y,styleRow:{fontSize:"14px"},onChange:(e,t)=>j(t)}),(0,g.jsx)(L.A,{inline:!0,data:V.NhomDonViTinh_Id,value:C,styleRow:{fontSize:"14px"},onChange:(e,t)=>N(t)}),(0,g.jsxs)("div",{className:"search-box pull-right",children:[(0,g.jsx)("input",{ref:d,className:"form-control-sm form-control",defaultValue:x,onChange:e=>I(e.target.value.trim()),placeholder:"T\xecm \u0111\u01a1n h\xe0ng theo m\xe3 ho\u1eb7c t\xean kh\xe1ch h\xe0ng... (F4)"}),(0,g.jsx)("span",{className:"btn-tim-kiem",children:(0,g.jsx)(b.A,{fa:"search"})})]}),(0,g.jsx)("div",{className:"search-results",children:(0,g.jsx)("div",{className:"list-result",children:(null===P||void 0===P?void 0:P.length)>0?P.map(((e,t)=>(0,g.jsxs)("div",{className:t===m?"list-item focus-one":"list-item",onMouseEnter:()=>f(t),children:[(0,g.jsx)("div",{className:"image",children:(0,g.jsx)("img",{src:e.HinhAnh?"api/"+e.HinhAnh:"assets/default.jpg",width:"45",alt:""})}),(0,g.jsxs)("div",{className:"info",onClick:()=>{o(e)},children:[(0,g.jsxs)("div",{style:{position:"relative"},children:[(0,g.jsx)("span",{children:e.MaSanPham})," - ",e.TenSanPham,(0,g.jsx)(B.A,{color:"success",style:{position:"absolute",top:0,right:0,display:r(e)?"block":"none"},children:"\u0110\xe3 th\xeam"})]}),(0,g.jsxs)("div",{children:[(0,g.jsxs)("span",{children:["Gi\xe1 NC: ",(0,$.vv)(e.GiaNhapCuoi)]}),(0,g.jsxs)("span",{children:["T\u1ed3n: ",e.SoLuongTon||e.SoLuongTonQuyDoi?(0,g.jsxs)(g.Fragment,{children:[e.SoLuongTon?e.SoLuongTon:0,"/",e.SoLuongTonQuyDoi?e.SoLuongTonQuyDoi:0]}):(0,g.jsx)(B.A,{color:"danger",children:"H\u1ebft h\xe0ng"})]}),(0,g.jsxs)("span",{children:["KH \u0111\u1eb7t: ",e.SoLuongTreoCoBan?e.SoLuongTreoCoBan:0,"/",e.SoLuongTreoQuyDoi?e.SoLuongTreoQuyDoi:0]})]})]})]},e.Id))):u?(0,g.jsxs)("div",{className:"list-item",style:{minHeight:"150px",justifyContent:"center"},children:[" ","Kh\xf4ng c\xf3 k\u1ebft qu\u1ea3 ph\xf9 h\u1ee3p!"]}):""})})]})]})})})),z=e=>{const t=(0,a.useRef)(),n=(0,a.useRef)(),{open:i,onClose:s,ID:o,OnReloadTable:r}=e,[d,h]=(0,a.useState)({}),[c,u]=(0,a.useState)(!0);(0,a.useEffect)((()=>{o&&x()}),[o]),(0,a.useEffect)((()=>{d.chiTiet&&w()}),[d.chiTiet]);const f=o?"S\u1eeda phi\u1ebfu xu\u1ea5t h\u1ee7y":"T\u1ea1o phi\u1ec3u xu\u1ea5t h\u1ee7y",x=()=>{(0,S.Pq)(`XuatHuys(${o})`,"GET",null).then((e=>h({...d,...e}))).catch((e=>(0,v.a3)("Kh\xf4ng th\u1ec3 t\u1ea3i d\u1eef li\u1ec7u xu\u1ea5t h\u1ee7y","Th\xf4ng b\xe1o")))},D=e=>{if(A()){let t=o?"XuatHuy/CapNhatXuatHuy":"XuatHuy/TaoPhieuXuatHuy",n=o?"C\u1eadp nh\u1eadt phi\u1ebfu xu\u1ea5t h\u1ee7y th\xe0nh c\xf4ng":"T\u1ea1o phi\u1ebfu xu\u1ea5t h\u1ee7y th\xe0nh c\xf4ng",a={Id:o||"",...d,Kho_Id:l.b9.Kho_Id,TrangThai:e};(0,S.Pq)(t,"POST",JSON.stringify(a),!1).then((e=>{r(),(0,v.nw)(n,"Th\xf4ng b\xe1o"),s()})).catch((e=>(0,v.a3)(e.Message,"Th\xf4ng b\xe1o")))}},A=()=>!(d.chiTiet.length<1)||((0,v.AB)("Ch\u01b0a nh\u1eadp chi ti\u1ebft phi\u1ebfu xu\u1ea5t h\u1ee7y","Th\xf4ng b\xe1o"),!1),w=()=>{let e=0,t=d.chiTiet||[];t.forEach(((n,a)=>{e+=parseFloat(n.GiaTriHuy||0),a===t.length-1&&h({...d,TongGiaTri:e})}))};return(0,g.jsx)(C.A,{className:"custom-modal",title:f,open:i,onClose:s,renderButton:(0,g.jsxs)(a.Fragment,{children:[(0,g.jsxs)(T.A,{className:"mr-2",size:"sm",color:"primary",onClick:()=>D(p.value),children:[(0,g.jsx)(b.A,{fa:"save"})," ","L\u01b0u t\u1ea1m"]}),(0,g.jsxs)(T.A,{className:"mr-2",size:"sm",color:"success",onClick:()=>D(m.value),children:[(0,g.jsx)(b.A,{fa:"save"})," ","Ho\xe0n th\xe0nh"]})]}),children:(0,g.jsxs)(y.A,{className:"tao-phieu-nhap-hang custom-modal modal-nhap-kho",children:[(0,g.jsx)(j.A,{md:c?"8":"12",className:"chi-tiet-nhap-hang",children:(0,g.jsx)(K,{ref:t,ID:o,data:d,handleChange:(e,t)=>{d[e]=t,h({...d})},toggleLDH:c,TongGiaTri:d.TongGiaTri||0,OnToggleLDH:()=>u(!c),OnAddDataChiTiet:e=>(e=>{h({...d,chiTiet:e})})(e)})}),(0,g.jsx)(j.A,{md:"4",className:c?"tim-kiem-san-pham show":"tim-kiem-san-pham hide",children:(0,g.jsx)(U,{ref:n,OnAddItem:e=>t.current.add(e),OnCheckExsist:e=>{}})})]})})},F=e=>{const{ID:t,data:n,TongGiaTri:i}=e,[l,s]=(0,a.useState)([]),[o,r]=(0,a.useState)([]);(0,a.useEffect)((()=>{t&&d()}),[t]),(0,a.useEffect)((()=>{r(l)}),[l]);const d=()=>{(0,S.Pq)(`ChiTietXuatHuys?$filter=XuatHuy_Id eq ${t}&$expand=DM_SanPhamDichVu,DM_DonViTinh`,"GET",null).then((e=>s(e.value.map(((e,t)=>({...e,TenSanPham:e.DM_SanPhamDichVu.TenSanPham,DonViTinh:e.DM_DonViTinh.Ten})))))).catch((e=>(0,v.a3)("Kh\xf4ng th\u1ec3 t\u1ea3i d\u1eef li\u1ec7u chi ti\u1ebft xu\u1ea5t h\u1ee7y","Th\xf4ng b\xe1o")))};return(0,g.jsxs)(D.A,{children:[(0,g.jsxs)(A.A,{children:[(0,g.jsx)("b",{children:"Chi ti\u1ebft phi\u1ebfu xu\u1ea5t h\xe0ng"}),(0,g.jsx)(R.A,{className:"mr-2",onSearch:e=>(e=>{let t=l.filter((t=>t.TenSanPham.toUpperCase().includes(e.toUpperCase().trim())));r(t)})(e)})]}),(0,g.jsxs)(w.A,{children:[(0,g.jsx)(G,{data:n,isDetail:!0,ID:t}),(0,g.jsxs)("table",{width:"100%",children:[(0,g.jsx)("thead",{children:(0,g.jsxs)("tr",{children:[(0,g.jsx)("td",{children:"STT"}),(0,g.jsx)("td",{children:"T\xean h\xe0ng"}),(0,g.jsx)("td",{children:"\u0110VT"}),(0,g.jsx)("td",{style:{width:150},children:"SL h\u1ee7y"}),(0,g.jsx)("td",{children:"Gi\xe1 v\u1ed1n"}),(0,g.jsx)("td",{children:"Gi\xe1 tr\u1ecb h\u1ee7y"})]})}),(0,g.jsx)("tbody",{children:o&&o.map(((e,t)=>(0,g.jsxs)("tr",{children:[(0,g.jsx)("td",{children:t+1}),(0,g.jsx)("td",{children:e.TenSanPham}),(0,g.jsx)("td",{children:e.DonViTinh}),(0,g.jsx)("td",{className:"text-right",children:(0,$.vv)(e.SoLuong)}),(0,g.jsx)("td",{children:(0,$.vv)(e.GiaVon)}),(0,g.jsx)("td",{children:(0,$.vv)(e.GiaTriHuy)})]},t)))})]})]}),(0,g.jsx)(N.A,{children:(0,g.jsx)(P.A,{label:"T\u1ed5ng gi\xe1 tr\u1ecb h\u1ee7y",value:i})})]})},q=e=>{const{open:t,onClose:n,ID:i}=e,[l,s]=(0,a.useState)({});(0,a.useEffect)((()=>{i&&o()}),[i]);const o=()=>{(0,S.Pq)(`XuatHuys(${i})`,"GET",null).then((e=>s({...l,...e}))).catch((e=>(0,v.a3)("Kh\xf4ng th\u1ec3 t\u1ea3i d\u1eef li\u1ec7u xu\u1ea5t h\u1ee7y","Th\xf4ng b\xe1o")))};return(0,g.jsx)(C.A,{className:"custom-modal",title:"Th\xf4ng tin phi\u1ebfu xu\u1ea5t h\u1ee7y",open:t,onClose:n,children:(0,g.jsx)(y.A,{className:"tao-phieu-nhap-hang custom-modal modal-nhap-kho",children:(0,g.jsx)(j.A,{md:"12",className:"chi-tiet-nhap-hang",children:(0,g.jsx)(F,{ID:i,data:l,TongGiaTri:l.TongGiaTri||0})})})})},O=a.createRef(),Q=()=>O.current&&O.current.onQueryChange(),Y=e=>{const[t,n]=(0,a.useState)(""),[i,u]=(0,a.useState)([]),[p,T]=(0,a.useState)(null),[y,j]=(0,a.useState)(null),[C,b]=(0,a.useState)(!1),[D,A]=(0,a.useState)(!1),[w,N]=(0,a.useState)(0),[k,$]=(0,a.useState)(0),[I,P]=(0,a.useState)(l.lg.MaTaiKhoan);(0,a.useEffect)((()=>{Q()}),[i]),(0,a.useLayoutEffect)((()=>{b(0!==w)}),[w]),(0,a.useEffect)((()=>{A(0!==k)}),[k]),(0,a.useEffect)((()=>{let e=[];e.push("IsDeleted ne true"),t&&e.push(`substringof('${t}', MaXuatHuy)`),p&&y&&e.push(`(NgayTao gt (datetime'${p}') and NgayTao lt (datetime'${y}'))`),I&&e.push(`NguoiTao eq '${I}'`),u([...e])}),[t,p,y,I]);return(0,g.jsxs)(o.A,{className:"Module-XH",children:[(0,g.jsxs)(r.A,{NoTabs:!0,PageBaoCao:!0,children:[(0,g.jsx)(d.A,{className:"mb-2",showDKD:!0,title:"T\xecm ki\u1ebfm",defaultValue:t,onKeyPress:e=>(e=>{13===e.charCode&&n(e.target.value)})(e),placeholder:"T\xecm ki\u1ebfm m\xe3 ch\u1ee9ng t\u1eeb"}),(0,g.jsx)(d.A,{className:"mb-2",type:"dropdown-list",title:"Ng\u01b0\u1eddi t\u1ea1o",placeholder:"Ch\u1ecdn ng\u01b0\u1eddi t\u1ea1o...",url:"TaiKhoans",where:`loai_tai_khoan eq 'don_vi' and IDDonVi eq '${l.lg.IDDonVi}' and SYS_DM_VaiTro/MaVaiTro eq 'dieuhanh' or SYS_DM_VaiTro/MaVaiTro eq 'ketoan' and TinhTrangHoatDong eq true`,valueField:"MaTaiKhoan",textField:"TenHienThi",value:I,onChange:e=>P(e)}),(0,g.jsx)(d.A,{className:"mb-2",title:"Th\u1eddi gian",type:"date-report",onChangeDate:(e,t,n)=>{T(t?(0,s.A)(t,"yyyy-MM-dd"):null),j(n?(0,s.A)(n,"yyyy-MM-dd")+"T23:59:59.000":null)},status:!0,defaultValueDate:x.Eb.ToanThoiGian})]}),(0,g.jsxs)(h.A,{NoTabs:!0,children:[(0,g.jsx)(c.A,{tableRef:O,title:"Danh s\xe1ch phi\u1ebfu xu\u1ea5t h\u1ee7y",url:"XuatHuys",columns:f,where:i.join(" and "),selectType:"withColumns",onAdd:{disabled:!1,onClick:(e,t)=>N(null)},onEdit:{disabled:e=>e.TrangThai===m.value,onClick:(e,t)=>N(t.Id)},onDelete:{onClick:(e,t)=>(0,v.A1)("B\u1ea1n ch\u1eafc ch\u1eafn mu\u1ed1n x\xf3a phi\u1ebfu xu\u1ea5t h\u1ee7y n\xe0y?","Th\xf4ng b\xe1o").then((()=>{return e=t.Id,void(0,S.Pq)(`XuatHuy/XoaXuatHuy?xuatHuy_Id=${e}`,"DELETE",null,!1).then((t=>{Q(),(0,v.nw)(`X\xf3a phi\u1ebfu xu\u1ea5t h\u1ee7y ${e} th\xe0nh c\xf4ng!`,"Th\xf4ng b\xe1o")})).catch((e=>(0,v.a3)(e.Message,"Th\xf4ng b\xe1o")));var e}))},onRowClick:(e,t)=>$(t.Id)}),C&&(0,g.jsx)(z,{ID:w,open:C,OnReloadTable:()=>Q(),onClose:()=>N(0)}),D&&(0,g.jsx)(q,{ID:k,open:D,onClose:()=>$(0)})]})]})};class W extends a.Component{constructor(e){super(e),this.state={}}render(){return(0,g.jsx)(a.Fragment,{children:l.b9.Kho_Id?(0,g.jsx)(Y,{CurrentKho:{Id:l.b9.Kho_Id,IsKhoTong:l.b9.IsKhoTong,DiemKinhDoanh_Id:l.b9.DiemKinhDoanhId}}):(0,g.jsx)(i.A,{color:"warning",children:"B\u1ea1n ch\u01b0a c\xf3 quy\u1ec1n s\u1eed d\u1ee5ng ch\u1ee9c n\u0103ng n\xe0y"})})}}}}]);