????
Current Path : C:/inetpub/vhost/quypctt.nextform.vn/www/assets/ |
Current File : C:/inetpub/vhost/quypctt.nextform.vn/www/assets/Index-08158509.js |
var yt=Object.defineProperty;var St=(i,t,n)=>t in i?yt(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n;var B=(i,t,n)=>(St(i,typeof t!="symbol"?t+"":t,n),n);import{P as M,R as Y,r as s,J as vt,G as H,j as e,h as y,x as ie,l as L,p as ue,C as _e,v as Nt,m as de,T as bt,Q as Dt,U as dt}from"./index-3ac6b886.js";import{F as qe}from"./FullScreenDialog-3e8faf30.js";import{F as Q}from"./FontAwesome4-4d1c8e97.js";import{D as Ne}from"./DataTable-4f7de56a.js";import{T as It}from"./TabsBasic-8d0666c0.js";import{B as A}from"./Button-d32d698a.js";import{T as oe}from"./DetailInfo-598f38f6.js";import{F as he}from"./FormGroup-894dd1cd.js";import{I as fe}from"./Input-a404c875.js";import{a as Ce}from"./Required-a585e744.js";import{S as kt,I as ht,F as je}from"./DropdownList-92e339e1.js";import{a as _t,c as Pe,o as Me,P as ut,e as et,C as re}from"./DialogCustomize-f58e33cd.js";import{I as mt}from"./IndexDetail-64755c17.js";import{E as me}from"./Empty-c1579b18.js";import{E as Et}from"./EditPDF-e5fe172a.js";import{t as gt,m as $e,_ as xt}from"./utils-1da25c48.js";import{I as pe}from"./InputNumber-e0e8281b.js";import"./InputTime-6c25e67a.js";import{e as Ae,B as pt,k as ft,b as ye,f as tt}from"./DataSelect-21292454.js";import"./SelectPanelMulti-30b66e05.js";import{C as Ge}from"./Card-4b46d8e1.js";import{C as Tt}from"./CardBody-09907775.js";import{M as we}from"./Modal-834c96f4.js";import{M as Re,a as Ee}from"./SelectCustom-a3812854.js";import{u as Je}from"./UseHandleFormControl-bd31c77e.js";import{A as Se}from"./Alert-8adf8c12.js";import{f as wt,S as Mt,B as nt,a as At}from"./SkeletonLinhVuc-86e78a13.js";import{columns as Bt}from"./Index-a844cdd2.js";import"./Button-9ef33eb6.js";import{R as ve}from"./Row-ef702d16.js";import{C as K}from"./TextArea-5c5d2643.js";import{F as Lt}from"./Form-fa36fba5.js";import{k as Ot,c as ge,a as Xe,d as st,l as at,m as it}from"./useTheme-cc71593c.js";import{c as Ue}from"./withStyles-be05542d.js";import{w as Ke,c as Ve}from"./capitalize-2c2e3657.js";import{G as Pt}from"./Grow-ac49804e.js";import{c as be}from"./Icon-38b0de34.js";import{I as $t}from"./IconButton-99f5bf5c.js";/* empty css */import"./debounce-b2775af4.js";import"./Transition-41b94a89.js";import"./createStyles-cfd966dc.js";import"./OdataUtils-69f581ff.js";import"./Nav-7adab22f.js";import"./_commonjs-dynamic-modules-302442b1.js";import"./function-c7c2f09a.js";import"./classCallCheck-22a738c0.js";import"./possibleConstructorReturn-b2959138.js";import"./Dropdown-fd6014de.js";import"./ButtonDropdown-77330e2e.js";import"./DropdownToggle-ce0bc76b.js";import"./Popper-c3a92014.js";import"./CardHeader-f1e86ecf.js";import"./Collapse-9244e6b2.js";import"./TransitionGroup-a6d13137.js";import"./Fade-c1d8e31e.js";import"./LoadingSpinner-37d10bf9.js";import"./ListItem-c9e1521c.js";import"./Badge-69f10678.js";import"./const-0478bc07.js";import"./Grid-7ea1e802.js";import"./DefaultPropsProvider-2b143db4.js";import"./objectWithoutPropertiesLoose-881a77c7.js";var Gt=["className","cssModule","tag"];function Fe(){return Fe=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},Fe.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:M.string,cssModule:M.object,tag:gt};function ze(i){var t=i.className,n=i.cssModule,a=i.tag,l=a===void 0?"span":a,o=Rt(i,Gt),d=$e(xt(t,"input-group-text"),n);return Y.createElement(l,Fe({},o,{className:d}))}ze.propTypes=Ft;var zt=["className","cssModule","type","size","color","children","tag"];function He(){return He=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},He.apply(this,arguments)}function Ht(i,t){if(i==null)return{};var n=Qt(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 Qt(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 Wt={tag:gt,type:M.oneOf(["border","grow"]),size:M.oneOf(["sm"]),color:M.oneOf(["primary","secondary","success","danger","warning","info","light","dark"]),className:M.string,cssModule:M.object,children:M.string};function Ct(i){var t=i.className,n=i.cssModule,a=i.type,l=a===void 0?"border":a,o=i.size,d=i.color,h=i.children,c=h===void 0?"Loading...":h,r=i.tag,u=r===void 0?"div":r,m=Ht(i,zt),C=$e(xt(t,o?"spinner-".concat(l,"-").concat(o):!1,"spinner-".concat(l),d?"text-".concat(d):!1),n);return Y.createElement(u,He({role:"status"},m,{className:C}),c&&Y.createElement("span",{className:$e("visually-hidden",n)},c))}Ct.propTypes=Wt;function ot(i){return i.substring(2).toLowerCase()}function qt(i){return document.documentElement.clientWidth<i.clientX||document.documentElement.clientHeight<i.clientY}function Jt(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),C=s.useRef(!1);s.useEffect(function(){return setTimeout(function(){m.current=!0},0),function(){m.current=!1}},[]);var _=s.useCallback(function(k){u.current=vt.findDOMNode(k)},[]),I=_t(t.ref,_),p=Pe(function(k){var E=C.current;if(C.current=!1,!(!m.current||!u.current||qt(k))){if(r.current){r.current=!1;return}var N;if(k.composedPath)N=k.composedPath().indexOf(u.current)>-1;else{var O=Me(u.current);N=!O.documentElement.contains(k.target)||u.current.contains(k.target)}!N&&(a||!E)&&d(k)}}),g=function(E){return function(N){C.current=!0;var O=t.props[E];O&&O(N)}},S={ref:I};return c!==!1&&(S[c]=g(c)),s.useEffect(function(){if(c!==!1){var k=ot(c),E=Me(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]=g(o)),s.useEffect(function(){if(o!==!1){var k=ot(o),E=Me(u.current);return E.addEventListener(k,p),function(){E.removeEventListener(k,p)}}},[p,o]),s.createElement(s.Fragment,null,s.cloneElement(t,S))}var Xt=function(t){var n=t.palette.type==="light"?.8:.98,a=Ot(t.palette.background.default,n);return{root:H({},t.typography.body2,ge({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}}},Ut=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=Xe(t,["action","classes","className","message","role"]);return s.createElement(ut,H({role:c,square:!0,elevation:6,className:Ue(l.root,o),ref:n},r),s.createElement("div",{className:l.message},d),a?s.createElement("div",{className:l.action},a):null)});const Kt=Ke(Xt,{name:"MuiSnackbarContent"})(Ut);var Yt=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:H({},n,ge({},t.breakpoints.up("sm"),H({},d,u))),anchorOriginBottomCenter:H({},a,ge({},t.breakpoints.up("sm"),H({},h,u))),anchorOriginTopRight:H({},n,l,ge({},t.breakpoints.up("sm"),H({left:"auto"},d,c))),anchorOriginBottomRight:H({},a,l,ge({},t.breakpoints.up("sm"),H({left:"auto"},h,c))),anchorOriginTopLeft:H({},n,o,ge({},t.breakpoints.up("sm"),H({right:"auto"},d,r))),anchorOriginBottomLeft:H({},a,o,ge({},t.breakpoints.up("sm"),H({right:"auto"},h,r)))}},Zt=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,C=t.ClickAwayListenerProps,_=t.ContentProps,I=t.disableWindowBlurListener,p=I===void 0?!1:I,g=t.message,S=t.onClose,k=t.onEnter,E=t.onEntered,N=t.onEntering,O=t.onExit,T=t.onExited,$=t.onExiting,W=t.onMouseEnter,X=t.onMouseLeave,V=t.open,w=t.resumeHideDuration,F=t.TransitionComponent,R=F===void 0?Pt:F,q=t.transitionDuration,Z=q===void 0?{enter:st.enteringScreen,exit:st.leavingScreen}:q,ee=t.TransitionProps,le=Xe(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"]),te=s.useRef(),ne=s.useState(!0),se=ne[0],U=ne[1],J=Pe(function(){S&&S.apply(void 0,arguments)}),z=Pe(function(b){!S||b==null||(clearTimeout(te.current),te.current=setTimeout(function(){J(null,"timeout")},b))});s.useEffect(function(){return V&&z(c),function(){clearTimeout(te.current)}},[V,c,z]);var x=function(){clearTimeout(te.current)},D=s.useCallback(function(){c!=null&&z(w??c*.5)},[c,w,z]),P=function(ae){W&&W(ae),x()},j=function(ae){X&&X(ae),D()},v=function(ae){S&&S(ae,"clickaway")},f=function(){U(!0)},G=function(){U(!1)};return s.useEffect(function(){if(!p&&V)return window.addEventListener("focus",D),window.addEventListener("blur",x),function(){window.removeEventListener("focus",D),window.removeEventListener("blur",x)}},[p,D,V]),!V&&se?null:s.createElement(Jt,H({onClickAway:v},C),s.createElement("div",H({className:Ue(u.root,u["anchorOrigin".concat(Ve(o)).concat(Ve(d))],m),onMouseEnter:P,onMouseLeave:j,ref:n},le),s.createElement(R,H({appear:!0,in:V,onEnter:et(G,k),onEntered:E,onEntering:N,onExit:O,onExited:et(f,T),onExiting:$,timeout:Z,direction:o==="top"?"down":"up"},ee),r||s.createElement(Kt,H({message:g,action:a},_)))))});const en=Ke(Yt,{flip:!1,name:"MuiSnackbar"})(Zt),tn=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"})),nn=be(s.createElement("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"})),sn=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"})),an=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"})),on=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 ln=function(t){var n=t.palette.type==="light"?at:it,a=t.palette.type==="light"?it:at;return{root:H({},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}}},lt={success:s.createElement(tn,{fontSize:"inherit"}),warning:s.createElement(nn,{fontSize:"inherit"}),error:s.createElement(sn,{fontSize:"inherit"}),info:s.createElement(an,{fontSize:"inherit"})},rn=s.createElement(on,{fontSize:"small"}),cn=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,C=m===void 0?lt:m,_=t.onClose,I=t.role,p=I===void 0?"alert":I,g=t.severity,S=g===void 0?"success":g,k=t.variant,E=k===void 0?"standard":k,N=Xe(t,["action","children","classes","className","closeText","color","icon","iconMapping","onClose","role","severity","variant"]);return s.createElement(ut,H({role:p,square:!0,elevation:0,className:Ue(o.root,o["".concat(E).concat(Ve(r||S))],d),ref:n},N),u!==!1?s.createElement("div",{className:o.icon},u||C[S]||lt[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($t,{size:"small","aria-label":c,title:c,color:"inherit",onClick:_},rn)):null)});const dn=Ke(ln,{name:"MuiAlert"})(cn);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(kt,{animation:"wave",variant:"text",height:25},l))})}class jt extends s.Component{constructor(n){super(n);B(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})})});B(this,"onSave",()=>{this.props.onSelectTypeUnit&&this.props.onSelectTypeUnit(this.state.lstSelected)});B(this,"onClose",()=>{this.props.onClose&&this.props.onClose()});B(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})}});B(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 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/GetDoiTuongThucHienOfBaoCao?baoCaoId=${i}`,"GET",null,{odata:!1}).then(p=>{l(p.value),u(!1)}).catch(()=>u(!1))},[i]),C=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(g=>{m()}).catch(g=>L(g.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,g)=>p.NhomDoiTuong_Id<g.NhomDoiTuong_Id?-1:p-g).map((p,g)=>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)})})})]},g)):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(jt,{lstDoiTuong:a,onSelectTypeUnit:C,onClose:()=>n(!1)})}),o&&e.jsx(mt,{nhomDoiTuongId:h.NhomDoiTuong_Id,Name:h.TenNhomDoiTuong_Id,open:o,onClose:()=>{d(!1),m()}})]})}const un=Y.createRef(),mn=[{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 gn({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:un,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:mn,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(Et,{title:a.name,open:t,IdMauBaoCao:a==null?void 0:a.mauBaoCaoId,onClose:()=>n(!1),reportTemplate:a})]})}function xn({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(g=>{l(g.value),u(!1)}).catch(()=>u(!1))},[i]),C=g=>{try{const S=[];g.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{L("Đã xảy ra lỗi!")}},_=g=>{y(`RP_DoiTuongNhan(guid'${g.id}')`,"DELETE",null,!0).then(S=>{m()}).catch(S=>L(S.value))},I=g=>{d(!0),c(g)},p=(g,S)=>{g==="delete"?ie("","Xác nhận xóa!").then(()=>{_(S)}):g==="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((g,S)=>g.NhomDoiTuong_Id<S.NhomDoiTuong_Id?-1:g-S).map((g,S)=>e.jsxs("tr",{style:{cursor:"pointer"},children:[e.jsx("td",{onClick:()=>{p("row",g)},style:{textAlign:"center"},children:S+1}),e.jsx("td",{onClick:()=>{p("row",g)},children:g.TenNhomDoiTuong_Id}),e.jsx("td",{onClick:()=>{p("row",g)},style:{textAlign:"center",width:"10%"},children:g.SoDonViThuocNhomDoiTuong?g.SoDonViThuocNhomDoiTuong:0}),e.jsx("td",{style:{textAlign:"center"},children:e.jsx(A,{className:"icon icon-del",onClick:()=>{p("delete",g)}})})]},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(jt,{lstDoiTuong:a,onSelectTypeUnit:C,onClose:()=>n(!1)})}),o&&e.jsx(mt,{nhomDoiTuongId:h.NhomDoiTuong_Id,Name:h.TenNhomDoiTuong_Id,open:o,onClose:()=>{d(!1),m()}})]})}const pn=[{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; `,fn=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); } `,Tn=ue(we)` max-width: 100%; `,Cn=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; } } `,jn=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 yn(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:C,isNew:_}=i,[I,p]=s.useState(""),[g,S]=s.useState(null),[k,E]=s.useState(!1),[N,O]=s.useState([]),[T,$]=s.useState(!1),[W,X]=s.useState(0),[V,w]=s.useState([]),[F,R]=s.useState(!1),[q,Z]=s.useState([]),[ee,le]=s.useState([]),te=s.useCallback(v=>{const f=v.target.files[0];p(f?f.name:""),S(f)},[]),ne=s.useCallback(()=>g?!0:(_e("Vui lòng chọn file trước khi import"),!1),[g]),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),O([]),Z([]),n()},[n]),J=s.useCallback(async()=>{if(ne()&&se())if(g.name.split(".").pop()==="xlsx"){const f=new FormData;f.append("file",g),C&&f.append("BaoCao_Id",C.ID);const G=await Nt(d,"POST",f),b=G.filter(ce=>ce.Error),ae=G.filter(ce=>!ce.Error),Ze=G.filter(ce=>ce.GhiChu);w(ae),G.length===b.length?R(!0):R(!1),b.length?(X(b.length),E(!0),O(b)):Ze.length?(Z(Ze),le(G)):(y(u,"POST",JSON.stringify(G),{odata:!1}).then(ce=>{de("Import thành công").then(()=>{U(),m()})}).catch(ce=>L(ce,"Import lỗi")),E(!1),O([]),X(0))}else _e("Vui lòng chọn file .xlsx")},[ne,se,g,C,d,u,U,m]),z=s.useCallback(()=>{y(u,"POST",JSON.stringify(ee),{odata:!1}).then(v=>{de("Import thành công").then(()=>{U(),m()})}).catch(()=>L("Import lỗi","Không thành công")),E(!1),O([]),X(0)},[ee,U,m,u]),x=s.useCallback(()=>{$(!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(()=>L("Import lỗi","Không thành công"))},[V,n,m,u]),P=s.useMemo(()=>e.jsxs(Tn,{size:"xl",isOpen:T,zIndex:l+1,toggle:x,children:[e.jsx(Re,{children:"CHI TIẾT LỖI FILE EXCEL"}),e.jsxs(Ee,{children:[e.jsxs(Cn,{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((G,b)=>{const ae=v[G.field];return e.jsx("td",{className:G.align,children:G.render?G.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,x,N,l,c,r]),j=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=${C.ID}`,"DELETE",null,{odata:!1}).then(()=>de("Xóa thành công").then(()=>m())).catch(f=>L("Xóa không thanh công"))})},[C,m,h]);return e.jsx(s.Fragment,{children:e.jsxs(we,{size:"xl",isOpen:a,zIndex:l,toggle:U,children:[e.jsx(Re,{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(ht,{children:[e.jsx(fe,{value:I,readOnly:!0,placeholder:"Chọn file..."}),e.jsxs(fn,{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:te,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:j,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:z,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(jn,{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((G,b)=>{const ae=v[G.field];return e.jsx("td",{className:G.align,children:G.render?G.render(v):ae},b)})},f))})]})})]}):"",k&&e.jsxs("div",{className:"d-flex align-items-center justify-content-between",children:[e.jsxs(A,{onClick:()=>x(),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 Sn=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; `,vn=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(ht)` .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(ze,{className:"bg-primary",style:{pointerEvents:l.disableSelect?"none":"auto",opacity:l.disableSelect?.65:1},onClick:n,children:t}),d&&e.jsx(ze,{className:"bg-danger",style:{pointerEvents:l.disableSelect?"none":"auto",opacity:l.disableSelect?.65:1},onClick:m==="function"?d:r,children:c||"Xóa"})]})}),Nn=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,C=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||C,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 Ye(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:C,isCheck:_}=i,[I,p]=s.useState(null),[g,S]=s.useState(!1),[k,E]=s.useState(!1),[N,O]=s.useState({}),[T,$]=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(!g)},[r,g]),R=s.useCallback((J,z)=>{r&&r(),J==="add"?($(null),O({})):J==="edit"?($(z.Id),O({...z})):O({}),E(!k)},[k,r]),q=s.useCallback(()=>{r&&r(),X(!W)},[W,r]);s.useEffect(()=>{I&&a(I)},[I]);const{handleChange:Z,handleValidate:ee}=Je(N,n.formAddModal,J=>O(J)),le=s.useCallback(async()=>{if(ee()){const J=_;let z=!1;const x=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=bt.IDDonVi,wt(N),_&&!T&&(z=await y(`${J}`,"POST",JSON.stringify(N),{odata:!1}));const j=()=>y(D,x,JSON.stringify(N)).then(v=>{R(),w(),de(P)});z?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&&j()}):j()}},[ee,_,T,n.url,N,R,w]),te=s.useMemo(()=>{if(n.formAddModal){const J=Object.values(n.formAddModal),z=x=>{var D;return x.type!=="popup-select"?N[x.field_name]:N[(D=x.popupSelect)==null?void 0:D.selectColumn]};return e.jsxs(we,{size:"lg",isOpen:k,zIndex:1301,toggle:R,children:[e.jsxs(Re,{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((x,D)=>e.jsxs(Ge,{className:"mt-4",children:[e.jsx(Sn,{title:x.title,children:x.title}),e.jsxs(Tt,{onDragStart:P=>P.preventDefault(),className:"pt-3 pb-2",children:[e.jsx(je,{data:{...x,hidden_label:!0},value:z(x),onChange:(P,j)=>Z(P,j),inline:!1}),x.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:z,columnsImport:x,theadTableImport:D,title:P,urldownload:j,isNew:v}=n;return e.jsx(yn,{zIndex:1301,urldownload:j,title:"Import "+P,isOpen:W,isClose:q,isNew:v,urlImport:J,urlPreImport:z,columnsImport:x,theadTableImport:D,reloadData:w})},[W,q,n,w]),se=s.useMemo(()=>g&&e.jsx(Nn,{ableCRUD:l,isOpen:g,onClose:F,dataSelect:n,setselectedItem:p,maxWidth:u,isModal:m,isImport:C,toggleAdd:R,toggleImport:q,tableRef:V}),[l,n,m,u,g,F]),U=s.useCallback(()=>{p(null)},[]);return e.jsxs(Y.Fragment,{children:[e.jsx(vn,{label:t,onClick:F,onDelete:d,labelDelete:c,selectedItem:I,dataSelect:n,valueDisplay:o,placeholder:h,handelDeleteSelected:U}),se,te,ne]})}Ye.propTypes={label:M.oneOfType([M.string,M.number,M.element]),dataSelect:M.shape({title:M.string,url:M.string.isRequired,where:M.string,columns:M.array,defaultValues:M.array,selectColumn:M.string.isRequired,disableSelect:M.bool}),onCallback:M.func.isRequired,className:M.shape({button:M.string,popup:M.string}),labelDelete:M.string,ableCRUD:M.bool,valueDisplay:M.string,placeholder:M.string,maxWidth:M.number};Ye.defaultProps={label:"Chọn",className:{},ableCRUD:!0};let bn=class extends s.Component{constructor(n){super(n);B(this,"handelOnSelected",(n,a)=>{this.setState({valueAdd:{...this.state.valueAdd,[n]:a}})});B(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})})});B(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})})});B(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})})});B(this,"getIsDisableSave",n=>{const{QuyTrinh_Id:a,NhomDoiTuong_Nhan_Id:l,NhomDoiTuong_Gui_Id:o,MauBaoCao_Id:d}=n;return!(a&&l&&o&&d)});B(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)?L("Đã 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=>{L(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=>{L(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(Ae,{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(Ae,{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(Ae,{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 Dn=[{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}],Qe=Y.createRef(),In=()=>Qe.current&&Qe.current.onQueryChange(),kn="RP_NhomDoiTuong_DonVi?$expand=SYS_DonVi&$select=SYS_DonVi/STT,SYS_DonVi/MaDonVi,SYS_DonVi/TenDonVi";function _n(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,C=[];m.forEach(_=>{C.push(_.RP_NhomDoiTuong)}),n(C),d(!1)}).catch(()=>d(!1))},[i.BaoCao_Id]),r=u=>{l(u),In()};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:Qe,title:"Danh sách đơn vị",url:kn,where:`NhomDoiTuong_Id eq ${a.Id?a.Id:null}`,columns:Dn,selectType:"withColumns",onActions:[{icon:"check",tooltip:"Chọn",onClick:(u,m)=>h(m)}]})})]})}const En="RP_ChiTietGuiNhan",wn="QuanLyReport/ThemChiTietQuyTrinh";function Mn(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({}),[C,_]=s.useState({}),I=T=>{o(!1);const $={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($)).then(()=>{W[X]={...W[X],DonViNhan:T.SYS_DonVi.TenDonVi,MaDonViNhan:T.SYS_DonVi.MaDonVi},i.onUpdateLstGuiNhan(W)}).catch(()=>L("Lỗi!"))},p=T=>{r(T),o(!0)},g=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(`${wn}?maDvGui=${u}&maDvNhan=${C}&ChiTietQuyTrinh_Id=${a}`,"POST",null,!1).then(()=>{de("Thêm thành công","THÔNG BÁO"),i.onClose(),t()}).catch(T=>L("Không tìm thấy đơn vị","THÔNG BÁO"))},[u,C,i,a,t]),E=T=>{T.Id&&ie("Bạn chắc chắn muốn xóa?","Thông báo").then(()=>{Dt(`${En}(guid'${T.Id}')`,"DELETE",null).then($=>{i.onClose(),t()}).catch($=>L("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=>L("Xóa dữ liệu không thành công"),"Thông báo")},[i,a,t]),O=s.useCallback((T,$)=>{y(`RP_ChiTietGuiNhan(guid'${$}')`,"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(Y.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(pt,{size:"sm",onClick:()=>k(),children:"Lưu"}),e.jsx(ft,{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,$)=>T.MaDonViGui&&T.MaDonViGui.split(".")[2]<$.MaDonViGui.split(".")[2]?-1:T-$).map((T,$)=>e.jsxs("tr",{children:[e.jsx("td",{style:{verticalAlign:"middle"},children:g(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=>O(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"})})]},$)):e.jsx(Te,{length:5})})]})]}),e.jsx(re,{title:"Danh sách đơn vị",open:l,handleClose:()=>o(!1),maxWidth:"lg",children:e.jsx(_n,{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}],An=({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(Ct,{color:"light",size:"sm",children:"Loading..."}):e.jsx(Q,{fa:"steam-square"}),"Khởi tạo tần suất mặc định"]})})},rt=()=>{let i=[];for(let t=1;t<=31;t++)i.push({label:`Ngày ${t}`,value:`${t}`});return i},ct=()=>{let i=[];for(var t=1;t<=12;t++)i.push({value:`${t}`,label:`Tháng ${t}`});return i},Bn="RP_ChiTietQuyTrinh_TanSuat";function Ln(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({}),[C,_]=s.useState({}),[I,p]=s.useState({}),[g,S]=s.useState({}),[k,E]=s.useState(!1),[N,O]=s.useState({}),[T,$]=s.useState(!1),[W,X]=s.useState({isOpen:!1}),V=j=>{X({isOpen:!0,message:j})},w=s.useCallback(j=>{V({type:"success",text:j})},[]),F=s.useCallback(j=>{V({type:"error",text:j})},[]),R=()=>X({isOpen:!1}),{isOpen:q,message:Z}=W,ee=(j,v)=>{O(f=>({...f,[j]:v}))},le=()=>{r(!0)},te=s.useCallback(j=>{E(j)},[]),ne=j=>!!j,se=j=>!!j,U=s.useCallback(j=>{S(j),O(v=>{const{ThoiHanGui:{NgayGui:f,ThangGui:G}}=j;return{...v,objNgayGui:{label:`Ngày ${f}`,value:f},objThangGui:{label:`Tháng ${G}`,value:G}}}),E(!1),$(!0)},[]),J=s.useCallback(()=>{let j={ChiTietQuyTrinh_Id:u,TanSuat_Id:C,LanSo:parseInt(I)};y(`${Bn}`,"POST",JSON.stringify(j)).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,C]),z=s.useCallback(()=>{const{objNgayGui:j,objThangGui:v}=N,f={NgayGui:j.value,ThangGui:v.value,IsFinish:!0,IsThucHien:!0,IsNamSau:k};f.NgayGui?y(`RP_ChiTietQuyTrinh_TanSuat(guid'${g.Id}')`,"PATCH",JSON.stringify(f)).then(()=>{w("Thành công!"),d(),h(),$(!1)}).catch(()=>{F("Thất bại!")}):_e("Vui lòng chọn ngày gửi thực hiện!")},[g.Id,F,k,d,h,w,N]),x=s.useCallback((j,v)=>{y(`RP_ChiTietQuyTrinh_TanSuat(guid'${j.Id}')`,"PATCH",JSON.stringify({IsThucHien:v}),!0).then(f=>{d()})},[d]),D=s.useCallback((j,v)=>{y(`RP_ChiTietQuyTrinh_TanSuat(guid'${j.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((j,v)=>{y(`RP_ChiTietQuyTrinh_TanSuat(guid'${j.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(Ge,{style:{border:"0"},children:e.jsxs(Tt,{children:[e.jsx(ve,{children:c?e.jsxs(Y.Fragment,{children:[e.jsx(K,{md:"3",children:e.jsx(pe,{placeholder:"Nhập id quy trình",onChange:j=>m(j.target.value)})}),e.jsx(K,{md:"3",children:e.jsx(pe,{placeholder:"Nhập id tần suất",onChange:j=>_(j.target.value)})}),e.jsx(K,{md:"3",children:e.jsx(pe,{placeholder:"Nhập số lần",onChange:j=>p(j.target.value)})}),e.jsxs(K,{md:"3",style:{display:"flex",justifyContent:"flex-end"},children:[e.jsx(pt,{size:"sm",onClick:()=>J(),children:"Lưu"}),e.jsx(ft,{onClick:()=>r(!1),children:"Đóng"})]})]}):e.jsxs("div",{className:"d-flex justify-content-end gap-3 mb-4",children:[e.jsx(An,{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((j,v)=>j.DoiTuong_Gui_Id<v.DoiTuong_Gui_Id?-1:j-v).map((j,v)=>e.jsx(Y.Fragment,{children:e.jsx(Ge,{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:j.ChiTietQuyTrinh_TanSuat.Model&&j.ChiTietQuyTrinh_TanSuat.Model.sort(dt("STT","asc")).map((f,G)=>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=>x(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===g.Id?e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("div",{style:{width:"30%",marginRight:"10px"},children:e.jsx(tt,{name:"ngayGui",options:rt(),value:N.objNgayGui,className:"cus-select",placeholder:e.jsx("div",{style:{fontSize:"13px"},children:"Chọn ngày"}),onChange:b=>ee("objNgayGui",b),getOptionValue:b=>b,defaultValue:rt().find(b=>b.value===f.NgayGui),getOptionLabel:b=>b.label})}),e.jsx("div",{style:{width:"30%",marginRight:"10px"},children:e.jsx(tt,{name:"doiTuongThucHien",options:ct(),value:N.objThangGui,className:"cus-select",placeholder:e.jsx("div",{style:{fontSize:"13px"},children:"Chọn tháng"}),onChange:b=>ee("objThangGui",b),getOptionValue:b=>b,defaultValue:ct().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=>te(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===g.Id?e.jsxs(e.Fragment,{children:[e.jsx(ye,{color:"success",icon:"save",onClick:()=>z(),title:"Lưu"}),e.jsx(ye,{color:"danger",icon:"close",onClick:()=>$(!1),title:"Xóa"})]}):e.jsx(ye,{color:"primary",icon:"edit",onClick:()=>U(f),title:"Sửa"})})]})]},`${v}.${G}`))})]})})})},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"})})}),Z&&e.jsx(en,{open:q,autoHideDuration:6e3,onClose:R,children:e.jsx(dn,{elevation:6,variant:"filled",onClose:R,severity:Z.type,children:Z.text})})]})})})})}function On({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,C]=s.useState(!1),[_,I]=s.useState(!1),[p,g]=s.useState(!1),[S,k]=s.useState(!1),[E,N]=s.useState(null),[O,T]=s.useState(null),[$,W]=s.useState(null),[X,V]=s.useState(""),w=s.useCallback(()=>{C(!0),y(`Reports/GetChiTietQuyTrinh?QuyTrinh_Id=${i}`,"GET",null,{odata:!1}).then(x=>{l(x.value),C(!1)}).catch(()=>C(!1))},[i]),F=s.useCallback(()=>{y("RP_NhomDoiTuong","GET",null,!0).then(x=>{d(x.value);const D=x.value.filter(P=>P.Id===`${i}`);u(D)})},[i]);s.useEffect(()=>{w(),F()},[w,F]),s.useCallback(x=>{const D=o.find(P=>P.Id===x);return D?D.Name:""},[o]);const R=s.useCallback(()=>{w()},[w]),q=s.useCallback(()=>{t&&t()},[t]),Z=s.useCallback(x=>{y(`RP_ChiTietQuyTrinh(guid'${x}')`,"DELETE",null,!0).then(()=>{R(),q()}).catch(D=>L(D?D.Massage:"Dữ liệu đã có liên kết, không thể xóa!"))},[R,q]),ee=s.useCallback((x,D)=>{g(!0),c(x),N(D);const P=x.sort(dt("DonViNhan","asc"));c(P)},[]),le=s.useCallback((x,D,P)=>{k(!0),N(D);const j=a.filter(v=>v.Id===`${D}`);u(j),V(P)},[a]),te=s.useCallback(()=>{k(!1)},[]),ne=s.useCallback(()=>{g(!1)},[]),se=s.useCallback(()=>{},[]),U=s.useCallback(x=>{c(x),R(),q()},[R,q]),J=s.useCallback(x=>{y(`RP_ChiTietQuyTrinh(guid'${x}')`,"PATCH",JSON.stringify({PhongBanTiepNhan_Id:null}),!0).then(()=>w()).catch(D=>L(D.Message?D.Message:"Đã xảy ra lỗi chưa thể cập nhật!"))},[w]),z=a.length&&a.find(x=>x.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"}),z&&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((x,D)=>x.DoiTuong_Gui_Id<D.DoiTuong_Gui_Id?-1:x-D).map((x,D)=>e.jsxs(Y.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{rowSpan:2,className:"display-center",style:{width:"5%"},children:D+1}),e.jsx("td",{children:x.Id}),e.jsxs("td",{style:{verticalAlign:"middle"},children:[e.jsxs("div",{children:[" ",x.DoiTuong_Gui," "]}),e.jsxs("div",{className:"d-flex justify-content-around mt-3",children:[e.jsxs("div",{className:"thong-tin-don-vi",onClick:()=>{ee(x.ChiTietGuiNhan.Model,x.Id)},children:[e.jsx(Q,{fa:"stack-overflow"}),"Có ",x.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(x.ChiTietGuiNhan.Model,x.Id,x.MauBaoCao)},children:[e.jsx(Q,{fa:"safari"}),"Cài đặt tần suất"]}),(x.ChiTietGuiNhan.TongSoQT_NotFinish||x.ChiTietGuiNhan.Model.length===0)&&e.jsxs("div",{className:"error",children:[e.jsx(Q,{fa:"exclamation-triangle"})," ",x.ChiTietGuiNhan.TongSoQT_NotFinish," "]})]})]}),e.jsx("td",{style:{verticalAlign:"middle",background:"antiquewhite"},children:x.DoiTuongNhan}),e.jsx("td",{style:{verticalAlign:"middle",background:"antiquewhite"},children:x.MauBaoCao}),x.IsChonPhongBan&&e.jsx("td",{style:{verticalAlign:"middle",background:"antiquewhite"},children:e.jsx(Ye,{valueDisplay:x.TenPhongBanTiepNhan,label:"Chọn",dataSelect:{url:"DM_PhongBan",title:"Danh sách phòng ban",columns:Bt,selectColumn:"TenPhongBan"},onCallback:P=>P&&se(x.Id,P.Id),onDelete:()=>J(x.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(()=>{Z(x.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(bn,{quyTrinh:O,BaoCao_Id:n,QuyTrinh_Id:i,lstQuyTrinh:a,open:_,flag:$,onClose:()=>I(!1),reloadList:()=>R(),reloadReportProcess:()=>q()}),e.jsx(Mn,{BaoCao_Id:n,open:p,reloadData:w,onClose:()=>{ne()},quyTrinhId:E,lstThongTinGuiNhan:h,onUpdateLstGuiNhan:x=>U(x)}),e.jsx(Ln,{BaoCao_Id:n,open:S,reloadData:w,onClose:()=>{te()},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 Pn({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}=Je(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(()=>{L("Lỗi!")})},m=()=>{y("DM_QuyTrinh","POST",JSON.stringify(d)).then(()=>{n(),l()}).catch(()=>{L("Lỗi!")})},C=()=>{y(`DM_QuyTrinh(guid'${d.Id}')`,"PATCH",JSON.stringify(d)).then(()=>{n(),l()}).catch(()=>{L("Lỗi!")})},_=()=>{r()&&(a==="update"?C():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 We=Y.createRef(),Oe=()=>We.current&&We.current.onQueryChange();function $n({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")},C=p=>{h(!0),o(p),r("update")},_=p=>{ie("","Xác nhận xóa").then(g=>{y(`DM_QuyTrinh(guid'${p.Id}')`,"DELETE",null,!0).then(()=>Oe()).catch(S=>L(S.value))})},I=()=>{Oe(),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:We,urlExt:"Reports/GetQuyTrinhCuaBaoBao",where:`BaoCao_Id=${i}`,columns:pn,selectType:"withColumns",onAdd:{onClick:(p,g)=>m()},onEdit:{onClick:(p,g)=>C(g)},onDelete:{onClick:(p,g)=>_(g)},onRowClick:(p,g)=>u(g),search:!1})}),d&&e.jsx(Pn,{quyTrinh:l,BaoCao_Id:i,open:d,onClose:()=>{h(!1)},reloadTable:Oe,flag:c}),n&&e.jsx(qe,{open:n,title:`Quy trình: ${l.TenQuyTrinh}`,onClose:()=>a(!1),children:e.jsx(On,{reloadTableReportProcess:()=>I(),BaoCao_Id:i,QuyTrinh_Id:l.Id})})]})}class Gn extends s.Component{constructor(n){super(n);B(this,"onSave",()=>{this.props.onSelectFrequency&&this.props.onSelectFrequency(this.state.lstSelected)});B(this,"onClose",()=>{this.props.onClose&&this.props.onClose()});B(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})})});B(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})}});B(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 Rn({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(C=>{const _={BaoCao_Id:i,TanSuat_Id:C};m.push(y("RP_BaoCao_TanSuat","POST",JSON.stringify(_),!0))}),Promise.all(m).then(C=>{h(),n(!1)})}catch{L("Đã 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=>L(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(Gn,{onSelectFrequency:c,lstTanSuat:a,onClose:()=>n(!1)})})]})}class Vn 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(It,{data:[{TabName:"Cơ quan thực hiện",TabContent:e.jsx("div",{children:e.jsx(hn,{reportCategoryId:t})})},{TabName:"Cơ quan nhận",TabContent:e.jsx(xn,{reportCategoryId:t})},{TabName:"Mẫu báo cáo",TabContent:e.jsx(gn,{reportCategoryId:t})},{TabName:"Cài đặt tần suất",TabContent:e.jsx(Rn,{reportCategoryId:t})},{TabName:"Quy trình thực hiện",TabContent:e.jsx($n,{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 Fn({Id:i,open:t,reloadTable:n,onClose:a,LinhVuc_Id:l}){const[o,d]=s.useState({}),{handleChange:h,handleValidate:c}=Je(o,Ie,C=>d(C)),r=s.useCallback(()=>{i&&y(`DM_BaoCao(guid'${i}')`,"GET",null).then(C=>d(C)).catch(C=>L("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 C={...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",g=i?"Lưu không thành công":"Cập nhật không thành công";y(_,I,JSON.stringify(C)).then(()=>{n(),de(p,"Thông báo"),a()}).catch(()=>L(g,"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 zn=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 Hn({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(Y.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:zn(h.Ngay)})]}),h.BaoCaos.sort((r,u)=>r.STT>u.STT?-1:r-u).map((r,u)=>e.jsxs(Y.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,C)=>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(Mt,{value:m.SoNgayDenHan})," "]})]},`${u}-${C}`))]},`${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 Qn extends s.Component{constructor(n){super(n);B(this,"getBackground",n=>{if(n==="bc-di")return"bg-di";if(n==="bc-den")return"bg-den"});B(this,"getMargin",n=>n==="bc-di"||n==="bc-den"?"10px":"");B(this,"getColor",n=>n==="bc-di"?"":n==="bc-den"?"white":"");B(this,"handleChange",(n,a)=>{this.setState({SelectedId:n,SelectedName:a}),this.props.onChange&&this.props.onChange(n,a)});B(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(Hn,{open:this.state.isLichBaoCao})})]})}}const Wn=[{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"}}],xe=Y.createRef(),ke=()=>{var i;return(xe==null?void 0:xe.current)&&((i=xe==null?void 0:xe.current)==null?void 0:i.onQueryChange())};class aa extends s.Component{constructor(n){super(n);B(this,"loadLstDanhMuc",()=>{y("Reports/GetDMLinhVuc","GET",null,{odata:!1}).then(n=>{this.setState({dataLinhVuc:n}),this.setState({isSkeleton:!1})}).catch(()=>this.setState({isSkeleton:!1}))});B(this,"handleChange",(n,a)=>{this.setState({LinhVuc_Id:n,TenLinhVuc:a})});B(this,"onDelete",n=>{ie("","Xác nhận xóa").then(a=>{y(`DM_BaoCao(guid'${n.Id}')`,"DELETE",null,!0).then(()=>ke()).catch(()=>L("Vui lòng xóa chi tiết liên quan trước khi xóa báo cáo!","Thất bại"))})});B(this,"reload",()=>{ke(),this.loadLstDanhMuc()});B(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(At,{length:3,width:400}):e.jsx(me,{size:"sm",text:"Chưa có dữ liệu"})}):e.jsx(Qn,{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:xe,title:"DANH MỤC BÁO CÁO",urlExt:"Reports/GetDMBaoCaoCuaLinhVuc",where:`LinhVuc_Id=${n}`,columns:Wn,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(Fn,{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(Vn,{reloadParent:()=>this.reload(),reportCategoryId:a.Id})})]})}}export{aa as default};