????
Current Path : C:/inetpub/vhost/sdoc.nextform.vn/www/assets/ |
Current File : C:/inetpub/vhost/sdoc.nextform.vn/www/assets/Index-34515fa2.js |
var pt=Object.defineProperty;var ft=(i,t,n)=>t in i?pt(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n;var M=(i,t,n)=>(ft(i,typeof t!="symbol"?t+"":t,n),n);import{P as $,R as te,r as s,y as Tt,F as z,j as e,i as y,z as ie,m as B,d as ue,C as _e,x as Ct,n as de,T as jt,X as yt,Y as lt}from"./index-727ccf4d.js";import{F as Qe}from"./FullScreenDialog-84a3de57.js";import{F as Q}from"./FontAwesome4-32fe4385.js";import{D as Ne}from"./DataTable-2f4d7f97.js";import{T as St}from"./TabsBasic-ac34a1aa.js";import{t as vt,m as Nt,_ as bt,B as A}from"./Button-9330b92c.js";import{T as oe}from"./Table-9bef8b1e.js";import{F as he}from"./FormGroup-74b8b50e.js";import{I as fe}from"./Input-ae2484bb.js";import{a as Ce}from"./Required-e4b19dca.js";import{b as Dt,S as It,I as rt,F as je}from"./DropdownList-ca18995c.js";import{u as kt,a as Ge,o as Ae,P as ct,c as Ke,C as re}from"./DialogCustomize-4c6977d9.js";import{I as dt}from"./IndexDetail-eec5aba6.js";import{E as me}from"./Empty-aeb908cf.js";import{E as _t}from"./EditPDF-c11840d6.js";import{I as pe}from"./InputNumber-dceb4c1c.js";import"./InputTime-0a0b65be.js";import{d as Me,B as ht,e as ut,b as ye,f as Ye}from"./DataSelect-00074039.js";import"./SelectPanelMulti-70ffdcea.js";import{C as Oe}from"./Card-8b4f40d9.js";import{C as mt}from"./CardBody-4a2e5616.js";import{a as $e,b as Ee,M as we}from"./SelectCustom-701e5fac.js";import{u as We}from"./UseHandleFormControl-d53e5bce.js";import{A as Se}from"./Alert-f0fd0c60.js";import{f as Et,S as wt,a as At,b as Mt}from"./SkeletonLinhVuc-40d935ae.js";import{columns as Bt}from"./Index-de659ae6.js";import"./Button-461c8cce.js";import{R as ve}from"./Row-4ad47f29.js";import{C as K}from"./Col-ed66bf37.js";import{F as Lt}from"./Form-2a8b127f.js";import{e as Pt,_ as xe,a as qe,d as Ze,b as et,l as tt}from"./useTheme-41684c89.js";import{w as Je,c as xt,a as Re}from"./capitalize-f7a57a5c.js";import{G as Gt}from"./Grow-80c3dd65.js";import{c as be}from"./createSvgIcon-a089baf7.js";import{I as Ot}from"./IconButton-8f71b464.js";import{B as nt}from"./index-3a5bff16.js";import"./BodyDialog-933f74b0.js";import"./debounce-b2775af4.js";import"./Transition-27f52f03.js";import"./OdataUtils-2c90172a.js";import"./Nav-12db6fea.js";import"./TextArea-56268c1b.js";import"./classCallCheck-22a738c0.js";import"./withStyles-da525f81.js";import"./possibleConstructorReturn-e4ffd6dd.js";import"./Dropdown-ab2dfbba.js";import"./Manager-0c2f0563.js";import"./ButtonDropdown-8c17a411.js";import"./DropdownToggle-56b088f2.js";import"./Popper-c8f432b9.js";import"./CardHeader-dcb844ec.js";import"./Collapse-da981db3.js";import"./index-0eaf7829.js";import"./TransitionGroup-273fc20b.js";import"./Fade-7cf1057f.js";import"./Badge-00b2c8d5.js";import"./ButtonBase-9568d0b0.js";var $t=["className","cssModule","tag"];function Ve(){return Ve=Object.assign?Object.assign.bind():function(i){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(i[a]=n[a])}return i},Ve.apply(this,arguments)}function Rt(i,t){if(i==null)return{};var n=Vt(i,t),a,l;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(i);for(l=0;l<o.length;l++)a=o[l],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(n[a]=i[a])}return n}function Vt(i,t){if(i==null)return{};var n={},a=Object.keys(i),l,o;for(o=0;o<a.length;o++)l=a[o],!(t.indexOf(l)>=0)&&(n[l]=i[l]);return n}var Ft={className:$.string,cssModule:$.object,tag:vt};function Fe(i){var t=i.className,n=i.cssModule,a=i.tag,l=a===void 0?"span":a,o=Rt(i,$t),d=Nt(bt(t,"input-group-text"),n);return te.createElement(l,Ve({},o,{className:d}))}Fe.propTypes=Ft;function st(i){return i.substring(2).toLowerCase()}function Ht(i){return document.documentElement.clientWidth<i.clientX||document.documentElement.clientHeight<i.clientY}function zt(i){var t=i.children,n=i.disableReactTree,a=n===void 0?!1:n,l=i.mouseEvent,o=l===void 0?"onClick":l,d=i.onClickAway,h=i.touchEvent,c=h===void 0?"onTouchEnd":h,r=s.useRef(!1),u=s.useRef(null),m=s.useRef(!1),j=s.useRef(!1);s.useEffect(function(){return setTimeout(function(){m.current=!0},0),function(){m.current=!1}},[]);var _=s.useCallback(function(k){u.current=Tt.findDOMNode(k)},[]),I=kt(t.ref,_),p=Ge(function(k){var E=j.current;if(j.current=!1,!(!m.current||!u.current||Ht(k))){if(r.current){r.current=!1;return}var N;if(k.composedPath)N=k.composedPath().indexOf(u.current)>-1;else{var L=Ae(u.current);N=!L.documentElement.contains(k.target)||u.current.contains(k.target)}!N&&(a||!E)&&d(k)}}),x=function(E){return function(N){j.current=!0;var L=t.props[E];L&&L(N)}},S={ref:I};return c!==!1&&(S[c]=x(c)),s.useEffect(function(){if(c!==!1){var k=st(c),E=Ae(u.current),N=function(){r.current=!0};return E.addEventListener(k,p),E.addEventListener("touchmove",N),function(){E.removeEventListener(k,p),E.removeEventListener("touchmove",N)}}},[p,c]),o!==!1&&(S[o]=x(o)),s.useEffect(function(){if(o!==!1){var k=st(o),E=Ae(u.current);return E.addEventListener(k,p),function(){E.removeEventListener(k,p)}}},[p,o]),s.createElement(s.Fragment,null,s.cloneElement(t,S))}var Qt=function(t){var n=t.palette.type==="light"?.8:.98,a=Pt(t.palette.background.default,n);return{root:z({},t.typography.body2,xe({color:t.palette.getContrastText(a),backgroundColor:a,display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",borderRadius:t.shape.borderRadius,flexGrow:1},t.breakpoints.up("sm"),{flexGrow:"initial",minWidth:288})),message:{padding:"8px 0"},action:{display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}}},Wt=s.forwardRef(function(t,n){var a=t.action,l=t.classes,o=t.className,d=t.message,h=t.role,c=h===void 0?"alert":h,r=qe(t,["action","classes","className","message","role"]);return s.createElement(ct,z({role:c,square:!0,elevation:6,className:xt(l.root,o),ref:n},r),s.createElement("div",{className:l.message},d),a?s.createElement("div",{className:l.action},a):null)});const qt=Je(Qt,{name:"MuiSnackbarContent"})(Wt);var Jt=function(t){var n={top:8},a={bottom:8},l={justifyContent:"flex-end"},o={justifyContent:"flex-start"},d={top:24},h={bottom:24},c={right:24},r={left:24},u={left:"50%",right:"auto",transform:"translateX(-50%)"};return{root:{zIndex:t.zIndex.snackbar,position:"fixed",display:"flex",left:8,right:8,justifyContent:"center",alignItems:"center"},anchorOriginTopCenter:z({},n,xe({},t.breakpoints.up("sm"),z({},d,u))),anchorOriginBottomCenter:z({},a,xe({},t.breakpoints.up("sm"),z({},h,u))),anchorOriginTopRight:z({},n,l,xe({},t.breakpoints.up("sm"),z({left:"auto"},d,c))),anchorOriginBottomRight:z({},a,l,xe({},t.breakpoints.up("sm"),z({left:"auto"},h,c))),anchorOriginTopLeft:z({},n,o,xe({},t.breakpoints.up("sm"),z({right:"auto"},d,r))),anchorOriginBottomLeft:z({},a,o,xe({},t.breakpoints.up("sm"),z({right:"auto"},h,r)))}},Xt=s.forwardRef(function(t,n){var a=t.action,l=t.anchorOrigin;l=l===void 0?{vertical:"bottom",horizontal:"center"}:l;var o=l.vertical,d=l.horizontal,h=t.autoHideDuration,c=h===void 0?null:h,r=t.children,u=t.classes,m=t.className,j=t.ClickAwayListenerProps,_=t.ContentProps,I=t.disableWindowBlurListener,p=I===void 0?!1:I,x=t.message,S=t.onClose,k=t.onEnter,E=t.onEntered,N=t.onEntering,L=t.onExit,T=t.onExited,G=t.onExiting,W=t.onMouseEnter,X=t.onMouseLeave,V=t.open,w=t.resumeHideDuration,F=t.TransitionComponent,R=F===void 0?Gt:F,q=t.transitionDuration,Y=q===void 0?{enter:Ze.enteringScreen,exit:Ze.leavingScreen}:q,Z=t.TransitionProps,le=qe(t,["action","anchorOrigin","autoHideDuration","children","classes","className","ClickAwayListenerProps","ContentProps","disableWindowBlurListener","message","onClose","onEnter","onEntered","onEntering","onExit","onExited","onExiting","onMouseEnter","onMouseLeave","open","resumeHideDuration","TransitionComponent","transitionDuration","TransitionProps"]),ee=s.useRef(),ne=s.useState(!0),se=ne[0],U=ne[1],J=Ge(function(){S&&S.apply(void 0,arguments)}),H=Ge(function(b){!S||b==null||(clearTimeout(ee.current),ee.current=setTimeout(function(){J(null,"timeout")},b))});s.useEffect(function(){return V&&H(c),function(){clearTimeout(ee.current)}},[V,c,H]);var g=function(){clearTimeout(ee.current)},D=s.useCallback(function(){c!=null&&H(w??c*.5)},[c,w,H]),P=function(ae){W&&W(ae),g()},C=function(ae){X&&X(ae),D()},v=function(ae){S&&S(ae,"clickaway")},f=function(){U(!0)},O=function(){U(!1)};return s.useEffect(function(){if(!p&&V)return window.addEventListener("focus",D),window.addEventListener("blur",g),function(){window.removeEventListener("focus",D),window.removeEventListener("blur",g)}},[p,D,V]),!V&&se?null:s.createElement(zt,z({onClickAway:v},j),s.createElement("div",z({className:xt(u.root,u["anchorOrigin".concat(Re(o)).concat(Re(d))],m),onMouseEnter:P,onMouseLeave:C,ref:n},le),s.createElement(R,z({appear:!0,in:V,onEnter:Ke(O,k),onEntered:E,onEntering:N,onExit:L,onExited:Ke(f,T),onExiting:G,timeout:Y,direction:o==="top"?"down":"up"},Z),r||s.createElement(qt,z({message:x,action:a},_)))))});const Ut=Je(Jt,{flip:!1,name:"MuiSnackbar"})(Xt),Kt=be(s.createElement("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"})),Yt=be(s.createElement("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"})),Zt=be(s.createElement("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"})),en=be(s.createElement("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"})),tn=be(s.createElement("path",{d:"M19 6.41L17.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"}));var nn=function(t){var n=t.palette.type==="light"?et:tt,a=t.palette.type==="light"?tt:et;return{root:z({},t.typography.body2,{borderRadius:t.shape.borderRadius,backgroundColor:"transparent",display:"flex",padding:"6px 16px"}),standardSuccess:{color:n(t.palette.success.main,.6),backgroundColor:a(t.palette.success.main,.9),"& $icon":{color:t.palette.success.main}},standardInfo:{color:n(t.palette.info.main,.6),backgroundColor:a(t.palette.info.main,.9),"& $icon":{color:t.palette.info.main}},standardWarning:{color:n(t.palette.warning.main,.6),backgroundColor:a(t.palette.warning.main,.9),"& $icon":{color:t.palette.warning.main}},standardError:{color:n(t.palette.error.main,.6),backgroundColor:a(t.palette.error.main,.9),"& $icon":{color:t.palette.error.main}},outlinedSuccess:{color:n(t.palette.success.main,.6),border:"1px solid ".concat(t.palette.success.main),"& $icon":{color:t.palette.success.main}},outlinedInfo:{color:n(t.palette.info.main,.6),border:"1px solid ".concat(t.palette.info.main),"& $icon":{color:t.palette.info.main}},outlinedWarning:{color:n(t.palette.warning.main,.6),border:"1px solid ".concat(t.palette.warning.main),"& $icon":{color:t.palette.warning.main}},outlinedError:{color:n(t.palette.error.main,.6),border:"1px solid ".concat(t.palette.error.main),"& $icon":{color:t.palette.error.main}},filledSuccess:{color:"#fff",fontWeight:t.typography.fontWeightMedium,backgroundColor:t.palette.success.main},filledInfo:{color:"#fff",fontWeight:t.typography.fontWeightMedium,backgroundColor:t.palette.info.main},filledWarning:{color:"#fff",fontWeight:t.typography.fontWeightMedium,backgroundColor:t.palette.warning.main},filledError:{color:"#fff",fontWeight:t.typography.fontWeightMedium,backgroundColor:t.palette.error.main},icon:{marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9},message:{padding:"8px 0"},action:{display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}}},at={success:s.createElement(Kt,{fontSize:"inherit"}),warning:s.createElement(Yt,{fontSize:"inherit"}),error:s.createElement(Zt,{fontSize:"inherit"}),info:s.createElement(en,{fontSize:"inherit"})},sn=s.createElement(tn,{fontSize:"small"}),an=s.forwardRef(function(t,n){var a=t.action,l=t.children,o=t.classes,d=t.className,h=t.closeText,c=h===void 0?"Close":h,r=t.color,u=t.icon,m=t.iconMapping,j=m===void 0?at:m,_=t.onClose,I=t.role,p=I===void 0?"alert":I,x=t.severity,S=x===void 0?"success":x,k=t.variant,E=k===void 0?"standard":k,N=qe(t,["action","children","classes","className","closeText","color","icon","iconMapping","onClose","role","severity","variant"]);return s.createElement(ct,z({role:p,square:!0,elevation:0,className:Dt(o.root,o["".concat(E).concat(Re(r||S))],d),ref:n},N),u!==!1?s.createElement("div",{className:o.icon},u||j[S]||at[S]):null,s.createElement("div",{className:o.message},l),a!=null?s.createElement("div",{className:o.action},a):null,a==null&&_?s.createElement("div",{className:o.action},s.createElement(Ot,{size:"small","aria-label":c,title:c,color:"inherit",onClick:_},sn)):null)});const on=Je(nn,{name:"MuiAlert"})(an);function Te({length:i=2,width:t=100,height:n=10}){return e.jsx("div",{style:{width:"100%"},children:Array.from(new Array(i).keys()).map((a,l)=>e.jsx(It,{animation:"wave",variant:"text",height:25},l))})}class gt extends s.Component{constructor(n){super(n);M(this,"loadNhomDonVi",()=>{y("RP_NhomDoiTuong","GET",null,!0).then(n=>{const a=[],l=this.props.lstDoiTuong.map(o=>o.NhomDoiTuong_Id);n.value.forEach(o=>{l.findIndex(h=>h===o.Id)===-1&&a.push(o)}),this.setState({lstNhomDonVi:a})})});M(this,"onSave",()=>{this.props.onSelectTypeUnit&&this.props.onSelectTypeUnit(this.state.lstSelected)});M(this,"onClose",()=>{this.props.onClose&&this.props.onClose()});M(this,"onSelected",(n,a)=>{const{lstSelected:l}=this.state,o=n.Id;if(a)this.setState({lstSelected:[...l,o]});else{const d=l.filter(h=>h!==n.Id);this.setState({lstSelected:d})}});M(this,"checkSelected",n=>this.state.lstSelected.findIndex(l=>l===n.Id)!==-1);this.state={lstNhomDonVi:[],lstSelected:[]}}componentDidMount(){this.loadNhomDonVi()}render(){const{lstNhomDonVi:n}=this.state;return e.jsxs("div",{className:"index-popup-add",children:[e.jsx("div",{className:"body-popup-add",children:e.jsxs(oe,{bordered:!0,size:"sm",hover:!0,children:[e.jsx("thead",{children:e.jsx("tr",{style:{background:"#B0E0E6"},children:e.jsx("th",{style:{textAlign:"center"},children:"Tên nhóm"})})}),e.jsx("tbody",{children:n.length?n.map((a,l)=>e.jsx("tr",{children:e.jsx("td",{children:e.jsx(he,{check:!0,children:e.jsxs(Ce,{check:!0,children:[e.jsx(fe,{type:"checkbox",name:"check",defaultChecked:this.checkSelected(a),onChange:o=>this.onSelected(a,o.target.checked)}),a.Name]})})})},l)):e.jsx(Te,{length:5})})]})}),e.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"},children:[e.jsx(A,{style:{marginRight:"10px"},color:"primary",onClick:()=>this.onSave(),children:"Lưu"}),e.jsx(A,{color:"danger",onClick:()=>this.onClose(),children:"Hủy"})]})]})}}function ln({reportCategoryId:i}){const[t,n]=s.useState(!1),[a,l]=s.useState([]),[o,d]=s.useState(!1),[h,c]=s.useState(null),[r,u]=s.useState(!1),m=s.useCallback(()=>{u(!0),y(`NhomDoiTuong/GetDoiTuongThucHienOfBaoCao?baoCaoId=${i}`,"GET",null,{odata:!1}).then(p=>{l(p.value),u(!1)}).catch(()=>u(!1))},[i]),j=p=>{y("DoiTuongThucHien","POST",JSON.stringify({BaoCao_Id:i,NhomDoiTuongIds:p}),{odata:!1}).then(()=>{m(),n(!1)})},_=p=>{y(`RP_DoiTuongThucHien(guid'${p.id}')`,"DELETE",null,!0).then(x=>{m()}).catch(x=>B(x.value))},I=p=>{d(!0),c(p)};return s.useEffect(()=>{m()},[m]),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"d-flex mb-4",children:[e.jsx("h6",{className:"mb-0",children:"Cơ quan thực hiện"}),e.jsx(A,{className:"icon icon-add py-1 ps-4 ms-auto",onClick:()=>n(!0),children:"Thêm mới"})]}),e.jsx("div",{style:{fontSize:"small"},className:"ntable-wrap text-center",children:e.jsxs(oe,{style:{verticalAlign:"middle"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:"#f1f1f1"},children:[e.jsx("th",{style:{width:"5%"},children:"Id"}),e.jsx("th",{children:"Tên nhóm"}),e.jsx("th",{children:"Tổng đơn vị"}),e.jsx("th",{style:{width:"10%"},children:"Thao tác"})]})}),e.jsx("tbody",{children:a.length?a.sort((p,x)=>p.NhomDoiTuong_Id<x.NhomDoiTuong_Id?-1:p-x).map((p,x)=>e.jsxs("tr",{style:{cursor:"pointer"},children:[e.jsx("td",{onClick:()=>{I(p)},children:p.NhomDoiTuong_Id}),e.jsx("td",{onClick:()=>{I(p)},children:p.TenNhomDoiTuong_Id}),e.jsx("td",{onClick:()=>{I(p)},children:p.SoDonViThuocNhomDoiTuong?p.SoDonViThuocNhomDoiTuong:"-"}),e.jsx("td",{children:e.jsx(A,{className:"icon icon-del",onClick:()=>ie("","Xác nhận xóa!").then(()=>{_(p)})})})]},x)):e.jsx("tr",{children:e.jsx("td",{colSpan:4,children:r?e.jsx(e.Fragment,{}):e.jsx(me,{size:"sm",text:"Chưa có dữ liệu"})})})})]})}),e.jsx(re,{open:t,handleClose:()=>{n(!1)},title:"Thêm mới đối tượng thực hiện",maxWidth:"md",children:e.jsx(gt,{lstDoiTuong:a,onSelectTypeUnit:j,onClose:()=>n(!1)})}),o&&e.jsx(dt,{nhomDoiTuongId:h.NhomDoiTuong_Id,Name:h.TenNhomDoiTuong_Id,open:o,onClose:()=>{d(!1),m()}})]})}const rn=te.createRef(),cn=[{title:"Id",field:"Id",dataID:!0,type:"guid",hidden:!0},{title:"STT",field:"STT",type:"numeric",dataCheck:!1,searchable:!0,cellStyle:{textAlign:"center"}},{title:"Tên mẫu báo cáo",field:"Name",type:"string",dataCheck:!0,searchable:!0},{title:"Tiêu đề",field:"TieuDe",type:"string",dataCheck:!0,searchable:!0},{title:"Mã báo cáo",field:"TieuDeCon",type:"string",dataCheck:!0,searchable:!0}];function dn({reportCategoryId:i}){const[t,n]=s.useState(!1),[a,l]=s.useState({});return e.jsxs("div",{className:"index-report-template-confi",children:[e.jsx("div",{className:"py-3 px-4",children:e.jsx(Ne,{tableRef:rn,title:"Danh sách mẫu báo cáo",url:"DM_MauBaoCao",where:`BaoCao_Id eq guid'${i}' and IsDeleted ne true&$orderby=Code asc`,columns:cn,selectType:"withColumns",onAdd:{disabled:!1,defaultValues:[{field:"BaoCao_Id",value:i}]},onEdit:{},onDelete:{},onActions:[{icon:"check",tooltip:"Cấu hình mẫu",onClick:(o,d)=>{l({mauBaoCaoId:d.Id,name:d.Name,reportCategoryId:i}),n(!0)}}]})}),e.jsx(_t,{title:a.name,open:t,IdMauBaoCao:a==null?void 0:a.mauBaoCaoId,onClose:()=>n(!1),reportTemplate:a})]})}function hn({reportCategoryId:i}){const[t,n]=s.useState(!1),[a,l]=s.useState([]),[o,d]=s.useState(!1),[h,c]=s.useState(null),[r,u]=s.useState(!1),m=s.useCallback(()=>{u(!0),y(`NhomDoiTuong/GetDoiTuongNhanOfBaoCao?baoCaoId=${i}`,"GET",null,{odata:!1}).then(x=>{l(x.value),u(!1)}).catch(()=>u(!1))},[i]),j=x=>{try{const S=[];x.forEach(k=>{const E={BaoCao_Id:i,NhomDoiTuong_Id:k};S.push(y("RP_DoiTuongNhan","POST",JSON.stringify(E),!0))}),Promise.all(S).then(k=>{m(),n(!1)})}catch{B("Đã xảy ra lỗi!")}},_=x=>{y(`RP_DoiTuongNhan(guid'${x.id}')`,"DELETE",null,!0).then(S=>{m()}).catch(S=>B(S.value))},I=x=>{d(!0),c(x)},p=(x,S)=>{x==="delete"?ie("","Xác nhận xóa!").then(()=>{_(S)}):x==="row"&&I(S)};return s.useEffect(()=>{m()},[m]),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"d-flex mb-4",children:[e.jsx("h6",{className:"mb-0",children:"Cơ quan nhận"}),e.jsx(A,{className:"icon icon-add py-1 ps-4 ms-auto",onClick:()=>n(!0),children:"Thêm mới"})]}),e.jsx("div",{style:{fontSize:"small"},className:"ntable-wrap text-center",children:e.jsxs(oe,{style:{verticalAlign:"middle"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:"#f1f1f1"},children:[e.jsx("th",{style:{textAlign:"center",width:"5%"},children:"STT"}),e.jsx("th",{style:{textAlign:"center"},children:"Tên nhóm"}),e.jsx("th",{style:{textAlign:"center"},children:"Tổng đơn vị"}),e.jsx("th",{style:{textAlign:"center",width:"10%"},children:"Thao tác"})]})}),e.jsx("tbody",{children:a.length?a.sort((x,S)=>x.NhomDoiTuong_Id<S.NhomDoiTuong_Id?-1:x-S).map((x,S)=>e.jsxs("tr",{style:{cursor:"pointer"},children:[e.jsx("td",{onClick:()=>{p("row",x)},style:{textAlign:"center"},children:S+1}),e.jsx("td",{onClick:()=>{p("row",x)},children:x.TenNhomDoiTuong_Id}),e.jsx("td",{onClick:()=>{p("row",x)},style:{textAlign:"center",width:"10%"},children:x.SoDonViThuocNhomDoiTuong?x.SoDonViThuocNhomDoiTuong:0}),e.jsx("td",{style:{textAlign:"center"},children:e.jsx(A,{className:"icon icon-del",onClick:()=>{p("delete",x)}})})]},S)):e.jsx("tr",{children:e.jsx("td",{colSpan:4,children:r?e.jsx(e.Fragment,{}):e.jsx(me,{size:"sm",text:"Chưa có dữ liệu"})})})})]})}),e.jsx(re,{open:t,handleClose:()=>{n(!1)},title:"Thêm mới đối tượng nhận",maxWidth:"md",children:e.jsx(gt,{lstDoiTuong:a,onSelectTypeUnit:j,onClose:()=>n(!1)})}),o&&e.jsx(dt,{nhomDoiTuongId:h.NhomDoiTuong_Id,Name:h.TenNhomDoiTuong_Id,open:o,onClose:()=>{d(!1),m()}})]})}const un=[{title:"Id",field:"Id",dataID:!0,hidden:!0,type:"guid"},{title:"STT",field:"STT",type:"numeric",searchable:!0,dataCheck:!0,cellStyle:{textAlign:"center"},defaultSort:"asc"},{title:"Tên quy trình",field:"TenQuyTrinh",type:"string",searchable:!0,dataCheck:!0,render:i=>e.jsxs("div",{className:"d-flex",children:[i.TenQuyTrinh,i.TongSoQT_NotFinish?e.jsxs("div",{style:{color:"#FFBB28",marginLeft:"10px"},children:[e.jsx(Q,{fa:"exclamation-triangle"})," ",i.TongSoQT_NotFinish," "]}):e.jsx(e.Fragment,{children:" "})]})},{title:"Chi tiết quy trình",field:"Tong_ChiTietQuyTrinh",type:"string",searchable:!0,dataCheck:!0,cellStyle:{textAlign:"center"}}],Be=ue.div` margin-bottom: 20px; font-weight: bold; `,mn=ue.span` position: relative; overflow: hidden; input.upload { position: absolute; top: 0; right: 0; margin: 0; padding: 0; font-size: 20px; cursor: pointer; opacity: 0; filter: alpha(opacity=0); } `,xn=ue(we)` max-width: 100%; `,gn=ue(oe)` thead tr th { vertical-align: middle; font-size: 12px; background-color: yellow; border: 1px solid #aaa; border-bottom: none; text-align: center; } tbody tr { td { font-size: 12px; border: 1px solid #aaa; vertical-align: middle; } } `,pn=ue(oe)` margin-bottom: 0px; thead tr th { vertical-align: middle; font-size: 12px; background-color: yellow; border: 1px solid #aaa; border-bottom: none; text-align: center; position: sticky; top: 0px; } tbody tr { td { font-size: 12px; border: 1px solid #aaa; vertical-align: middle; } } `;function fn(i){const{title:t,isClose:n,isOpen:a,zIndex:l,urldownload:o,urlPreImport:d,urlDelete:h,columnsImport:c,theadTableImport:r,urlImport:u,reloadData:m,BaoCao_Id:j,isNew:_}=i,[I,p]=s.useState(""),[x,S]=s.useState(null),[k,E]=s.useState(!1),[N,L]=s.useState([]),[T,G]=s.useState(!1),[W,X]=s.useState(0),[V,w]=s.useState([]),[F,R]=s.useState(!1),[q,Y]=s.useState([]),[Z,le]=s.useState([]),ee=s.useCallback(v=>{const f=v.target.files[0];p(f?f.name:""),S(f)},[]),ne=s.useCallback(()=>x?!0:(_e("Vui lòng chọn file trước khi import"),!1),[x]),se=s.useCallback(()=>u&&d?!0:(_e("Vui lòng thử lại sau!","Chức năng đang hoàn thiện"),!1),[u,d]),U=s.useCallback(()=>{S(null),p(""),E(!1),L([]),Y([]),n()},[n]),J=s.useCallback(async()=>{if(ne()&&se())if(x.name.split(".").pop()==="xlsx"){const f=new FormData;f.append("file",x),j&&f.append("BaoCao_Id",j.ID);const O=await Ct(d,"POST",f),b=O.filter(ce=>ce.Error),ae=O.filter(ce=>!ce.Error),Ue=O.filter(ce=>ce.GhiChu);w(ae),O.length===b.length?R(!0):R(!1),b.length?(X(b.length),E(!0),L(b)):Ue.length?(Y(Ue),le(O)):(y(u,"POST",JSON.stringify(O),{odata:!1}).then(ce=>{de("Import thành công").then(()=>{U(),m()})}).catch(ce=>B(ce,"Import lỗi")),E(!1),L([]),X(0))}else _e("Vui lòng chọn file .xlsx")},[ne,se,x,j,d,u,U,m]),H=s.useCallback(()=>{y(u,"POST",JSON.stringify(Z),{odata:!1}).then(v=>{de("Import thành công").then(()=>{U(),m()})}).catch(()=>B("Import lỗi","Không thành công")),E(!1),L([]),X(0)},[Z,U,m,u]),g=s.useCallback(()=>{G(!T)},[T]),D=s.useCallback(()=>{const v=V.map(f=>(delete f.MaChuong,delete f.MaNganhKinhTe,delete f.LoaiDuAn_Name,delete f.NhomDuAn_Name,delete f.NhomDuAn_Code,delete f.LoaiDuAn_Code,{...f}));y(u,"POST",JSON.stringify(v),{odata:!1}).then(f=>{de("Import thành công").then(()=>{n(),m()})}).catch(()=>B("Import lỗi","Không thành công"))},[V,n,m,u]),P=s.useMemo(()=>e.jsxs(xn,{size:"xl",isOpen:T,zIndex:l+1,toggle:g,children:[e.jsx($e,{children:"CHI TIẾT LỖI FILE EXCEL"}),e.jsxs(Ee,{children:[e.jsxs(gn,{size:"sm",bordered:!0,striped:!0,children:[r,e.jsx("tbody",{children:N.map((v,f)=>e.jsx("tr",{children:c&&c.length&&c.map((O,b)=>{const ae=v[O.field];return e.jsx("td",{className:O.align,children:O.render?O.render(v):ae},b)})},f))})]}),e.jsx("div",{className:"w-100 text-right",style:{color:"red",fontWeight:"bold"},children:"Vui lòng cập nhật file excel rồi sau đó import ạ"})]})]}),[T,g,N,l,c,r]),C=s.useCallback(()=>{ie("Bạn có chắc chắn muốn xóa dữ liệu không","THÔNG BÁO").then(v=>{v&&y(`${h}?baoCao_Id=${j.ID}`,"DELETE",null,{odata:!1}).then(()=>de("Xóa thành công").then(()=>m())).catch(f=>B("Xóa không thanh công"))})},[j,m,h]);return e.jsx(s.Fragment,{children:e.jsxs(we,{size:"xl",isOpen:a,zIndex:l,toggle:U,children:[e.jsx($e,{style:{textTransform:"uppercase"},children:t}),e.jsxs(Ee,{children:[_&&e.jsx(Se,{color:"warning",children:"Có mẫu excel mới vui lòng tải về mẫu này rồi import vào ạ"}),e.jsxs(Be,{className:"d-flex align-items-center",children:[e.jsxs("span",{style:{color:"#20a8d8"},className:"mr-2",children:["Bước 1:"," "]}),e.jsxs("span",{className:"d-flex align-items-center",children:["Tải về tập tin",e.jsxs("a",{className:"ml-1 mr-1",href:o?`/assets/FileMau/${o}`:"#",style:{color:"green"},children:[e.jsx(Q,{fa:"file-excel-o"}),e.jsxs("span",{className:"ml-1",children:["Excel mẫu ",e.jsx("span",{style:{color:"red"},children:_?"(mẫu mới)":""})]})]}),"và điền đầy đủ thông tin vào tập tin Excel vừa mới tải về"]})]}),e.jsxs(Be,{children:[e.jsxs("span",{style:{color:"#20a8d8"},className:"mr-1",children:["Bước 2:"," "]}),e.jsxs("span",{children:["Chọn tập tin Excel ",e.jsx("span",{style:{color:"#3ea662"},children:"(.xlsx)"})," đã điền đầy đủ thông tin"]}),e.jsx("div",{children:e.jsxs(rt,{children:[e.jsx(fe,{value:I,readOnly:!0,placeholder:"Chọn file..."}),e.jsxs(mn,{className:"btn btn-success",children:[e.jsxs("span",{className:"upl",id:"upload",children:[e.jsx(Q,{fa:"upload"}),e.jsx("span",{className:"ml-2",children:"Tải lên"})]}),e.jsx("input",{onChange:ee,accept:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",type:"file",className:"upload up",id:"up"})]})]})})]}),q.length===0&&e.jsxs(Be,{children:[e.jsxs("span",{style:{color:"#20a8d8"},className:"mr-1",children:["Bước 3:"," "]}),e.jsxs("span",{children:["Nhấn nút"," ",e.jsxs(A,{size:"sm",onClick:J,color:"success",children:[e.jsx(Q,{fa:"upload"}),e.jsx("span",{className:"ml-1",children:"IMPORT FILE"})]})," ","để import dữ liệu vào hệ thống"]})]}),h&&e.jsxs("div",{className:"d-flex align-items-center justify-content-between",style:{color:"darkorange",fontWeight:"bold"},children:[e.jsxs("span",{children:[e.jsx(Q,{fa:"exclamation-triangle"}),e.jsx("span",{className:"ml-1",children:"Lưu ý: Nếu trường hợp import sai dữ liệu của bảng, vui lòng xóa rồi thực lại các bước"})]}),e.jsxs(A,{onClick:C,color:"danger",size:"sm",children:[e.jsx(Q,{fa:"trash"}),e.jsx("span",{className:"ml-1",children:"Xóa dữ liệu"})]})]}),q.length?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pb-2 d-flex justify-content-between align-items-center",children:[e.jsx("span",{style:{color:"#20a8d8",fontWeight:"bold"},children:"Có thông tin cần được xác định"}),e.jsxs(A,{onClick:H,size:"sm",color:"success",children:[e.jsx(Q,{fa:"upload"}),e.jsx("span",{className:"ml-1",children:"Import vào hệ thống"})]})]}),e.jsx("div",{style:{height:"calc(100vh - 365px)",overflow:"auto"},children:e.jsxs(pn,{size:"sm",bordered:!0,striped:!0,children:[r,e.jsx("tbody",{children:q.map((v,f)=>e.jsx("tr",{children:c&&c.length&&c.map((O,b)=>{const ae=v[O.field];return e.jsx("td",{className:O.align,children:O.render?O.render(v):ae},b)})},f))})]})})]}):"",k&&e.jsxs("div",{className:"d-flex align-items-center justify-content-between",children:[e.jsxs(A,{onClick:()=>g(),className:"text-left",size:"sm",style:{color:"red",fontSize:15},children:["Có ",e.jsx("b",{style:{fontSize:20},children:W})," lỗi, Nhấn vào này để xem chi tiết"]}),e.jsx(A,{disabled:F,size:"sm",color:"primary",onClick:D,children:"Vẫn import những dòng dữ liệu không lỗi"})]})]}),P]})})}const Tn=ue.div` position: absolute; top: -12px; left: 12px; background-color: #fff; color: #374dc5; font-weight: bold; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; /* number of lines to show */ -webkit-box-orient: vertical; `,Cn=s.memo(i=>{const{label:t,onClick:n,selectedItem:a,dataSelect:l,valueDisplay:o,onDelete:d,placeholder:h,labelDelete:c,handelDeleteSelected:r}=i,u=ue(rt)` .input-group-text { transition: 0.3s linear; font-size: 12px; font-weight: bold; cursor: pointer; &:hover { opacity: 0.8; } } `,m=typeof d;return e.jsxs(u,{children:[e.jsx(fe,{value:a?a[l.selectColumn]:o||h||"Chưa chọn...",readOnly:!0}),e.jsx(Fe,{className:"bg-primary",style:{pointerEvents:l.disableSelect?"none":"auto",opacity:l.disableSelect?.65:1},onClick:n,children:t}),d&&e.jsx(Fe,{className:"bg-danger",style:{pointerEvents:l.disableSelect?"none":"auto",opacity:l.disableSelect?.65:1},onClick:m==="function"?d:r,children:c||"Xóa"})]})}),jn=s.memo(i=>{const{dataSelect:t,onClose:n,isOpen:a,setselectedItem:l,ableCRUD:o,maxWidth:d,isModal:h,toggleAdd:c,tableRef:r,toggleImport:u,isImport:m}=i,j=s.useRef([{title:"Id",field:"Id",type:"numeric",hidden:!0},{title:"Tên",field:"Name",type:"string"}]),_=ue(we)` max-width: ${i.maxWidth?i.maxWidth+"px":"inherit"} !important; .ntable { .search { top: 10px !important; left: 15px !important; } .ntable-wrap { .ntable-inner { height: calc(100vh - 200px); } } } `;return e.jsx(_,{maxWidth:d,size:"lg",isOpen:a,toggle:n,zIndex:t.zIndex||1301,children:e.jsx(Ee,{children:e.jsx(Ne,{title:t.title,tableRef:r,url:t.url,columns:t.columns||j,where:t.where,onAdd:h?{onClick:()=>c("add",null)}:o?{disabled:!1,defaultValues:t.defaultValues||[]}:null,onEdit:h?{onClick:(I,p)=>c("edit",p),hidden:!o}:o?{defaultValues:t.defaultValuesEdit||[]}:null,onDelete:o?{}:null,onActions:[{icon:"upload",tooltip:"Import",isFreeAction:!0,hidden:!m,onClick:()=>u()},{icon:"tag",tooltip:"Chọn",onClick:(I,p)=>{l(p),n()}}]})})})});function Xe(i){const{label:t,dataSelect:n,onCallback:a,ableCRUD:l,valueDisplay:o,onDelete:d,placeholder:h,labelDelete:c,onClickButton:r,maxWidth:u,isModal:m,isImport:j,isCheck:_}=i,[I,p]=s.useState(null),[x,S]=s.useState(!1),[k,E]=s.useState(!1),[N,L]=s.useState({}),[T,G]=s.useState(null),[W,X]=s.useState(!1),V=s.useRef(),w=s.useCallback(()=>V.current&&V.current.onQueryChange(),[]),F=s.useCallback(()=>{r&&r(),S(!x)},[r,x]),R=s.useCallback((J,H)=>{r&&r(),J==="add"?(G(null),L({})):J==="edit"?(G(H.Id),L({...H})):L({}),E(!k)},[k,r]),q=s.useCallback(()=>{r&&r(),X(!W)},[W,r]);s.useEffect(()=>{I&&a(I)},[I]);const{handleChange:Y,handleValidate:Z}=We(N,n.formAddModal,J=>L(J)),le=s.useCallback(async()=>{if(Z()){const J=_;let H=!1;const g=T?"PATCH":"POST",D=T?`${n.url}(guid'${T}')`:`${n.url}`,P=T?"Cập nhật thành công":"Thêm thành công";delete N.DM_Chuong,delete N.Dieu18_DM_LinhVuc,delete N.Id,delete N.TenChuong,delete N.tableData,N.DonVi_Id=jt.IDDonVi,Et(N),_&&!T&&(H=await y(`${J}`,"POST",JSON.stringify(N),{odata:!1}));const C=()=>y(D,g,JSON.stringify(N)).then(v=>{R(),w(),de(P)});H?ie("Bạn có muốn tiếp tục thêm vào dánh sách dự án",`Mã dự án ${N.MaDuAnDauTu} đã tồn tại trong danh sách dự án`).then(v=>{v.isConfirmed&&C()}):C()}},[Z,_,T,n.url,N,R,w]),ee=s.useMemo(()=>{if(n.formAddModal){const J=Object.values(n.formAddModal),H=g=>{var D;return g.type!=="popup-select"?N[g.field_name]:N[(D=g.popupSelect)==null?void 0:D.selectColumn]};return e.jsxs(we,{size:"lg",isOpen:k,zIndex:1301,toggle:R,children:[e.jsxs($e,{children:[e.jsx("span",{children:"Thêm mới dự án"}),e.jsxs("span",{className:"float-right",children:[e.jsxs(A,{className:"mr-2",color:"success",onClick:le,children:[e.jsx(Q,{fa:"save"}),e.jsx("span",{className:"ml-2",children:"Lưu"})]}),e.jsxs(A,{color:"danger",onClick:R,children:[e.jsx(Q,{fa:"times"}),e.jsx("span",{className:"ml-2",children:"Trở lại"})]})]})]}),e.jsx(Ee,{className:"pt-0",style:{height:"calc(100vh - 130px)",overflow:"auto"},children:J.map((g,D)=>e.jsxs(Oe,{className:"mt-4",children:[e.jsx(Tn,{title:g.title,children:g.title}),e.jsxs(mt,{onDragStart:P=>P.preventDefault(),className:"pt-3 pb-2",children:[e.jsx(je,{data:{...g,hidden_label:!0},value:H(g),onChange:(P,C)=>Y(P,C),inline:!1}),g.required&&e.jsxs("p",{className:"mb-0",children:[e.jsx("span",{style:{color:"red"},children:"(*)"})," Bắt buộc nhập"]})]})]},D))})]})}},[n.formAddModal,k,R,N,le]),ne=s.useMemo(()=>{const{urlImport:J,urlPreImport:H,columnsImport:g,theadTableImport:D,title:P,urldownload:C,isNew:v}=n;return e.jsx(fn,{zIndex:1301,urldownload:C,title:"Import "+P,isOpen:W,isClose:q,isNew:v,urlImport:J,urlPreImport:H,columnsImport:g,theadTableImport:D,reloadData:w})},[W,q,n,w]),se=s.useMemo(()=>x&&e.jsx(jn,{ableCRUD:l,isOpen:x,onClose:F,dataSelect:n,setselectedItem:p,maxWidth:u,isModal:m,isImport:j,toggleAdd:R,toggleImport:q,tableRef:V}),[l,n,m,u,x,F]),U=s.useCallback(()=>{p(null)},[]);return e.jsxs(te.Fragment,{children:[e.jsx(Cn,{label:t,onClick:F,onDelete:d,labelDelete:c,selectedItem:I,dataSelect:n,valueDisplay:o,placeholder:h,handelDeleteSelected:U}),se,ee,ne]})}Xe.propTypes={label:$.oneOfType([$.string,$.number,$.element]),dataSelect:$.shape({title:$.string,url:$.string.isRequired,where:$.string,columns:$.array,defaultValues:$.array,selectColumn:$.string.isRequired,disableSelect:$.bool}),onCallback:$.func.isRequired,className:$.shape({button:$.string,popup:$.string}),labelDelete:$.string,ableCRUD:$.bool,valueDisplay:$.string,placeholder:$.string,maxWidth:$.number};Xe.defaultProps={label:"Chọn",className:{},ableCRUD:!0};let yn=class extends s.Component{constructor(n){super(n);M(this,"handelOnSelected",(n,a)=>{this.setState({valueAdd:{...this.state.valueAdd,[n]:a}})});M(this,"loadDoiTuongGuis",()=>{y(`RP_DoiTuongThucHien?$expand=RP_NhomDoiTuong&$filter=BaoCao_Id eq guid'${this.props.BaoCao_Id}'`,"GET",null,!0).then(n=>{const{value:a}=n;let l=[];a.forEach(o=>{l.push(o.RP_NhomDoiTuong)}),this.setState({doiTuongThucHiens:l})})});M(this,"loadDoiTuongNhans",()=>{y(`RP_DoiTuongNhan?$expand=RP_NhomDoiTuong&$filter=BaoCao_Id eq guid'${this.props.BaoCao_Id}'`,"GET",null,!0).then(n=>{const{value:a}=n;let l=[];a.forEach(o=>{l.push(o.RP_NhomDoiTuong)}),this.setState({doiTuongNhans:l})})});M(this,"loadMauBaoCaos",()=>{y(`DM_MauBaoCao?$filter=BaoCao_Id eq guid'${this.props.BaoCao_Id}'`,"GET",null,!0).then(n=>{const{value:a}=n,l=a.sort((o,d)=>o.Code<d.Code?-1:o-d);this.setState({mauBaoCaos:l})})});M(this,"getIsDisableSave",n=>{const{QuyTrinh_Id:a,NhomDoiTuong_Nhan_Id:l,NhomDoiTuong_Gui_Id:o,MauBaoCao_Id:d}=n;return!(a&&l&&o&&d)});M(this,"onSave",()=>{const{valueAdd:n}=this.state,{lstQuyTrinh:a}=this.props;this.setState({relooad:!0}),this.props.flag==="add"?a.find(o=>o.DoiTuong_Gui_Id===n.NhomDoiTuong_Gui_Id&&o.DoiTuong_Nhan_Id===n.NhomDoiTuong_Nhan_Id&&o.MauBaoCao_Id===n.MauBaoCao_Id)?B("Đã tồn tại, không thể thêm!"):y("QuyTrinhThucHien/Insert","POST",JSON.stringify(n),{odata:!1}).then(()=>{this.setState({valueAdd:{}}),this.setState({relooad:!1}),this.props.onClose(),this.props.reloadList(),this.props.reloadReportProcess()}).catch(o=>{B(o.Message?o.Message:"Đã xảy ra lỗi chưa thể thêm mới!"),this.setState({relooad:!1})}):this.props.flag==="update"&&y(`RP_ChiTietQuyTrinh(guid'${this.props.quyTrinh.Id}')`,"PATCH",JSON.stringify(n),!0).then(()=>{this.setState({valueAdd:{}}),this.props.onClose(),this.props.reloadList(),this.setState({relooad:!1})}).catch(l=>{B(l.Message?l.Message:"Đã xảy ra lỗi chưa thể cập nhật!"),this.setState({relooad:!1})})});this.state={doiTuongThucHiens:[],doiTuongNhans:[],mauBaoCaos:[],valueAdd:{},ChiTietQuyTrinh_Id:null,relooad:!1}}componentDidMount(){this.loadDoiTuongGuis(),this.loadDoiTuongNhans(),this.loadMauBaoCaos(),this.props.quyTrinh?this.setState({valueAdd:{QuyTrinh_Id:this.props.QuyTrinh_Id,NhomDoiTuong_Nhan_Id:this.props.quyTrinh.NhomDoiTuong_Nhan_Id,MauBaoCao_Id:this.props.quyTrinh.MauBaoCao_Id,NhomDoiTuong_Gui_Id:this.props.quyTrinh.NhomDoiTuong_Gui_Id}}):this.setState({valueAdd:{QuyTrinh_Id:this.props.QuyTrinh_Id}})}render(){const{open:n,onClose:a,quyTrinh:l}=this.props,{doiTuongThucHiens:o,mauBaoCaos:d,doiTuongNhans:h,valueAdd:c}=this.state;return e.jsx("div",{className:"index-create-detail-report-process",children:e.jsx(re,{title:l?"Cập nhật chi tiết quy trình":"Thêm mới chi tiết quy trình",open:n,handleClose:a,maxWidth:"md",children:e.jsxs(Lt,{style:{height:"175px"},children:[e.jsx(Se,{color:"warning",children:"Đối tượng gửi và nhận phải có ít nhất 1 đơn vị!"}),e.jsxs(ve,{form:!0,children:[e.jsx(K,{md:4,children:e.jsxs(he,{children:[e.jsx(Ce,{children:"Đối tượng gửi"}),o.length?e.jsx(Me,{name:"doiTuongThucHien",options:o,menuPosition:"fixed",className:"cus-select",placeholder:e.jsx("div",{style:{fontSize:"13px"},children:"Chọn đối tượng gửi"}),onChange:r=>this.handelOnSelected("NhomDoiTuong_Gui_Id",r.Id),getOptionValue:r=>r,defaultValue:o.find(r=>r.Id===c.NhomDoiTuong_Gui_Id),getOptionLabel:r=>r.Name}):e.jsx(Se,{color:"warning",children:"Chưa có đối tượng gửi!"})]})}),e.jsx(K,{md:4,children:e.jsxs(he,{children:[e.jsx(Ce,{children:"Mẫu báo cáo"}),d.length?e.jsx(Me,{name:"mauBaoCaos",options:d,menuPosition:"fixed",className:"cus-select",placeholder:e.jsx("div",{style:{fontSize:"13px"},children:"Chọn mẫu báo cáo"}),onChange:r=>this.handelOnSelected("MauBaoCao_Id",r.Id),getOptionValue:r=>r,defaultValue:d.find(r=>r.Id===c.MauBaoCao_Id),getOptionLabel:r=>r.Name}):e.jsx(Se,{color:"warning",children:"Chưa có mẫu báo cáo!"})]})}),e.jsx(K,{md:4,children:e.jsxs(he,{children:[e.jsx(Ce,{children:"Đối tượng nhận"}),h.length?e.jsx(Me,{name:"doiTuongNhan",options:h,menuPosition:"fixed",className:"cus-select",placeholder:e.jsx("div",{style:{fontSize:"13px"},children:"Chọn đối tượng nhận"}),onChange:r=>this.handelOnSelected("NhomDoiTuong_Nhan_Id",r.Id),getOptionValue:r=>r,defaultValue:h.find(r=>r.Id===c.NhomDoiTuong_Nhan_Id),getOptionLabel:r=>r.Name}):e.jsx(Se,{color:"warning",children:"Chưa có đối tượng nhận!"})]})})]}),e.jsxs("div",{className:"btn-footer",style:{display:"flex",justifyContent:"flex-end",width:"100%"},children:[e.jsxs(A,{onClick:()=>this.onSave(),disabled:this.state.relooad,color:"primary",size:"sm",style:{marginRight:"10px"},children:[e.jsx(Q,{fa:"save"})," Lưu"]}),e.jsxs(A,{onClick:()=>this.props.onClose(),color:"danger",size:"sm",children:[e.jsx(Q,{fa:"window-close"})," Hủy"]})]})]})})})}};const Sn=[{field:"Id",dataID:!0,type:"guid",hidden:!0},{title:"Id đơn vị",field:"SYS_DonVi.ID",type:"guid",hidden:!0},{title:"Mã đơn vị",field:"SYS_DonVi.MaDonVi",type:"string",dataCheck:!0,searchable:!0,defaultSort:"asc"},{title:"Tên đơn vị",field:"SYS_DonVi.TenDonVi",type:"string",dataCheck:!0,searchable:!0}],He=te.createRef(),vn=()=>He.current&&He.current.onQueryChange(),Nn="RP_NhomDoiTuong_DonVi?$expand=SYS_DonVi&$select=SYS_DonVi/STT,SYS_DonVi/MaDonVi,SYS_DonVi/TenDonVi";function bn(i){const[t,n]=s.useState([]),[a,l]=s.useState({}),[o,d]=s.useState(!1),h=u=>{i.onSelectedDonVi&&i.onSelectedDonVi(u)},c=s.useCallback(()=>{d(!0),y(`RP_DoiTuongNhan?$filter=BaoCao_Id eq guid'${i.BaoCao_Id}'&$expand=RP_NhomDoiTuong`).then(u=>{const{value:m}=u,j=[];m.forEach(_=>{j.push(_.RP_NhomDoiTuong)}),n(j),d(!1)}).catch(()=>d(!1))},[i.BaoCao_Id]),r=u=>{l(u),vn()};return s.useEffect(()=>{c()},[c]),e.jsxs("div",{className:"index-lst-don-vi",children:[e.jsxs("div",{className:"left box-shadown-cus",children:[e.jsx("div",{className:"title",children:"Lọc danh sách nhóm đơn vị"}),e.jsx("div",{style:{height:"400px",overflow:"auto",paddingTop:"1px"},children:t.length?t.map((u,m)=>e.jsx("div",{className:"lst-nhom-doi-tuong",children:e.jsx(he,{check:!0,children:e.jsxs(Ce,{check:!0,children:[e.jsx(fe,{type:"radio",name:"radio1",onChange:()=>{r(u)}})," ",u.Name]})})},m)):e.jsx(e.Fragment,{children:o?e.jsx(Te,{length:5}):e.jsx(me,{size:"sm",text:"Chưa có dữ liệu"})})})]}),e.jsx("div",{className:"right box-shadown-cus",children:e.jsx(Ne,{tableRef:He,title:"Danh sách đơn vị",url:Nn,where:`NhomDoiTuong_Id eq ${a.Id?a.Id:null}`,columns:Sn,selectType:"withColumns",onActions:[{icon:"check",tooltip:"Chọn",onClick:(u,m)=>h(m)}]})})]})}const Dn="RP_ChiTietGuiNhan",In="QuanLyReport/ThemChiTietQuyTrinh";function kn(i){const{reloadData:t,lstThongTinGuiNhan:n,quyTrinhId:a}=i,[l,o]=s.useState(),[d,h]=s.useState(!1),[c,r]=s.useState(null),[u,m]=s.useState({}),[j,_]=s.useState({}),I=T=>{o(!1);const G={DonVi_Nhan_Id:T.SYS_DonVi.ID,IsFinish:!0},W=n.slice(),X=n.findIndex(V=>V.Id===c.Id);X!==-1&&y(`RP_ChiTietGuiNhan(guid'${c.Id}')`,"PATCH",JSON.stringify(G)).then(()=>{W[X]={...W[X],DonViNhan:T.SYS_DonVi.TenDonVi,MaDonViNhan:T.SYS_DonVi.MaDonVi},i.onUpdateLstGuiNhan(W)}).catch(()=>B("Lỗi!"))},p=T=>{r(T),o(!0)},x=T=>T.MaDonViGui?e.jsxs(e.Fragment,{children:[" ",T.MaDonViGui," - ",T.DonViGui," "]}):e.jsx("div",{className:"alert alert-warning",style:{marginBottom:0,padding:0},children:"Chưa xác định đơn vị gửi"}),S=()=>{h(!0)},k=s.useCallback(()=>{y(`${In}?maDvGui=${u}&maDvNhan=${j}&ChiTietQuyTrinh_Id=${a}`,"POST",null,!1).then(()=>{de("Thêm thành công","THÔNG BÁO"),i.onClose(),t()}).catch(T=>B("Không tìm thấy đơn vị","THÔNG BÁO"))},[u,j,i,a,t]),E=T=>{T.Id&&ie("Bạn chắc chắn muốn xóa?","Thông báo").then(()=>{yt(`${Dn}(guid'${T.Id}')`,"DELETE",null).then(G=>{i.onClose(),t()}).catch(G=>B("Xóa dữ liệu không thành công"),"Thông báo")})},N=s.useCallback(()=>{y(`QuyTrinh/XoaDonViKhongThucHien?chiTietQuyTrinh_Id=${a}`,"DELETE",null,{odata:!1}).then(T=>{de("Xóa thành công","THÔNG BÁO"),i.onClose(),t()}).catch(T=>B("Xóa dữ liệu không thành công"),"Thông báo")},[i,a,t]),L=s.useCallback((T,G)=>{y(`RP_ChiTietGuiNhan(guid'${G}')`,"PATCH",JSON.stringify({IsThucHien:T})).then(()=>t())},[t]);return e.jsxs("div",{className:"index-thong-tin-gui-nhan",children:[e.jsxs(re,{className:"quy-trinh-thong-tin-gui-nhan",title:"Thông tin gửi nhận",open:i.open,handleClose:i.onClose,maxWidth:"md",children:[e.jsx(ve,{children:d?e.jsx(te.Fragment,{children:e.jsxs(e.Fragment,{children:[e.jsx(K,{md:"5",children:e.jsx(pe,{placeholder:"Nhập mã đơn vị gửi",onChange:T=>m(T.target.value)})}),e.jsx(K,{md:"5",children:e.jsx(pe,{placeholder:"Nhập mã đơn vị nhận",onChange:T=>_(T.target.value)})}),e.jsxs(K,{md:"2",style:{display:"flex",justifyContent:"flex-end"},children:[e.jsx(ht,{size:"sm",onClick:()=>k(),children:"Lưu"}),e.jsx(ut,{onClick:()=>h(!1),children:"Đóng"})]})]})}):e.jsxs(K,{style:{display:"flex",justifyContent:"flex-end"},children:[e.jsx(A,{className:"me-2",color:"danger",size:"sm",onClick:()=>ie("Bạn chắc chắn muốn xóa tất cả dòng không có đơn vị nhận?","Xác nhận xóa!").then(()=>{N(a)}),children:"Xóa tất cả dòng chưa cài đặt"}),e.jsx(A,{color:"success",onClick:()=>S(),size:"sm",children:"Thêm đơn vị gửi nhận"})]})}),e.jsxs(oe,{bordered:!0,size:"sm",children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:"#B0E0E6"},children:[e.jsx("th",{style:{textAlign:"center"},children:"Đơn vị gửi "}),e.jsx("th",{style:{textAlign:"center"},children:"Đơn vị nhận"}),e.jsx("th",{style:{textAlign:"center"},children:"Thực hiện"}),e.jsx("th",{style:{textAlign:"center"},width:"100",children:"Thao tác"})]})}),e.jsx("tbody",{children:i.lstThongTinGuiNhan?i.lstThongTinGuiNhan.sort((T,G)=>T.MaDonViGui&&T.MaDonViGui.split(".")[2]<G.MaDonViGui.split(".")[2]?-1:T-G).map((T,G)=>e.jsxs("tr",{children:[e.jsx("td",{style:{verticalAlign:"middle"},children:x(T)}),e.jsx("td",{children:T.DonViNhan?e.jsxs("div",{className:"d-flex",children:[e.jsxs("div",{style:{width:"90%"},children:[T.MaDonViNhan," - ",T.DonViNhan]}),e.jsx("div",{style:{width:"10%"},children:e.jsx(ye,{color:"info",icon:"edit",title:"cập nhật",onClick:()=>{p(T)}})})]}):e.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:[e.jsx("div",{className:"alert alert-warning",style:{marginBottom:0,padding:0},children:"Chưa xác định đơn vị nhận"}),e.jsx(ye,{color:"info",icon:"edit",title:"cập nhật",onClick:()=>{p(T)}})]})}),e.jsx("td",{className:"text-center",children:e.jsx("input",{type:"checkbox",style:{width:"10rem"},defaultChecked:T.IsThucHien,onChange:W=>L(W.target.checked,T.Id)})}),e.jsx("td",{className:"text-center",children:e.jsx(ye,{size:"sm",color:"danger",icon:"trash",onClick:()=>{E(T)},title:"Xóa"})})]},G)):e.jsx(Te,{length:5})})]})]}),e.jsx(re,{title:"Danh sách đơn vị",open:l,handleClose:()=>o(!1),maxWidth:"lg",children:e.jsx(bn,{BaoCao_Id:i.BaoCao_Id,onSelectedDonVi:I})})]})}const De=[{ThangGui:12,STT:9},{ThangGui:2,STT:1},{ThangGui:3,STT:2},{ThangGui:4,STT:3},{ThangGui:5,STT:4},{ThangGui:6,STT:5},{ThangGui:7,STT:6},{ThangGui:8,STT:7},{ThangGui:9,STT:8}],_n=({listQuyTrinh:i,reload:t})=>{const[n,a]=s.useState(!1),l=()=>{ie("Bạn có chắc chắn khởi tạo tần suất mặc định!","THÔNG BÁO").then(()=>{a(!0),i.forEach(o=>{var h;let d=0;(h=o==null?void 0:o.ChiTietQuyTrinh_TanSuat)==null||h.Model.forEach((c,r)=>{y(`RP_ChiTietQuyTrinh_TanSuat(guid'${c.Id}')`,"PATCH",JSON.stringify({NgayGui:"5",ThangGui:`${De[r].ThangGui}`,IsFinish:!0,IsThucHien:!0,IsNamSau:!1,STT:`${De[r].STT}`,Name:`Báo cáo ${De[r].ThangGui===12?"năm":`tháng ${De[r].ThangGui}`}`})).then(()=>{d++,d===9&&t(),d===9&&a(!1)})})})})};return e.jsx(e.Fragment,{children:e.jsxs(A,{disabled:n,onClick:l,className:"btn-auto-cteate-frequency",children:[n?e.jsx(wt,{color:"light",size:"sm",children:"Loading..."}):e.jsx(Q,{fa:"steam-square"}),"Khởi tạo tần suất mặc định"]})})},it=()=>{let i=[];for(let t=1;t<=31;t++)i.push({label:`Ngày ${t}`,value:`${t}`});return i},ot=()=>{let i=[];for(var t=1;t<=12;t++)i.push({value:`${t}`,label:`Tháng ${t}`});return i},En="RP_ChiTietQuyTrinh_TanSuat";function wn(i){const{open:t,onClose:n,lstQuyTrinh:a,mauBaoCao:l,isSkeleton:o,reloadTable:d,reloadTableParent:h}=i,[c,r]=s.useState(!1),[u,m]=s.useState({}),[j,_]=s.useState({}),[I,p]=s.useState({}),[x,S]=s.useState({}),[k,E]=s.useState(!1),[N,L]=s.useState({}),[T,G]=s.useState(!1),[W,X]=s.useState({isOpen:!1}),V=C=>{X({isOpen:!0,message:C})},w=s.useCallback(C=>{V({type:"success",text:C})},[]),F=s.useCallback(C=>{V({type:"error",text:C})},[]),R=()=>X({isOpen:!1}),{isOpen:q,message:Y}=W,Z=(C,v)=>{L(f=>({...f,[C]:v}))},le=()=>{r(!0)},ee=s.useCallback(C=>{E(C)},[]),ne=C=>!!C,se=C=>!!C,U=s.useCallback(C=>{S(C),L(v=>{const{ThoiHanGui:{NgayGui:f,ThangGui:O}}=C;return{...v,objNgayGui:{label:`Ngày ${f}`,value:f},objThangGui:{label:`Tháng ${O}`,value:O}}}),E(!1),G(!0)},[]),J=s.useCallback(()=>{let C={ChiTietQuyTrinh_Id:u,TanSuat_Id:j,LanSo:parseInt(I)};y(`${En}`,"POST",JSON.stringify(C)).then(()=>{w("Thêm thành công"),n()}).catch(v=>F("Không thêm được tần suất"))},[F,n,u,I,w,j]),H=s.useCallback(()=>{const{objNgayGui:C,objThangGui:v}=N,f={NgayGui:C.value,ThangGui:v.value,IsFinish:!0,IsThucHien:!0,IsNamSau:k};f.NgayGui?y(`RP_ChiTietQuyTrinh_TanSuat(guid'${x.Id}')`,"PATCH",JSON.stringify(f)).then(()=>{w("Thành công!"),d(),h(),G(!1)}).catch(()=>{F("Thất bại!")}):_e("Vui lòng chọn ngày gửi thực hiện!")},[x.Id,F,k,d,h,w,N]),g=s.useCallback((C,v)=>{y(`RP_ChiTietQuyTrinh_TanSuat(guid'${C.Id}')`,"PATCH",JSON.stringify({IsThucHien:v}),!0).then(f=>{d()})},[d]),D=s.useCallback((C,v)=>{y(`RP_ChiTietQuyTrinh_TanSuat(guid'${C.Id}')`,"PATCH",JSON.stringify({Name:v})).then(()=>{w("Cập nhật thành công"),d(),h()}).catch(()=>{F("Thất bại")})},[F,d,h,w]),P=s.useCallback((C,v)=>{y(`RP_ChiTietQuyTrinh_TanSuat(guid'${C.Id}')`,"PATCH",JSON.stringify({STT:v})).then(()=>{w("Cập nhật thành công"),d(),h()}).catch(()=>{F("Thất bại")})},[F,d,h,w]);return e.jsx("div",{children:e.jsx(re,{title:`Cài đặt tần suất - ${l}`,open:t,handleClose:n,maxWidth:"xl",children:e.jsx(Oe,{style:{border:"0"},children:e.jsxs(mt,{children:[e.jsx(ve,{children:c?e.jsxs(te.Fragment,{children:[e.jsx(K,{md:"3",children:e.jsx(pe,{placeholder:"Nhập id quy trình",onChange:C=>m(C.target.value)})}),e.jsx(K,{md:"3",children:e.jsx(pe,{placeholder:"Nhập id tần suất",onChange:C=>_(C.target.value)})}),e.jsx(K,{md:"3",children:e.jsx(pe,{placeholder:"Nhập số lần",onChange:C=>p(C.target.value)})}),e.jsxs(K,{md:"3",style:{display:"flex",justifyContent:"flex-end"},children:[e.jsx(ht,{size:"sm",onClick:()=>J(),children:"Lưu"}),e.jsx(ut,{onClick:()=>r(!1),children:"Đóng"})]})]}):e.jsxs("div",{className:"d-flex justify-content-end gap-3 mb-4",children:[e.jsx(_n,{listQuyTrinh:a,reload:()=>{w("Thành công!"),d(),h()}}),e.jsxs(A,{color:"success",onClick:()=>le(),children:[e.jsx("i",{className:"fa fa-plus"})," Thêm tần suất"]})]})}),a.length?a.sort((C,v)=>C.DoiTuong_Gui_Id<v.DoiTuong_Gui_Id?-1:C-v).map((C,v)=>e.jsx(te.Fragment,{children:e.jsx(Oe,{style:{border:"0"},children:e.jsx("div",{className:"d-flex justify-content-center",children:e.jsxs(oe,{bordered:!0,size:"sm",children:[e.jsx("thead",{children:e.jsxs("tr",{style:{fontWeight:"500",background:"aliceblue"},children:[e.jsx("td",{style:{width:"5%",textAlign:"center"},children:"Thực hiện"}),e.jsx("td",{style:{width:"5%",textAlign:"center"},children:"STT"}),e.jsx("td",{style:{width:"40%",textAlign:"center"},children:"Tần suất"}),e.jsx("td",{style:{width:"5%",textAlign:"center"},children:"Lần gửi"}),e.jsx("td",{style:{width:"40%",textAlign:"center"},children:"Thời gian gửi"}),e.jsx("td",{style:{width:"10%",textAlign:"center"},children:"Thao tác"})]})}),e.jsx("tbody",{children:C.ChiTietQuyTrinh_TanSuat.Model&&C.ChiTietQuyTrinh_TanSuat.Model.sort(lt("STT","asc")).map((f,O)=>e.jsxs("tr",{children:[e.jsx("td",{style:{textAlign:"center",color:"#FFBB28"},children:f.ThoiHanGui.NgayGui?e.jsx(he,{check:!0,children:e.jsx(fe,{type:"checkbox",name:"check",defaultChecked:ne(f.IsThucHien),onChange:b=>g(f,b.target.checked)})}):e.jsx(Q,{fa:"exclamation-triangle"})}),e.jsx("td",{children:e.jsx(pe,{style:{textAlign:"center"},placeholder:"STT",defaultValue:f.STT,onBlur:b=>P(f,b.target.value)})}),e.jsx("td",{children:e.jsxs(ve,{children:[e.jsx(K,{md:"5",children:f.TenTanSuat}),e.jsx(K,{md:"7",children:e.jsx(pe,{placeholder:"Nhập tần suất",defaultValue:f.TieuDeTanSuat,onBlur:b=>D(f,b.target.value)})})]})}),e.jsx("td",{style:{textAlign:"center"},children:f.LanSo}),f.IsThucHien===!1?e.jsx("td",{colSpan:2,style:{textAlign:"center"},children:e.jsx("div",{className:"alert alert-warning",style:{marginBottom:0,padding:0},children:"Không thực hiện!"})}):e.jsxs(e.Fragment,{children:[e.jsx("td",{children:T&&f.Id===x.Id?e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("div",{style:{width:"30%",marginRight:"10px"},children:e.jsx(Ye,{name:"ngayGui",options:it(),value:N.objNgayGui,className:"cus-select",placeholder:e.jsx("div",{style:{fontSize:"13px"},children:"Chọn ngày"}),onChange:b=>Z("objNgayGui",b),getOptionValue:b=>b,defaultValue:it().find(b=>b.value===f.NgayGui),getOptionLabel:b=>b.label})}),e.jsx("div",{style:{width:"30%",marginRight:"10px"},children:e.jsx(Ye,{name:"doiTuongThucHien",options:ot(),value:N.objThangGui,className:"cus-select",placeholder:e.jsx("div",{style:{fontSize:"13px"},children:"Chọn tháng"}),onChange:b=>Z("objThangGui",b),getOptionValue:b=>b,defaultValue:ot().find(b=>b.value===f.ThangGui),getOptionLabel:b=>b.label})}),e.jsx(he,{check:!0,children:e.jsxs(Ce,{check:!0,children:[e.jsx(fe,{type:"checkbox",name:"check",defaultChecked:se(f.IsNamSau),onChange:b=>ee(b.target.checked)}),"Năm sau"]})})]}):f.ThoiHanGui.NgayGui?`Trước ngày ${f.ThoiHanGui.NgayGui?f.ThoiHanGui.NgayGui:e.jsx("div",{style:{color:"#FFBB28"},children:e.jsx(Q,{fa:"exclamation-triangle"})})} tháng ${f.ThoiHanGui.ThangGui?f.ThoiHanGui.ThangGui:"-"} ${se(f.IsNamSau)?"Năm sau":""}`:e.jsxs("div",{style:{color:"#FFBB28",display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(Q,{fa:"exclamation-triangle"}),e.jsx("div",{className:"alert alert-warning",style:{marginBottom:0,padding:0},children:"Chưa cài đặt thời gian"})]})}),e.jsx("td",{style:{textAlign:"center"},children:T&&f.Id===x.Id?e.jsxs(e.Fragment,{children:[e.jsx(ye,{color:"success",icon:"save",onClick:()=>H(),title:"Lưu"}),e.jsx(ye,{color:"danger",icon:"close",onClick:()=>G(!1),title:"Xóa"})]}):e.jsx(ye,{color:"primary",icon:"edit",onClick:()=>U(f),title:"Sửa"})})]})]},`${v}.${O}`))})]})})})},v)):e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:o?e.jsx(Te,{length:5}):e.jsx(me,{size:"sm",text:"Chưa có dữ liệu"})})}),Y&&e.jsx(Ut,{open:q,autoHideDuration:6e3,onClose:R,children:e.jsx(on,{elevation:6,variant:"filled",onClose:R,severity:Y.type,children:Y.text})})]})})})})}function An({QuyTrinh_Id:i,reloadTableReportProcess:t,BaoCao_Id:n}){const[a,l]=s.useState([]),[o,d]=s.useState([]),[h,c]=s.useState([]),[r,u]=s.useState([]),[m,j]=s.useState(!1),[_,I]=s.useState(!1),[p,x]=s.useState(!1),[S,k]=s.useState(!1),[E,N]=s.useState(null),[L,T]=s.useState(null),[G,W]=s.useState(null),[X,V]=s.useState(""),w=s.useCallback(()=>{j(!0),y(`Reports/GetChiTietQuyTrinh?QuyTrinh_Id=${i}`,"GET",null,{odata:!1}).then(g=>{l(g.value),j(!1)}).catch(()=>j(!1))},[i]),F=s.useCallback(()=>{y("RP_NhomDoiTuong","GET",null,!0).then(g=>{d(g.value);const D=g.value.filter(P=>P.Id===`${i}`);u(D)})},[i]);s.useEffect(()=>{w(),F()},[w,F]),s.useCallback(g=>{const D=o.find(P=>P.Id===g);return D?D.Name:""},[o]);const R=s.useCallback(()=>{w()},[w]),q=s.useCallback(()=>{t&&t()},[t]),Y=s.useCallback(g=>{y(`RP_ChiTietQuyTrinh(guid'${g}')`,"DELETE",null,!0).then(()=>{R(),q()}).catch(D=>B(D?D.Massage:"Dữ liệu đã có liên kết, không thể xóa!"))},[R,q]),Z=s.useCallback((g,D)=>{x(!0),c(g),N(D);const P=g.sort(lt("DonViNhan","asc"));c(P)},[]),le=s.useCallback((g,D,P)=>{k(!0),N(D);const C=a.filter(v=>v.Id===`${D}`);u(C),V(P)},[a]),ee=s.useCallback(()=>{k(!1)},[]),ne=s.useCallback(()=>{x(!1)},[]),se=s.useCallback(()=>{},[]),U=s.useCallback(g=>{c(g),R(),q()},[R,q]),J=s.useCallback(g=>{y(`RP_ChiTietQuyTrinh(guid'${g}')`,"PATCH",JSON.stringify({PhongBanTiepNhan_Id:null}),!0).then(()=>w()).catch(D=>B(D.Message?D.Message:"Đã xảy ra lỗi chưa thể cập nhật!"))},[w]),H=a.length&&a.find(g=>g.IsChonPhongBan);return e.jsxs("div",{className:"index-chi-tiet-quy-trinh p-4 rounded",children:[e.jsxs("div",{className:"d-flex mb-4",children:[e.jsx("h6",{className:"mb-0",children:"Cơ quan nhận"}),e.jsx(A,{className:"icon icon-add py-1 ps-4 ms-auto",onClick:()=>{I(!0),T(null),W("add")},children:"Thêm mới"})]}),e.jsx("div",{style:{fontSize:"small"},className:"ntable-wrap text-center",children:e.jsxs(oe,{style:{verticalAlign:"middle",fontWeight:500},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:"#f1f1f1"},children:[e.jsx("th",{style:{textAlign:"center",width:"5%"},children:"STT"}),e.jsx("th",{children:"Id"}),e.jsx("th",{style:{textAlign:"center",width:"35%"},children:"Đối tượng gửi"}),e.jsx("th",{style:{textAlign:"center",width:"20%"},children:"Đối tượng nhận"}),e.jsx("th",{style:{textAlign:"center",width:"20%"},children:"Mẫu báo cáo"}),H&&e.jsx("th",{style:{textAlign:"center",width:"35%"},children:"Phòng ban"}),e.jsx("th",{style:{textAlign:"center",width:"10%"},children:"Thao tác"})]})}),e.jsx("tbody",{children:a.length?a.sort((g,D)=>g.DoiTuong_Gui_Id<D.DoiTuong_Gui_Id?-1:g-D).map((g,D)=>e.jsxs(te.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{rowSpan:2,className:"display-center",style:{width:"5%"},children:D+1}),e.jsx("td",{children:g.Id}),e.jsxs("td",{style:{verticalAlign:"middle"},children:[e.jsxs("div",{children:[" ",g.DoiTuong_Gui," "]}),e.jsxs("div",{className:"d-flex justify-content-around mt-3",children:[e.jsxs("div",{className:"thong-tin-don-vi",onClick:()=>{Z(g.ChiTietGuiNhan.Model,g.Id)},children:[e.jsx(Q,{fa:"stack-overflow"}),"Có ",g.ChiTietGuiNhan.Model.length," đơn vị cần thực hiện báo cáo"]}),e.jsxs("div",{className:"thong-tin-don-vi",onClick:()=>{le(g.ChiTietGuiNhan.Model,g.Id,g.MauBaoCao)},children:[e.jsx(Q,{fa:"safari"}),"Cài đặt tần suất"]}),(g.ChiTietGuiNhan.TongSoQT_NotFinish||g.ChiTietGuiNhan.Model.length===0)&&e.jsxs("div",{className:"error",children:[e.jsx(Q,{fa:"exclamation-triangle"})," ",g.ChiTietGuiNhan.TongSoQT_NotFinish," "]})]})]}),e.jsx("td",{style:{verticalAlign:"middle",background:"antiquewhite"},children:g.DoiTuongNhan}),e.jsx("td",{style:{verticalAlign:"middle",background:"antiquewhite"},children:g.MauBaoCao}),g.IsChonPhongBan&&e.jsx("td",{style:{verticalAlign:"middle",background:"antiquewhite"},children:e.jsx(Xe,{valueDisplay:g.TenPhongBanTiepNhan,label:"Chọn",dataSelect:{url:"DM_PhongBan",title:"Danh sách phòng ban",columns:Bt,selectColumn:"TenPhongBan"},onCallback:P=>P&&se(g.Id,P.Id),onDelete:()=>J(g.Id),labelDelete:"Không chọn"})}),e.jsx("td",{className:"display-center",style:{width:"5%",background:"antiquewhite"},children:e.jsx(A,{className:"icon icon-del",onClick:()=>ie("","Xác nhận xóa!").then(()=>{Y(g.Id)})})})]}),e.jsx("tr",{})]},D)):e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:m?e.jsx(Te,{length:5}):e.jsx(me,{size:"sm",text:"Chưa có dữ liệu"})})})})]})}),_&&e.jsx(yn,{quyTrinh:L,BaoCao_Id:n,QuyTrinh_Id:i,lstQuyTrinh:a,open:_,flag:G,onClose:()=>I(!1),reloadList:()=>R(),reloadReportProcess:()=>q()}),e.jsx(kn,{BaoCao_Id:n,open:p,reloadData:w,onClose:()=>{ne()},quyTrinhId:E,lstThongTinGuiNhan:h,onUpdateLstGuiNhan:g=>U(g)}),e.jsx(wn,{BaoCao_Id:n,open:S,reloadData:w,onClose:()=>{ee()},isSkeleton:m,lstQuyTrinh:a,mauBaoCao:X,IdQuyTrinh:E,reloadTable:R,reloadTableParent:q})]})}const Le={STT:{field_name:"STT",title:"STT:",type:"textbox",required:!0},Name:{field_name:"Name",title:"Tên quy trình:",type:"textbox",required:!0}};function Mn({quyTrinh:i,open:t,reloadTable:n,flag:a,onClose:l,BaoCao_Id:o}){const[d,h]=s.useState({BaoCao_Id:o}),{handleChange:c,handleValidate:r}=We(d,Le,I=>h(I));s.useEffect(()=>{i&&u()},[i]);const u=()=>{y(`DM_QuyTrinh(guid'${i.Id}')`,"GET",null).then(I=>h(I)).catch(()=>{B("Lỗi!")})},m=()=>{y("DM_QuyTrinh","POST",JSON.stringify(d)).then(()=>{n(),l()}).catch(()=>{B("Lỗi!")})},j=()=>{y(`DM_QuyTrinh(guid'${d.Id}')`,"PATCH",JSON.stringify(d)).then(()=>{n(),l()}).catch(()=>{B("Lỗi!")})},_=()=>{r()&&(a==="update"?j():m())};return e.jsx("div",{children:e.jsxs(re,{title:`${a==="add"?"Thêm mới quy trình":"Cập nhật quy trình"}`,open:t,handleClose:l,maxWidth:"sm",children:[e.jsx(ve,{children:e.jsxs(K,{children:[e.jsx(je,{value:d.STT,data:Le.STT,onChange:c}),e.jsx(je,{value:d.Name,data:Le.Name,onChange:c})]})}),e.jsx("div",{style:{textAlign:"end"},children:e.jsxs(A,{onClick:()=>{_()},color:"primary",children:[" ","Lưu"," "]})})]})})}const ze=te.createRef(),Pe=()=>ze.current&&ze.current.onQueryChange();function Bn({reportCategoryId:i,reloadParent:t}){const[n,a]=s.useState(!1),[l,o]=s.useState({}),[d,h]=s.useState(!1),[c,r]=s.useState(null),u=p=>{o(p),a(!0)},m=()=>{h(!0),o(null),r("add")},j=p=>{h(!0),o(p),r("update")},_=p=>{ie("","Xác nhận xóa").then(x=>{y(`DM_QuyTrinh(guid'${p.Id}')`,"DELETE",null,!0).then(()=>Pe()).catch(S=>B(S.value))})},I=()=>{Pe(),t()};return e.jsxs("div",{className:"index-report-process",children:[e.jsx("div",{className:"py-3 px-4",children:e.jsx(Ne,{title:"Đối tượng nhận báo cáo",tableRef:ze,urlExt:"Reports/GetQuyTrinhCuaBaoBao",where:`BaoCao_Id=${i}`,columns:un,selectType:"withColumns",onAdd:{onClick:(p,x)=>m()},onEdit:{onClick:(p,x)=>j(x)},onDelete:{onClick:(p,x)=>_(x)},onRowClick:(p,x)=>u(x),search:!1})}),d&&e.jsx(Mn,{quyTrinh:l,BaoCao_Id:i,open:d,onClose:()=>{h(!1)},reloadTable:Pe,flag:c}),n&&e.jsx(Qe,{open:n,title:`Quy trình: ${l.TenQuyTrinh}`,onClose:()=>a(!1),children:e.jsx(An,{reloadTableReportProcess:()=>I(),BaoCao_Id:i,QuyTrinh_Id:l.Id})})]})}class Ln extends s.Component{constructor(n){super(n);M(this,"onSave",()=>{this.props.onSelectFrequency&&this.props.onSelectFrequency(this.state.lstSelected)});M(this,"onClose",()=>{this.props.onClose&&this.props.onClose()});M(this,"loadBaoCaoTanSuat",()=>{y("DM_TanSuat","GET",null,!0).then(n=>{const a=[],l=this.props.lstTanSuat.map(o=>o.DM_TanSuat.Id);n.value.forEach(o=>{l.findIndex(h=>h===o.Id)===-1&&a.push(o)}),this.setState({lstTanSuat:a})})});M(this,"onSelected",(n,a)=>{const{lstSelected:l}=this.state,o=n.Id;if(a)this.setState({lstSelected:[...l,o]});else{const d=l.filter(h=>h!==n.Id);this.setState({lstSelected:d})}});M(this,"checkSelected",n=>this.state.lstSelected.findIndex(l=>l===n.Id)!==-1);this.state={lstTanSuat:[],lstSelected:[]}}componentDidMount(){this.loadBaoCaoTanSuat()}render(){const{lstTanSuat:n}=this.state;return e.jsxs("div",{className:"index-popup-add",children:[e.jsxs(oe,{bordered:!0,size:"sm",hover:!0,children:[e.jsx("thead",{children:e.jsx("tr",{style:{background:"#B0E0E6"},children:e.jsx("th",{style:{textAlign:"center"},children:"Tần suất báo cáo"})})}),e.jsx("tbody",{children:n.length?n.map((a,l)=>e.jsx("tr",{children:e.jsx("td",{children:e.jsxs(he,{check:!0,children:[e.jsx(fe,{type:"checkbox",name:"check",defaultChecked:this.checkSelected(a),onChange:o=>this.onSelected(a,o.target.checked)}),a.Name]})})},l)):e.jsx("tr",{children:e.jsx("td",{children:e.jsx(Te,{length:5})})})})]}),e.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"},children:[e.jsx(A,{style:{marginRight:"10px"},color:"primary",onClick:()=>this.onSave(),children:"Lưu"}),e.jsx(A,{color:"danger",onClick:()=>this.onClose(),children:"Hủy"})]})]})}}function Pn({reportCategoryId:i}){const[t,n]=s.useState(!1),[a,l]=s.useState([]),[o,d]=s.useState(!1),h=s.useCallback(()=>{d(!0),y(`RP_BaoCao_TanSuat?$expand=DM_TanSuat&$filter=BaoCao_Id eq guid'${i}'`).then(u=>{l(u.value),d(!1)}).catch(()=>d(!1))},[i]),c=u=>{try{const m=[];u.forEach(j=>{const _={BaoCao_Id:i,TanSuat_Id:j};m.push(y("RP_BaoCao_TanSuat","POST",JSON.stringify(_),!0))}),Promise.all(m).then(j=>{h(),n(!1)})}catch{B("Đã xảy ra lỗi!")}};s.useEffect(()=>{h()},[h]);const r=u=>{y(`RP_BaoCao_TanSuat(guid'${u.Id}')`,"DELETE",null,!0).then(m=>{h()}).catch(m=>B(m.value))};return e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"d-flex justify-content-end mb-4",children:[e.jsx("h6",{className:"mb-0",children:"Cài đặt tần suất"}),e.jsx(A,{className:"icon icon-add py-1 ps-4 ms-auto",onClick:()=>n(!0),children:"Thêm mới"})]}),e.jsx("div",{style:{fontSize:"small"},className:"ntable-wrap text-center",children:e.jsxs(oe,{style:{verticalAlign:"middle"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:"#f1f1f1"},children:[e.jsx("th",{style:{textAlign:"center",width:"5%"},children:"STT"}),e.jsx("th",{style:{textAlign:"center",width:"30%"},children:"Id"}),e.jsx("th",{style:{textAlign:"center"},children:"Tần suất báo cáo"}),e.jsx("th",{style:{textAlign:"center",width:"10%"},children:"Số lần thực hiện"}),e.jsx("th",{style:{textAlign:"center",width:"10%"},children:"Thao tác"})]})}),e.jsx("tbody",{children:a.length?a.sort((u,m)=>u.DM_TanSuat.STT<m.DM_TanSuat.STT?-1:u-m).map((u,m)=>e.jsxs("tr",{children:[e.jsx("td",{style:{textAlign:"center"},children:m+1}),e.jsx("td",{style:{textAlign:"center"},children:u.TanSuat_Id}),e.jsx("td",{children:u.DM_TanSuat.Name}),e.jsx("td",{style:{textAlign:"center"},children:u.DM_TanSuat.SoLanGui}),e.jsx("td",{style:{textAlign:"center"},children:e.jsx(A,{className:"icon icon-del",onClick:()=>ie("","Xác nhận xóa!").then(()=>{r(u)})})})]},m)):e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:o?e.jsx(e.Fragment,{}):e.jsx(me,{size:"sm",text:"Chưa có dữ liệu"})})})})]})}),e.jsx(re,{open:t,handleClose:()=>{n(!1)},title:"Cài đặt",maxWidth:"md",children:e.jsx(Ln,{onSelectFrequency:c,lstTanSuat:a,onClose:()=>n(!1)})})]})}class Gn extends s.Component{constructor(t){super(t),this.state={}}render(){const{reportCategoryId:t,reloadParent:n}=this.props;return e.jsx("div",{className:"index-report-detail",children:e.jsx(St,{data:[{TabName:"Cơ quan thực hiện",TabContent:e.jsx("div",{children:e.jsx(ln,{reportCategoryId:t})})},{TabName:"Cơ quan nhận",TabContent:e.jsx(hn,{reportCategoryId:t})},{TabName:"Mẫu báo cáo",TabContent:e.jsx(dn,{reportCategoryId:t})},{TabName:"Cài đặt tần suất",TabContent:e.jsx(Pn,{reportCategoryId:t})},{TabName:"Quy trình thực hiện",TabContent:e.jsx(Bn,{reloadParent:()=>n(),reportCategoryId:t})}]})})}}const Ie={STT:{field_name:"STT",title:"STT",type:"textbox",required:!0},Name:{field_name:"Name",title:"Tên báo cáo",type:"textbox",required:!0},Route:{field_name:"Route",title:"Trang liên kết",type:"data-select",dataSelect:{url:"ChucNangs",value_field:"Url",text_field:"TenChucNang",text_field_sub:"Url",placeholder:"Chọn Trang",required:!0},required:!0}};function On({Id:i,open:t,reloadTable:n,onClose:a,LinhVuc_Id:l}){const[o,d]=s.useState({}),{handleChange:h,handleValidate:c}=We(o,Ie,j=>d(j)),r=s.useCallback(()=>{i&&y(`DM_BaoCao(guid'${i}')`,"GET",null).then(j=>d(j)).catch(j=>B("Không thể tải dữ liệu mẫu báo cáo","Thông báo"))},[i]);s.useEffect(()=>{r()},[r]);const u=s.useCallback(()=>{if(c()){const j={...o,LinhVuc_Id:l,IsOption:!0};let _=i?`DM_BaoCao(guid'${i}')`:"DM_BaoCao",I=i?"PATCH":"POST",p=i?"Lưu thành công":"Cập nhật thành công",x=i?"Lưu không thành công":"Cập nhật không thành công";y(_,I,JSON.stringify(j)).then(()=>{n(),de(p,"Thông báo"),a()}).catch(()=>B(x,"Thông báo"))}},[i,l,o,c,a,n]),m=s.useMemo(()=>i?"Thêm mới báo cáo":"Cập nhật báo cáo",[i]);return e.jsx("div",{className:"index-create-bao-cao",children:e.jsxs(re,{title:m,open:t,handleClose:a,maxWidth:"sm",children:[e.jsx(je,{data:Ie.STT,value:o.STT,onChange:h}),e.jsx(je,{data:Ie.Name,value:o.Name,onChange:h}),e.jsx(je,{data:Ie.Route,value:o==null?void 0:o.Route,onChange:h}),e.jsx("div",{style:{textAlign:"end"},children:e.jsx(A,{onClick:()=>{u()},color:"primary",children:"Lưu"})})]})})}const $n=i=>{const t=new Date(i).getDate(),n=new Date(i).getMonth()+1,a=new Date(i).getFullYear();return`Ngày ${t||"-"} tháng ${n||"-"} năm ${a||"-"}`};function Rn({open:i}){const[t,n]=s.useState(!1),[a,l]=s.useState([]),o=s.useCallback(()=>{n(!0),y("Reports/GetLichDi","GET",null,{odata:!1}).then(h=>{l(h),n(!1)}).catch(()=>n(!1))},[]);s.useEffect(()=>{i&&o()},[o,i]);const d=h=>{let c=0;return h&&(c=1),h.BaoCaos.length&&h.BaoCaos.forEach(r=>{c+=1,r.MauBaoCaos.length&&r.MauBaoCaos.forEach(u=>c+=1)}),c};return e.jsx("div",{className:"index-all-bao-cao",children:e.jsxs(oe,{bordered:!0,size:"sm",cellPadding:"20",children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:"#B0E0E6",textAlign:"center"},children:[e.jsx("th",{style:{width:100},children:"STT"}),e.jsx("th",{style:{width:"20%"},children:"Tên mẫu"}),e.jsx("th",{children:"Lĩnh vực"}),e.jsx("th",{children:"Tần suất"}),e.jsx("th",{children:"Lần thứ"}),e.jsx("th",{children:"Đơn vị nhận"}),e.jsx("th",{children:"Thời hạn"})]})}),e.jsx("tbody",{children:a.length?a.map((h,c)=>e.jsxs(te.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{rowSpan:d(h),style:{verticalAlign:"middle",textAlign:"center"},children:c+1}),e.jsx("td",{style:{background:"aquamarine",fontWeight:"500",color:"#000",fontSize:15},colSpan:7,children:$n(h.Ngay)})]}),h.BaoCaos.sort((r,u)=>r.STT>u.STT?-1:r-u).map((r,u)=>e.jsxs(te.Fragment,{children:[e.jsx("tr",{style:{fontSize:"13px"},children:e.jsx("td",{style:{background:"bisque",fontWeight:"500",color:"#000",fontSize:14,verticalAlign:"middle"},colSpan:"6",title:r.TenBaoCao,children:r.TenBaoCao})}),r.MauBaoCaos.length&&r.MauBaoCaos.map((m,j)=>e.jsxs("tr",{children:[e.jsx("td",{style:{verticalAlign:"middle"},children:m.TenMau}),e.jsx("td",{style:{verticalAlign:"middle"},children:m.TenLinhVuc}),e.jsx("td",{style:{verticalAlign:"middle"},children:m.TenTanSuat}),e.jsx("td",{style:{textAlign:"center",verticalAlign:"middle"},children:m.LanSo}),e.jsx("td",{style:{verticalAlign:"middle"},children:m.DV_Nhan}),e.jsxs("td",{style:{verticalAlign:"middle"},children:[!m.Id&&e.jsx(At,{value:m.SoNgayDenHan})," "]})]},`${u}-${j}`))]},`${c}-${u}`))]},c)):e.jsx(e.Fragment,{children:e.jsx("tr",{children:e.jsx("td",{colSpan:8,children:t?e.jsx(Te,{length:5}):e.jsx(me,{size:"sm",text:"Chưa có dữ liệu"})})})})})]})})}class Vn extends s.Component{constructor(n){super(n);M(this,"getBackground",n=>{if(n==="bc-di")return"bg-di";if(n==="bc-den")return"bg-den"});M(this,"getMargin",n=>n==="bc-di"||n==="bc-den"?"10px":"");M(this,"getColor",n=>n==="bc-di"?"":n==="bc-den"?"white":"");M(this,"handleChange",(n,a)=>{this.setState({SelectedId:n,SelectedName:a}),this.props.onChange&&this.props.onChange(n,a)});M(this,"checkShow",(n,a)=>n?!!n:!!a);this.state={SelectedId:null,SelectedName:null,openDialog:!1,tabIndex:0,isEditData:!1,editTemplate:!0,isLichBaoCao:!1}}render(){let{SelectedId:n,SelectedName:a}=this.state;const{data:l,displayCount:o,isAnTenLinhVuc:d,loadDataLinhVuc:h}=this.props;return n?e.jsxs("div",{className:"select-linh-vuc",children:[d?e.jsx(e.Fragment,{}):e.jsx(e.Fragment,{children:e.jsx(nt,{onBack:()=>this.setState({SelectedId:null,SelectedName:null},()=>h&&h()),listItem:[this.props.title,a]})}),this.props.children]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"select-linh-vuc",children:[e.jsxs("div",{className:"title-cus",children:[e.jsx(nt,{listItem:[this.props.title]}),this.props.isLichDi?e.jsxs("div",{className:"ml-3",children:[e.jsxs(A,{size:"sm",color:"primary",onClick:()=>{this.setState({isLichBaoCao:!0})},children:[e.jsx(Q,{fa:"calendar"})," Lịch báo cáo"]})," "]}):""]}),e.jsx("div",{className:"list-danh-muc-bao-cao",children:l&&l.map((c,r)=>e.jsxs("div",{onClick:()=>{this.handleChange(c.Id,c.Name)},className:"item-danh-muc-bao-cao",children:[e.jsx("div",{className:"div-fake-1"}),e.jsx("div",{className:"div-fake-2"}),e.jsx("img",{src:"/assets/icon-danh-muc-bc.png",alt:""}),e.jsxs("div",{className:"body-danh-muc-bao-cao",children:[e.jsx("img",{className:"img-avt",src:"/assets/profile-w.jpg",alt:""}),e.jsxs("div",{children:[e.jsx("div",{className:"name",children:c.Name}),e.jsxs("div",{className:"d-flex flex-column",children:[o!==!1&&e.jsxs("div",{className:"count",children:[e.jsx("i",{className:"fa fa-bookmark"})," ",c.TongSoDM_BaoCao," báo cáo"]}),c.TongSoQT_Finish&&e.jsxs("div",{className:"success",children:[e.jsx("i",{className:"fa fa-check"})," ",c.TongSoQT_Finish," quy trình đã hoàn thành"]}),c.TongSoQT_NotFinish&&e.jsxs("div",{className:"warning no-border",children:[e.jsx("i",{className:"fa fa-exclamation-triangle"})," ",c.TongSoQT_NotFinish," quy trình chưa hoàn thành"]}),c.SoLuongBaoCaoDenHan&&e.jsxs("div",{className:"warning",children:[e.jsx("i",{className:"fa fa-bell"})," ",c.SoLuongBaoCaoDenHan," báo cáo sắp đến hạn"]}),c.SoLuongBaoCaoTreHan&&e.jsxs("div",{className:"error",children:[e.jsx("i",{className:"fa fa-exclamation-triangle"})," ",c.SoLuongBaoCaoTreHan," báo cáo trễ hạn"]}),c.SoLuongBaoCaoChoDuyet&&e.jsxs("div",{className:"warning",children:[e.jsx("i",{className:"fa fa-exclamation-triangle"})," ",c.SoLuongBaoCaoChoDuyet," báo cáo chờ tiếp nhận"]}),c.SoLuongBaoCaoTuChoi&&e.jsxs("div",{className:"danger",children:[e.jsx("i",{className:"fa fa-exclamation-triangle"})," ",c.SoLuongBaoCaoTuChoi," báo cáo bị từ chối"]})]})]})]})]},r))})]}),e.jsx(Qe,{title:"Danh sách tất cả báo cáo",open:this.state.isLichBaoCao,onClose:()=>this.setState({isLichBaoCao:!1}),children:e.jsx(Rn,{open:this.state.isLichBaoCao})})]})}}const Fn=[{field:"Id",dataID:!0,type:"guid"},{title:"STT",field:"STT",type:"numeric",dataCheck:!0,defaultSort:"asc",cellStyle:{textAlign:"center"}},{title:"Tên báo cáo",field:"Name",type:"string",dataCheck:!0,searchable:!0,render:i=>e.jsxs("div",{className:"d-flex",children:[i.Name,i.TongSoQT_NotFinish?e.jsxs("div",{style:{color:"#FFBB28",marginLeft:"10px"},children:[e.jsx(Q,{fa:"exclamation-triangle"})," ",i.TongSoQT_NotFinish," "]}):e.jsx(e.Fragment,{children:" "})]})},{title:"Đối tượng thực hiện",field:"Tong_DoiTuongThucHien",editable:"never",cellStyle:{textAlign:"center"}},{title:"Đối tượng nhận",field:"Tong_DoiTuongNhan",editable:"never",cellStyle:{textAlign:"center"}},{title:"Mẫu báo cáo",field:"Tong_MauBaoCao",editable:"never",cellStyle:{textAlign:"center"}}],ge=te.createRef(),ke=()=>{var i;return(ge==null?void 0:ge.current)&&((i=ge==null?void 0:ge.current)==null?void 0:i.onQueryChange())};class Js extends s.Component{constructor(n){super(n);M(this,"loadLstDanhMuc",()=>{y("Reports/GetDMLinhVuc","GET",null,{odata:!1}).then(n=>{this.setState({dataLinhVuc:n}),this.setState({isSkeleton:!1})}).catch(()=>this.setState({isSkeleton:!1}))});M(this,"handleChange",(n,a)=>{this.setState({LinhVuc_Id:n,TenLinhVuc:a})});M(this,"onDelete",n=>{ie("","Xác nhận xóa").then(a=>{y(`DM_BaoCao(guid'${n.Id}')`,"DELETE",null,!0).then(()=>ke()).catch(()=>B("Vui lòng xóa chi tiết liên quan trước khi xóa báo cáo!","Thất bại"))})});M(this,"reload",()=>{ke(),this.loadLstDanhMuc()});M(this,"onClose",()=>{ke(),this.setState({isOpenDetail:!1})});this.state={LinhVuc_Id:null,TenLinhVuc:null,isOpenDetail:!1,isOpenCreate:!1,report:{},dataLinhVuc:[],flag:null,isSkeleton:!1}}componentDidMount(){this.loadLstDanhMuc()}render(){const{LinhVuc_Id:n,report:a,dataLinhVuc:l,isOpenCreate:o,flag:d,isSkeleton:h}=this.state;return e.jsxs(e.Fragment,{children:[h?e.jsx(e.Fragment,{children:h?e.jsx(Mt,{length:3,width:400}):e.jsx(me,{size:"sm",text:"Chưa có dữ liệu"})}):e.jsx(Vn,{showButton:!0,flag:"configs",title:"DANH MỤC BÁO CÁO",data:l,onChange:this.handleChange,children:e.jsx("div",{className:"index-dm-bao-cao",children:n&&e.jsx(e.Fragment,{children:e.jsx("div",{className:"p-3 mt-2",children:e.jsx(Ne,{tableRef:ge,title:"DANH MỤC BÁO CÁO",urlExt:"Reports/GetDMBaoCaoCuaLinhVuc",where:`LinhVuc_Id=${n}`,columns:Fn,selectType:"withColumns",onAdd:{onClick:(c,r)=>this.setState({isOpenCreate:!0,flag:"add",report:{}})},onEdit:{onClick:(c,r)=>this.setState({isOpenCreate:!0,report:r,flag:"update"})},onDelete:{onClick:(c,r)=>this.onDelete(r)},onRowClick:(c,r)=>this.setState({isOpenDetail:!0,report:r})})})})})}),o&&e.jsx(On,{open:o,Id:a.Id,reloadTable:()=>ke(),flag:d,LinhVuc_Id:n,onClose:()=>{this.setState({isOpenCreate:!1})}}),e.jsx(Qe,{open:this.state.isOpenDetail,title:`Cấu hình: ${a.Name}`,onClose:()=>{this.onClose()},children:e.jsx(Gn,{reloadParent:()=>this.reload(),reportCategoryId:a.Id})})]})}}export{Js as default};