PageSourceSearch

https://assets.omnisegment.com/a8c43eaa6c/assets/index-B6lgSVs2.js

js omnisegment.com collected 2026-10-07 15:22:19 UTC 34,256 bytes, 5 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="253024ad-4b40-55e1-ad52-8cd39ee9ee50")}catch(e){}}();
3import{r as D,R as qe,j as e,e as O}from"./index.modern-Bk2HkT0W.js";import{u as q,a as Me,I as V,F as H,h as ze,c_ as Ne,e as we,n as Ve,c$ as Be,A as he,Q as ye,aQ as U,W as ue,ak as $e,J as X,am as me,V as Ye,T as He,s as Le,a5 as Q,E as Ue}from"./main-LStdChlz.js";import{aO as S,aU as R,bK as Ke,b4 as Y}from"./i18next-CszFfP19.js";import{g as pe,u as We,P as Qe}from"./getUnitName-AKO4CtNV.js";import{S as Z}from"./SectionCard-JS35EyeR.js";import{A as W}from"./ActionButton-ClFQzdQ9.js";import{I as ee}from"./IconHeader-CIpOlg9o.js";import{o as te}from"./omniStyles-D0WK32US.js";import{C as P}from"./index-D-ik_bUf.js";import{B as C,b as B,E as xe}from"./index-BQ2d9Nl-.js";import{C as ge,F as T,R as Ge}from"./utils-CSAAr35u.js";import{L as Je}from"./LinkOutlined-JOSCkpNe.js";import{S as _e}from"./StopOutlined-Brp_lgtP.js";import{S as je,H as Se}from"./SearchColumnDropdown-B0bsFa8L.js";import{u as ae}from"./useAntdTableHandler-emfNQVP0.js";import{u as ne}from"./useSort-CAv1je6x.js";import{u as oe}from"./useQuery-Bu9IAIDW.js";import{T as ie}from"./Table-BLuy6k3H.js";import{a as E,b as Xe,O as le}from"./index-M-PNOqPT.js";import{S as be,T as fe}from"./index-Dd5yBUji.js";import{h as $}from"./moment-DdbtTH-v.js";import{T as ve}from"./TransText-Bwe-759-.js";import{u as se}from"./useMutation-BvMljKdw.js";import{D as Te}from"./DeleteOutlined-BagnrRyR.js";import{c as ce,u as Ze,O as Ce,C as et}from"./useOrganizationUsers-CYMykAGJ.js";import{u as De,b as Ae,T as tt,a as st}from"./TransferOwnerButton-DI97qobE.js";import{A as rt,b as at}from"./ApprovalStatusTag-dKMrjHx_.js";import{$ as de,b as nt,A as F,a0 as ot,a1 as it,a2 as Ie,a3 as lt,c as Oe,a4 as ct}from"./calculateApprovalPermissions-CnuGdhfj.js";import"./IframeProvider-vVUS8qNT.js";import"./ShowConfirmModal-DicafaA2.js";import{u as dt}from"./useSearchParams-BP3QLRn4.js";import"./SpecifiedEventPlatform-B9h0Nb1l.js";import"./PlaceholderConditionFieldList-mPMYO8bp.js";import{u as ke,b as G,C as ut}from"./utils-DnLDlqer.js";import{O as mt}from"./index-BO9Q7TzK.js";import{D as Pe}from"./index-B2KRirKN.js";import{O as pt}from"./OperationRecordDrawer-BBF07Ppq.js";import{u as gt}from"./ActorDisplay-DiDNJQ05.js";import{d as ft}from"./react-router-dom-DXdvtoRG.js";import{S as wt}from"./SwapOutlined-DCyuWc0y.js";import"./Compact-PbnmyqLK.js";import"./useFlexGapSupport-jkLCp-NU.js";import"./react-error-boundary.esm-hP1M-t7m.js";import"./omit-D_5uR4aN.js";import"./hoist-non-react-statics.cjs-B15GkqZC.js";import"./ShareIcon-Daa_4X9g.js";import"./ReloadOutlined-d-A11tyo.js";import"./UndoOutlined-BS7nCL-M.js";import"./DownloadOutlined-1rVSR8g9.js";import"./UploadOutlined-Eo9-Qidj.js";import"./PlusCircleOutlined-C7fmi8Yg.js";import"./pickBy-CYN_Ov7V.js";import"./keys-coJY5a-s.js";import"./css-CG3sgCP8.js";import"./useForceUpdate-CMpVYnmX.js";import"./index-BblopUiD.js";import"./index-Esn6J2e9.js";import"./CaretDownOutlined-BYd2v7Ye.js";import"./index-AwK2lYAB.js";import"./index-D_yrCVzT.js";import"./useMultiHighlightColumnSearchProps-BVLImr4Y.js";import"./style-BlhGWqsG.js";import"./index-BmP7beDD.js";import"./ApprovalStepApprovers-BWkCAqFE.js";import"./Collapse-LzgIe7sE.js";import"./index-BCmZ69Bt.js";import"./isNonNullish-CATHZ622.js";import"./sqlCustomModels-Dbbm14NO.js";import"./customNodeDefinition-nBUW4KP2.js";import"./mergeDeep-CFVxAu1e.js";import"./useCustomModels-LN0ZcTkI.js";import"./isDefined-x_FWQwMl.js";import"./LogicDisplay-Bhnm8lxr.js";import"./index-B2sXcWmm.js";import"./PreviewErrorMessage-CArftAvw.js";import"./decryptOutputScope-NiJLBInJ.js";import"./index-BB-MwdT7.js";import"./isNumber-j3SIk7av.js";import"./index-CzGNaUv4.js";import"./const-K_CvloLi.js";import"./isIdentifier-CKfsgkS3.js";import"./LockOutlined-CJ80uljT.js";import"./FolderAddOutlined-PSfultct.js";import"./pipe-Boagcv_B.js";import"./groupBy-Bn_xKp8m.js";import"./unique-BlbLKNcy.js";import"./_reduceLazy-DGRijHJe.js";import"./uniqueBy-QILWJz80.js";import"./HistoryOutlined-Cu5Yc6-y.js";const ht=O(Ge).withConfig({displayName:"AccountInfoCard__AccountRow",componentId:"sc-1u696m0-0"})(["align-items:center;line-height:32px;"]),yt=O(B.Title).withConfig({displayName:"AccountInfoCard__Title",componentId:"sc-1u696m0-1"})(["&&{margin-bottom:0em;}"]);
3function xt(t,s){switch(s.type){case"close":return{open:!1,error:null};case"open":return{open:!0,formType:s.formType,size:s.size};case"error":return{...t,error:{type:s.errorType,msg:s.errorMsg}};default:throw new Error("Unsupported action...")}}const _t=({open:t,closeModal:s,refetchPermissionLog:r,forcedReason:a})=>{var y;const{t:n}=S(),[o]=T.useForm(),i=(y=T.useWatch(["newPassword"],o))!=null?y:"",{userInfo:d}=q(),{validatePasswordRules:p,validateConfirmPasswordRules:g,rules:c,isStrictPolicy:f,historyCount:m,expiryDays:l}=We({username:d==null?void 0:d.username,passwordFieldName:"newPassword",password:i}),u=!!a,_=async w=>{var j,A,x,h,v;const{currentPassword:b}=w;try{await R.patch("/ma_account/user/change-own-password/",{password:i,current_password:b},{bypassDefaultErrorHandler:!0}),we("alert/add",{message:n("msgUpdateSuccessfully")}),r==null||r(),Ve(Be({expired:!0}))}catch(I){((A=(j=I==null?void 0:I.response)==null?void 0:j.data)==null?void 0:A.ERR_MSG_KEY)==="setting.all.passwordRule.historyReused"?o.setFields([{name:"newPassword",errors:[n("setting.all.passwordRule.historyReused",{number:m})]}]):(v=(h=(x=I==null?void 0:I.response)==null?void 0:x.data)==null?void 0:h.ERR_MSG)!=null&&v.includes("Invalid current password")&&o.setFields([{name:"currentPassword",errors:[n("Current Password Invalid")]}])}};return e.jsxs(H,{open:t,title:n("changePassword"),closable:!u,onCancel:u?void 0:s,okButtonProps:{form:"password-form",key:"submit",htmlType:"submit"},cancelButtonProps:u?{style:{display:"none"}}:void 0,children:[u&&e.jsx(Ct,{type:"warning",showIcon:!0,message:a==="first_login"?n("setting.account.alert.firstLoginDesc"):n("setting.account.alert.expiredDesc",{number:l})}),e.jsxs(T,{form:o,layout:"vertical",id:"password-form",onFinish:_,children:[e.jsx(T.Item,{label:n("currentPassword"),name:"currentPassword",rules:[{required:!0}],children:e.jsx(V.Password,{})}),e.jsx(T.Item,{label:n("newPassword"),name:"newPassword",rules:p,extra:e.jsx(Qe,{rules:c,showNote:f,historyCount:m}),children:e.jsx(V.Password,{})}),e.jsx(T.Item,{label:n("confirmPassword"),name:"confirmPassword",rules:g,children:e.jsx(V.Password,{})})]})]})},jt=({open:t,closeModal:s,refetchPermissionLog:r})=>{const{t:a}=S(),[n]=T.useForm(),o=()=>{r==null||r(),s()};return e.jsx(H,{open:t,onCancel:s,okText:a("verify"),okButtonProps:{form:"set2FA-form",key:"submit",htmlType:"submit"},onOk:()=>n.submit(),children:e.jsx(Ne,{type:"modal",form:n,callback:o})})},St=({open:t,userId:s,closeModal:r,refetchPermissionLog:a})=>{const{t:n}=S(),{refetchUser:o}=q(),{deviceId:i}=ze(),d=()=>{we("activateOrCancel2FA",{userId:s,query:{is_activate_2FA:!1,device_id:i},callback:async()=>{await o(),r(),a==null||a()}})};return e.jsx(H,{open:t,onCancel:r,onOk:d,width:400,children:e.jsx("div",{children:n("msgConfirmCancel2FA")})})},bt=({open:t,closeModal:s,userId:r,modalProps:a,formProps:n,formContent:o})=>{const[i]=T.useForm(),{refetchUser:d}=q(),p=async g=>{await R.put("/ma_account/user/".concat(r,"/"),{info:g}),s(),i.resetFields(),d()};return e.jsx(H,{open:t,onCancel:()=>{s(),i.resetFields()},onOk:()=>i.submit(),...a,children:e.jsx(T,{layout:"vertical",form:i,onFinish:p,...n,children:o})})},vt=({open:t,formType:s,username:r,id:a,title:n,closeModal:o,email:i,fullname:d,refetchPermissionLog:p,forcedReason:g})=>{const{t:c}=S(),f={editFullname:{modalProps:{title:c("setting.edit.personalName")},formProps:{initialValues:{fullname:d}},formContent:e.jsx(T.Item,{label:c("setting.personalName"),required:!0,rules:[{required:!0}],name:"fullname",children:e.jsx(V,{})})},editTitle:{modalProps:{title:c("setting.edit.jobTitle")},formProps:{initialValues:{title:n}},formContent:e.jsx(T.Item,{label:c("setting.jobTitle"),required:!0,rules:[{required:!0}],name:"title",children:e.jsx(V,{})})},editEmail:{modalProps:{title:c("setting.account.editEmail")},formProps:{},formContent:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:c("setting.account.currentEmail")}),e.jsx("p",{children:i||"--"}),e.jsx(T.Item,{label:c("setting.account.newEmail"),required:!0,rules:[{required:!0},{type:"email"},{type:"string"}],name:"email",extra:c("setting.account.userEmail.infoText"),children:e.jsx(V,{})})]})}};switch(s){case"editPassword":return e.jsx(_t,{open:t,username:r,userId:a,closeModal:o,refetchPermissionLog:p,forcedReason:g});case"set2FA":return e.jsx(jt,{open:t,closeModal:o,userId:a,refetchPermissionLog:p});case"cancel2FA":return e.jsx(St,{open:t,closeModal:o,userId:a,refetchPermissionLog:p});case"editEmail":case"editTitle":case"editFullname":return e.jsx(bt,{open:t,closeModal:o,userId:a,...f[s]});default:return null}},Tt=({permissionLogsAxiosResult:t=[{},()=>{}]})=>{const{t:s}=S(),{modulePermissionSet:r,userInfo:a}=q(),{menu_hidden:n}=Me(),[,o]=t,{id:i,username:d,enable_2FA:p=!1,email:g="",title:c="",fullname:f="",is_ldap_user:m=!1,unit:l,employee_id:u=""}=a,_=r.has("Fubon"),y=pe(l,"DIVISION"),w=pe(l,"SECTION"),[b,j]=D.useReducer(xt,{open:!1,size:"tiny",formType:null,error:{}}
3),[A,x]=qe.useState(null),{open:h,formType:v}=b;D.useEffect(()=>{var K;const z=new URLSearchParams(window.location.search);if(z.get("force_change_password")==="true"){const Re=(K=z.get("reason"))!=null?K:"first_login";x(Re),j({type:"open",formType:"editPassword"})}},[]);const I=()=>{x(null),j({type:"close"})},M=()=>{j({type:"open",formType:"editPassword"})},k=()=>{j({type:"open",size:"mini",formType:"set2FA"})},re=()=>{j({type:"open",size:"mini",formType:"cancel2FA"})},L=z=>{j({type:"open",formType:z})},Ee=[{colLabel:s("account"),colContent:d},...m?[]:[{colLabel:s("password"),colContent:e.jsxs(P,{size:"middle",children:["********",e.jsx(W,{"data-test-id":"edit-password-button",icon:"edit",onClick:M,size:"small"})]})}],{colLabel:s("setting.personalName"),colContent:e.jsxs(P,{size:"middle",children:[f||"--",!m&&e.jsx(W,{icon:"edit",onClick:()=>L("editFullname"),size:"small"})]})},...m?[]:[{colLabel:s("setting.jobTitle"),colContent:e.jsxs(P,{size:"middle",children:[c||"--",e.jsx(W,{icon:"edit",onClick:()=>L("editTitle"),size:"small"})]})}],..._?[{colLabel:s("all.account.employeeId"),colContent:u||"--"},{colLabel:s("all.account.divisionInfo"),colContent:y||"--"},{colLabel:s("all.account.sectionInfo"),colContent:w||"--"}]:[],{colLabel:s("email"),colContent:e.jsxs(P,{size:"middle",children:[g||"--",!m&&e.jsx(W,{icon:"edit",onClick:()=>L("editEmail"),size:"small"})]})},...!(n!=null&&n.two_factor_authentication)&&!m?[{colLabel:s("twoFactorAuth"),colContent:e.jsxs(P,{size:"middle",children:[s(p?"isActive":"notActive"),p?e.jsxs(e.Fragment,{children:[e.jsx(C,{onClick:k,icon:e.jsx(Je,{}),children:s("reset")}),!r.has("TwoFactorAuthentication")&&e.jsx(C,{onClick:re,icon:e.jsx(_e,{}),children:s("deactivate")})]}):e.jsx(C,{onClick:k,type:"primary",children:s("setting")})]})}]:[]];return e.jsxs("div",{children:[d&&e.jsxs(Dt,{"data-test-id":"account-info-section",children:[e.jsx(ee,{src:window.__getStaticUrl__("images/icons/ic_account.svg"),text:s("account")+"/"+s("password"),color:te.colorPalette.blue5}),e.jsx(At,{direction:"vertical",size:"middle",children:Ee.map(({colLabel:z,colContent:K})=>e.jsxs(ht,{children:[e.jsx(ge,{span:3,children:e.jsx(yt,{level:5,children:z})}),e.jsx(ge,{children:K})]},z))})]}),e.jsx(vt,{open:h,formType:v,username:d,id:i,title:c,closeModal:I,email:g,fullname:f,refetchPermissionLog:o,forcedReason:A})]})};var Ct=O(he).withConfig({displayName:"AccountInfoCard___StyledAlert",componentId:"sc-1u696m0-2"})(["margin-bottom:16px;"]),Dt=O(Z).withConfig({displayName:"AccountInfoCard___StyledSectionCard",componentId:"sc-1u696m0-3"})(["display:flex;flex-direction:column;gap:16px;"]),At=O(P).withConfig({displayName:"AccountInfoCard___StyledSpace",componentId:"sc-1u696m0-4"})(["display:flex;"]);const It=()=>{var f;const{t}=S(),[s,r]=D.useState(null),{sortState:a,onSort:n,buildSortOrder:o}=ne({sortBy:"end_time",isAsc:!1}),{pagination:i,handleTableChange:d}=ae({onSort:n}),p={status:"expired",page:i.page,delegate_username:s||void 0,sort_by:a.sortBy||void 0,ascending:a.sortBy==="end_time"?a.isAsc:void 0},{data:g,isLoading:c}=oe({queryKey:["/ma_approval/delegations/",p],queryFn:async()=>(await R.get("/ma_approval/delegations/",{params:p})).data});return e.jsx(ie,{rowKey:"id",dataSource:(f=g==null?void 0:g.results)!=null?f:[],loading:c,onChange:d,pagination:{current:i.page,pageSize:i.pageSize,total:g==null?void 0:g.count,showSizeChanger:!1},columns:[{title:t("setting.account.jobSubstitute"),width:347,render:(m,l)=>e.jsx(Se,{highlightStyle:{color:"var(--primary-color)"},highlightTag:"span",searchWords:[s!=null?s:""],autoEscape:!0,textToHighlight:l.delegate_username}),filterIcon:e.jsx(ye,{}),filterDropdown:m=>e.jsx(je,{...m,onSearch:l=>{r(String(l))}})},{title:t("setting.account.substitutionPeriod"),width:347,dataIndex:"end_time",sorter:!0,sortOrder:o(a,"end_time"),render:(m,l)=>e.jsxs("div",{children:[U(l.start_time,"YYYY-MM-DD HH:mm")," ","~"," ",U(l.end_time,"YYYY-MM-DD HH:mm")]})}]})},J=t=>typeof t=="object"&&t!==null,Ot=t=>{if(!J(t)||!J(t.response))return;const{status:s,data:r}=t.response;return{status:typeof s=="number"?s:void 0,data:r}},kt=t=>
3{if(!J(t)||t.ERR_MSG_KEY!=="setting.account.jobSubstitute.error.substitutionOverlap")return null;const s={};if(J(t.INTP_VALUE))for(const[r,a]of Object.entries(t.INTP_VALUE))typeof a=="string"&&(s[r]=a);return s},Pt=({error:t})=>{const{t:s}=S();if(!t)return null;const r=Ot(t),a=kt(r==null?void 0:r.data),n=a?e.jsx(ve,{i18nKey:"setting.account.jobSubstitute.error.substitutionOverlap",values:a,"data-test-id":"delegation-overlap-error"}):Ke(r,s);return e.jsx(he,{type:"error",showIcon:!0,message:n})},Fe=({initialValues:t={},onFinish:s,isDelegateSelectDisabled:r=!1,isPeriodRangePickerDisabled:a=!1,submitError:n=null,onValuesChange:o})=>{const{t:i}=S(),[d]=E.useForm(),p=n?"error":void 0,g=Array.isArray(a)&&a[0]===!0,c=g&&Array.isArray(t==null?void 0:t.period)&&$.isMoment(t.period[0])?t.period[0]:null,{data:f,isLoading:m}=oe({queryKey:["/ma_approval/delegations/delegate_options/"],queryFn:async()=>(await R.get("/ma_approval/delegations/delegate_options/")).data,placeholderData:[]});return e.jsxs(E,{form:d,layout:"vertical",initialValues:t,onValuesChange:o,onFinish:l=>{const{period:u,..._}=l,y=g&&$.isMoment(c)?c:u[0],w=u[1];s({..._,start_time:ue(y),end_time:ue(w)})},children:[e.jsx(E.Item,{name:"delegate_user_id",label:i("setting.account.jobSubstitute"),rules:[{required:!0}],validateStatus:p,children:e.jsx(Xe,{allowClear:!0,showSearch:!0,optionFilterProp:"label",loading:m,placeholder:i("all.pleaseSelect"),options:f.map(l=>({value:l.id,label:l.username})),disabled:r})}),e.jsx(E.Item,{name:"period",label:i("setting.account.substitutionPeriod"),validateStatus:p,rules:[{required:!0},{validator:(l,u)=>{if(!Array.isArray(u)||!u.every(w=>$.isMoment(w)))return Promise.resolve();const[,_]=u,y=$();return _.isBefore(y)?Promise.reject(new Error(i("setting.account.jobSubstitute.error.substitutionExpired"))):Promise.resolve()}}],normalize:l=>{if(!Array.isArray(l)||!l.every(b=>$.isMoment(b)))return l;const[u,_]=l,y=g&&$.isMoment(c)?c.clone():u.clone(),w=_.clone();return y.set("second",0),w.set("second",59),y.isSame(w,"minute")?[y,w.clone().add(1,"minute")]:[y,w]},children:e.jsx(Ft,{noPast:g?{disableSelection:!0,normalizeOnChange:!1}:!0,showTime:!0,disabled:a,allowClear:!1,format:"YYYY-MM-DD HH:mm",placeholder:[i("startingTime"),i("all.endTime")]})}),e.jsx(Pt,{error:n})]})};var Ft=O($e).withConfig({displayName:"DelegationForm___StyledBbDateRangePicker",componentId:"sc-1piw92z-0"})(["width:100%;"]);const Et=({record:t,onDelete:s})=>{const{t:r}=S(),{id:a}=t,n=X(),{mutateAsync:o}=se({mutationKey:["/ma_approval/delegations/".concat(a,"/")],mutationFn:async()=>(await R.delete("/ma_approval/delegations/".concat(a,"/"))).data,onSuccess:async()=>{n.invalidateQueries({queryKey:["/ma_approval/delegations/"]})}});return e.jsx(C,{"data-test-id":"delete-delegation-".concat(t.id),icon:e.jsx(Te,{}),onClick:()=>{H.confirm({title:r("all.deleteConfirm"),okText:r("delete"),content:r("all.deleteObjectConfirm.description"),okType:"danger",okButtonProps:{"data-test-id":"confirm-delete-delegation-".concat(a)},onOk:async()=>{await o(),await s()}})},children:r("delete")})},N={in_progress:"in_progress",not_started:"not_started"},Rt=({record:t})=>{const{t:s}=S(),[r,a]=D.useState(!1),[n,o]=D.useState(null),i=t.status===N.in_progress,d=X(),{mutateAsync:p,isPending:g}=se({mutationKey:["/ma_approval/delegations/".concat(t.id,"/")],mutationFn:async c=>(await R.patch("/ma_approval/delegations/".concat(t.id,"/"),c,{bypassDefaultErrorHandler:!0})).data,onSuccess:async()=>{await d.invalidateQueries({queryKey:["/ma_approval/delegations/"]}),Y.success(s("msgUpdateSuccessfully"))}});return e.jsx(le,{destroyOnClose:!0,title:s("all.editResource",{resource:s("setting.account.jobSubstitute")}),open:r,onOpenChange:c=>{a(c),o(null)},renderTrigger:({open:c})=>e.jsx(C,{"data-test-id":"edit-delegation-".concat(t.id),onClick:c,icon:e.jsx(xe,{}),children:s("edit")}),footer:({onCancel:c,getForm:f})=>e.jsxs(e.Fragment,{children:[e.jsx(C,{onClick:c,children:s("all.cancel")}),e.jsx(C,{"data-test-id":"submit-edit-delegation-".concat(t.id),type:"primary",loading:g,onClick:()=>{const m=f();m==null||m.validateFields().then(()=>
3m.submit()).catch(()=>{})},children:s("all.ok")})]}),children:e.jsx(Fe,{initialValues:{delegate_user_id:t.delegate,period:[me(t.start_time),me(t.end_time)]},isDelegateSelectDisabled:i,isPeriodRangePickerDisabled:i?[!0,!1]:!1,submitError:n,onValuesChange:()=>o(null),onFinish:async c=>{const{delegate_user_id:f,start_time:m,end_time:l}=c;try{await p(i?{end_time:l}:{delegate_user_id:f,start_time:m,end_time:l}),a(!1)}catch(u){o(u)}}})})},qt=({record:t,onTerminate:s})=>{const{t:r}=S(),{id:a}=t,n=X(),{mutateAsync:o}=se({mutationKey:["/ma_approval/delegations/".concat(a,"/terminate/")],mutationFn:async()=>(await R.post("/ma_approval/delegations/".concat(a,"/terminate/"))).data,onSuccess:async()=>{await n.invalidateQueries({queryKey:["/ma_approval/delegations/"]})}});return e.jsx(C,{"data-test-id":"terminate-delegation-".concat(t.id),icon:e.jsx(_e,{}),onClick:()=>{H.confirm({title:r("setting.account.confirmTerminateSubstitution.title"),okText:r("all.terminate"),content:r("setting.account.confirmTerminateSubstitution.desc"),okType:"danger",okButtonProps:{"data-test-id":"confirm-terminate-delegation-".concat(a)},onOk:async()=>{await o(),await s()}})},children:r("all.terminate")})},Mt=()=>{var A;const{t}=S(),[s,r]=D.useState(null),[a,n]=D.useState(!1),[o,i]=D.useState(null),{sortState:d,onSort:p,buildSortOrder:g}=ne({sortBy:"start_time",isAsc:!0}),{pagination:c,handleTableChange:f,filters:m,setPagination:l}=ae({onSort:p}),u=X(),_={page:c.page,delegate_username:s,sort_by:d.sortBy||void 0,ascending:d.sortBy==="start_time"?d.isAsc:void 0,status:m.status},{data:y,isLoading:w}=oe({queryKey:["/ma_approval/delegations/",_],queryFn:async()=>(await R.get("/ma_approval/delegations/",{params:_})).data}),{mutateAsync:b,isPending:j}=se({mutationKey:["/ma_approval/delegations/"],mutationFn:async x=>(await R.post("/ma_approval/delegations/",x,{bypassDefaultErrorHandler:!0})).data,onSuccess:async()=>{await u.invalidateQueries({queryKey:["/ma_approval/delegations/"]}),Y.success(t("msgCreateSuccessfully"))}});return e.jsxs(zt,{children:[e.jsx(le,{destroyOnClose:!0,title:t("all.addResource",{resource:t("setting.account.jobSubstitute")}),open:a,onOpenChange:x=>{n(x),i(null)},renderTrigger:({open:x})=>e.jsx(Nt,{"data-test-id":"add-delegation",type:"primary",icon:e.jsx(Ye,{}),onClick:x,children:t("add")}),footer:({onCancel:x,getForm:h})=>e.jsxs(e.Fragment,{children:[e.jsx(C,{onClick:x,children:t("all.cancel")}),e.jsx(C,{"data-test-id":"submit-delegation",type:"primary",loading:j,onClick:()=>{const v=h();v==null||v.validateFields().then(()=>
3v.submit()).catch(()=>{})},children:t("all.ok")})]}),children:e.jsx(Fe,{submitError:o,onValuesChange:()=>i(null),onFinish:async x=>{try{await b(x),n(!1)}catch(h){i(h)}}})}),e.jsx(ie,{rowKey:"id",dataSource:(A=y==null?void 0:y.results)!=null?A:[],loading:w,onChange:f,pagination:{current:c.page,pageSize:c.pageSize,total:y==null?void 0:y.count,showSizeChanger:!1},columns:[{title:t("setting.account.jobSubstitute"),width:347,render:(x,h)=>e.jsx(Se,{highlightStyle:{color:"var(--primary-color)"},highlightTag:"span",searchWords:[s!=null?s:""],autoEscape:!0,textToHighlight:h.delegate_username}),filterIcon:e.jsx(ye,{}),filterDropdown:x=>e.jsx(je,{...x,onSearch:h=>{r(String(h))}})},{title:t("setting.account.substitutionPeriod"),width:347,dataIndex:"start_time",sorter:!0,sortOrder:g(d,"start_time"),render:(x,h)=>e.jsxs("div",{children:[U(h.start_time,"YYYY-MM-DD HH:mm")," ","~"," ",U(h.end_time,"YYYY-MM-DD HH:mm")]})},{title:t("status"),width:144,dataIndex:"status",filters:[{value:N.in_progress,text:t("setting.account.jobSubstitute.inProgress")},{value:N.not_started,text:t("setting.account.jobSubstitute.notStarted")}],filterMultiple:!1,render:(x,h)=>e.jsx("div",{children:e.jsx(be,{status:h.status,style:{width:"fit-content"},statusMap:{[N.in_progress]:{color:"volcano",text:t("setting.account.jobSubstitute.inProgress")},[N.not_started]:{color:"default",text:t("setting.account.jobSubstitute.notStarted")}}})})},{title:t("action"),width:230,render:(x,h)=>e.jsxs(P,{children:[e.jsx(Rt,{record:h}),h.status===N.not_started&&e.jsx(Et,{record:h,onDelete:()=>{l(v=>({...v,page:1}))}}),h.status===N.in_progress&&e.jsx(qt,{record:h,onTerminate:()=>{l(v=>({...v,page:1}))}})]})}]})]})};var zt=O("div").withConfig({displayName:"ScheduledDelegationTab___StyledDiv",componentId:"sc-1fwsvaw-0"})(["display:flex;flex-direction:column;gap:16px;"]),Nt=O(C).withConfig({displayName:"ScheduledDelegationTab___StyledButton",componentId:"sc-1fwsvaw-1"})(["width:fit-content;"]);const Vt=()=>{const{t}=S();return e.jsxs(Bt,{"data-test-id":"delegation-setting-section",children:[e.jsx(ee,{src:window.__getStaticUrl__("images/icons/ic_setting.svg"),text:t("setting.account.jobSubstitute"),color:te.colorPalette.blue5}),e.jsx(He,{items:[{key:"activePendingDelegation",label:t("setting.account.activeSubstitution"),children:e.jsx("div",{children:e.jsx(Mt,{})})},{key:"expiredDelegation",label:t("setting.account.expiredSubstitution"),children:e.jsx(It,{})}]})]})};var Bt=O(Z).withConfig({displayName:"DelegationSettings___StyledSectionCard",componentId:"sc-1oby9az-0"})(["display:flex;flex-direction:column;gap:16px;"]);const $t=({disabled:t,loading:s,onBeforeSubmit:r})=>{const{t:a}=S(),{setActiveDrawer:n}=ot(),[o,i]=D.useState(!1),d=async()=>{i(!0);try{await r(),n("submit")}finally{i(!1)}};return e.jsx(C,{type:"primary",disabled:t,loading:o||s,onClick:d,children:a("Review Application")})},Yt=({renderTrigger:t})=>{var j,A;const{t:s}=S(),{userInfo:r}=q(),[a,n]=D.useState(!1),[o,i]=D.useState(null),[d]=T.useForm(),p=de(),g=(j=T.useWatch(["workflow"],d))!=null?j:{},c=(A=T.useWatch(["template"],d))!=null?A:{},{resources:f}=ce({params:{transferable_only:!0},enabled:a}),m=De(),{checkValidTransferResults:l,validateTransfers:u,isPending:_}=ke({active:a}),{mutateAsync:y}=nt(),w=()=>{d.resetFields()},{allTransfers:b}=G({workflowValues:g,templateValues:c});return e.jsxs(F,{entity:{type:"owner_transfer",id:o,approvalRequest:null},permissions:{canSubmitApproval:!0},triggers:null,onClose:w,children:[e.jsx(mt,{destroyOnClose:!0,width:880,onOpenChange:n,title:s("ownerTransfer.transferOwner"),renderTrigger:t,onClose:w,renderExtra:({close:x})=>e.jsxs(P,{children:[e.jsx(C,{onClick:x,children:s("all.cancel")}),e.jsx($t,{disabled:b.length===0,loading:_,onBeforeSubmit:async()=>{const{name:h}=await d.validateFields(),{results:v}=await u(b),{validTransfers:I,invalidTransfers:M}=G({workflowValues:g,templateValues:c,checkValidTransferResults:v});await m({invalidTransfers:M,resources:f});const k=await y({name:h,items:I});Y.success(s("msgCreateSuccessfully")),i(k.id),x()}})]}),children:e.jsxs(T,{layout:"vertical",form:d,initialValues:{selectedRowKeys:[]},children:[e.jsx(T.Item,{label:s("setting.account.transferTask.taskName"),name:"name",rules:[{required:!0}],children:e.jsx(V,{placeholder:s("all.pleaseInput")})}),e.jsx(T.Item,{label:s("ownerTransfer.currentOwner"),children:e.jsx(B.Text,{type:"secondary",children:r.display_name})}),e.jsx(Ae,{enabledQuery:a,resources:f,validateTransfers:u,checkValidTransferResults:l,excludeAssigneeIds:[r.id]})]})}),e.jsx(F.SubmitDrawer,{onSuccess:()=>{Y.success(s("all.approvalProcess.successfullyAppliedForReview")),p()}})]})},Ht=({task:t,disabled:s})=>{const{t:r}=S(),{mutateAsync:a}=it(),n=()=>{le.confirm({title:e.jsx(ve,{i18nKey:"all.confirm.deleteObject",values:{object:t.name},components:{alert:e.jsx(B.Text,{type:"danger"})}}),content:r("all.deleteObjectConfirm.description"),okText:r("all.delete"),okType:"danger",onOk:async()=>{await a(t.id),Y.success(r("msgDeleteSuccessfully"))}})};return e.jsx(C,{icon:e.jsx(Te,{}),disabled:s,onClick:n})},Lt=t=>{const s={workflow:{},template:{}};for(const r of t)s[r.resource_type][String(r.resource_id)]=r.new_owner;return s},Ut=({taskId:t,open:s,onClose:r,afterOpenChange:a})=>{var x,h,v,I,M;const{t:n}=S(),{userInfo:o}=q(),{data:i,isLoading:d}=Ie(t),p=de(),{mutateAsync:g}=lt(),[c]=E.useForm(),{checkValidTransferResults:f,validateTransfers:m,isPending:l}=ke({active:s}),u=i==null?void 0:i.items,{resources:_}=ce({params:{transferable_only:!0},enabled:s}),y=(x=E.useWatch(["workflow"],c))!=null?x:{},w=(h=E.useWatch(["template"],c))!=null?h:{},b=De(),{allTransfers:j}=G({workflowValues:y,templateValues:w}),A=D.useRef(!1);return D.useEffect(()=>{!(u!=null&&u.length)||A.current||(A.current=!0,m(u.map(k=>({resource_type:k.resource_type,resource_id:k.resource_id,new_owner_id:k.new_owner}))))},[u,m]),e.jsx(Kt,{title:e.jsx(B.Text,{ellipsis:{tooltip:{title:"".concat(n("ownerTransfer")," - ").concat(i==null?void 0:i.name),placement:"bottom"}},children:"".concat(n("ownerTransfer")," - ").concat(i==null?void 0:i.name)}),open:s,onClose:r,afterOpenChange:a,destroyOnClose:!0,width:840,extra:e.jsxs(F,{entity:{type:"owner_transfer",id:t,approvalRequest:((v=i==null?void 0:i.approval_request)==null?void 0:v.request_id)!=null?{request_id:i.approval_request.request_id,status:i.approval_request.status}:null},permissions:Oe({approvalRequestStatus:(M=(I=i==null?void 0:i.approval_request)==null?void 0:I.status)!=null?M:null}),onBeforeOpenSubmitDrawer:async()=>{const{results:k}
3=await m(j),{validTransfers:re,invalidTransfers:L}=G({workflowValues:y,templateValues:w,checkValidTransferResults:k});await b({invalidTransfers:L,resources:_}),await g({taskId:t,items:re})},triggers:{submit:e.jsx(C,{type:"primary",disabled:j.length===0,loading:l,children:n("Review Application")})},children:[e.jsx(F.SubmitDrawer,{onSuccess:()=>{Y.success(n("all.approvalProcess.successfullyAppliedForReview")),p(),r()}}),e.jsx(F.WithdrawDrawer,{onSuccess:()=>{p(),r()}}),e.jsx(F.SubmissionInfoDrawer,{}),e.jsx(F.RejectionInfoDrawer,{})]}),children:!d&&e.jsxs(E,{form:c,layout:"vertical",initialValues:Lt(u!=null?u:[]),children:[e.jsx(E.Item,{label:n("ownerTransfer.currentOwner"),children:e.jsx(B.Text,{type:"secondary",children:o.display_name})}),e.jsx(Ae,{enabledQuery:s,resources:_,validateTransfers:m,checkValidTransferResults:f,excludeAssigneeIds:[o.id]})]})})};var Kt=O(Pe).withConfig({displayName:"EditTaskDrawer___StyledDrawer",componentId:"sc-hlucn1-0"})(["& .ant-drawer-title{overflow:hidden;}"]);const Wt=()=>{const{t}=S(),s=gt();return r=>{switch(r.action){case"EDIT":return t("update");case"FULLY_APPROVED":return t("all.approvalProcess.approve");case"COMPLETED":return t("all.approvalProcess.complete");case"AUTO_REJECTED":return t("all.approvalProcess.systemAutoRejected");default:return s(r)}}},Qt=({taskId:t})=>{const s=Wt();return e.jsx(pt,{endpoint:"/ma_account/owner-transfer-task/".concat(t,"/get-action-histories/"),getActionLabel:s})},Gt=({taskId:t,open:s,onClose:r,afterOpenChange:a})=>{var m,l,u,_,y;const{t:n}=S(),{data:o,isLoading:i}=Ie(t),d=de(),{users:p}=Ze({params:{is_active:"all"},enabled:s}),g=new Map(p.map(w=>[w.id,w.username])),f=((m=o==null?void 0:o.items)!=null?m:[]).map(w=>{var b,j;return{...w,id:w.resource_id,media_type:(j=(b=w.media_type)==null?void 0:b.toLowerCase())!=null?j:w.media_type}});return e.jsx(Jt,{title:e.jsx(B.Text,{ellipsis:{tooltip:{title:"".concat(n("ownerTransfer")," - ").concat(o==null?void 0:o.name),placement:"bottom"}},children:"".concat(n("ownerTransfer")," - ").concat(o==null?void 0:o.name)}),open:s,onClose:r,afterOpenChange:a,destroyOnClose:!0,width:840,extra:e.jsxs(F,{entity:{type:"owner_transfer",id:t,approvalRequest:((l=o==null?void 0:o.approval_request)==null?void 0:l.request_id)!=null?{request_id:o.approval_request.request_id,status:o.approval_request.status}:null},permissions:Oe({approvalRequestStatus:(_=(u=o==null?void 0:o.approval_request)==null?void 0:u.status)!=null?_:null}),children:[e.jsx(F.WithdrawDrawer,{onSuccess:()=>{d(),r()}}),e.jsx(F.SubmissionInfoDrawer,{})]}),children:!i&&e.jsx(e.Fragment,{children:e.jsx(Ce,{resources:f,tableProps:{pagination:!1},resourceNameWidth:192,extraColumns:[{title:n("ownerTransfer.assignee"),width:192,key:"assignee",render:(w,b)=>{var j;return e.jsx(B.Text,{type:"secondary",children:(j=g.get(b.new_owner))!=null?j:""})}},...((y=o==null?void 0:o.approval_request)==null?void 0:y.status)==="COMPLETED"?[{title:n("Status"),width:192,key:"status",render:(w,b)=>e.jsxs(P,{children:[e.jsx(be,{status:b.status,style:{width:"fit-content"},statusMap:{TRANSFERRED:{text:n("Success"),color:fe.green},INVALIDATED:{text:n("Fail"),color:fe.red}}}),b.error_code&&e.jsx(Le,{icon:"warn",content:e.jsx(ut,{errorCode:b.error_code}),iconColor:{plain:"var(--warning-color)",hover:"var(--warning-color)"}})]})}]:[]]})})})};var Jt=O(Pe).withConfig({displayName:"ViewTaskDrawer___StyledDrawer",componentId:"sc-lzyv62-0"})(["& .ant-drawer-title{overflow:hidden;}"]);const Xt=({task:t,onView:s,onEdit:r})=>e.jsxs(P,{size:"small",children:[t.is_approval_editable?e.jsx(C,{icon:e.jsx(xe,{}),onClick:()=>r(t.id)}):e.jsx(C,{icon:e.jsx(Ue,{}),onClick:()=>s(t.id)}),e.jsx(Ht,{task:t,disabled:!t.is_approval_editable}),e.jsx(Qt,{taskId:t.id})]}),Zt=["ascend","descend","ascend"],es=()=>{var c;const{sortState:t,onSort:s,buildSortOrder:r}=ne({sortBy:"last_update_time",isAsc:!1}),{pagination:a,handleTableChange:n,filters:o}=ae({onSort:s}),d=((f,m)=>f?"".concat(m?"":"-").concat(f):void 0)(t.sortBy,t.isAsc),{data:p,isLoading:g}=ct({page:a.page,page_size:a.pageSize,ordering:d,approval_status_filter:(c=o.approval_request)!=null?c:void 0});return{tableProps:{dataSource:p==null?void 0:p.results,onChange:n,loading:g,pagination:{hideOnSinglePage:!0,total:p==null?void 0:p.count,current:a.page,pageSize:a.pageSize,showSizeChanger:!1},sortDirections:Zt},buildColumnSort:f=>r(t,f)}},ts=()=>{var m;const{t}=S(),{searchParams:s}=dt(),r=ft(),{tableProps:a,buildColumnSort:n}=es(),o=s.get("task_id"),i=(m=s.get("mode"))!=null?m:"view",[d,p]=D.useState(o?{mode:i,taskId:Number(o),open:!0}:null),g=(l,u)=>{p({mode:l,taskId:u,open:!0})},c=()=>{p(l=>l?{...l,open:!1}:null)},f=l=>{if(!l){p(null);const u=new URLSearchParams(s);u.delete("task_id"),u.delete("mode"),r.replace({search:u.toString()})}};return e.jsxs(e.Fragment,{children:[e.jsx(ie,{rowKey:"id",size:"middle",columns:[{title:t("setting.account.transferTask.taskName"),dataIndex:"name",key:"name",width:"30%",render:l=>e.jsx(et,{text:l})},{title:t("setting.account.transferTask.transferCount"),dataIndex:"item_count",key:"item_count",width:"30%",render:l=>l},{title:t("Approval Status"),dataIndex:"approval_request",key:"approval_request",width:"12%",filters:at(["NOT_SUBMITTED","PENDING","COMPLETED","REJECTED"]),render:l=>e.jsx(rt,{status:l==null?void 0:l.status,style:{width:"fit-content"}})},{title:t("Last Update Time"),dataIndex:"last_update_time",key:"last_update_time",width:"16%",sorter:!0,sortOrder:n("last_update_time"),render:l=>U(l,"YYYY-MM-DD HH:mm:ss")},{title:t("setting.all.action"),key:"action",render:(l,u)=>e.jsx(Xt,{task:u,onView:_=>g("view",_),onEdit:_=>g("edit",_)})}],...a}
3),d&&(d.mode==="edit"?e.jsx(Ut,{taskId:d.taskId,open:d.open,onClose:c,afterOpenChange:f}):e.jsx(Gt,{taskId:d.taskId,open:d.open,onClose:c,afterOpenChange:f}))]})},ss=()=>{const{t}=S();return e.jsx(Z,{children:e.jsxs(Q,{flexDirection:"column",gap:16,children:[e.jsxs(Q,{justifyContent:"space-between",children:[e.jsx(ee,{src:window.__getStaticUrl__("images/icons/ic_record_list.svg"),text:t("setting.account.transferTask"),color:te.colorPalette.blue5}),e.jsx(Yt,{renderTrigger:({open:s})=>e.jsx(C,{"data-test-id":"owner-transfer-task-open",icon:e.jsx(wt,{}),onClick:s,children:t("ownerTransfer.transferOwner")})})]}),e.jsx(ts,{})]})})},rs=()=>{const{t}=S(),{resources:s,isFetching:r}=ce(),{modulePermissionSet:a}=q(),n=a.has("ApprovalProcess");return e.jsxs(e.Fragment,{children:[e.jsxs(as,{"data-test-id":"resource-owner-transfer",children:[e.jsxs(Q,{justifyContent:"space-between",children:[e.jsx(ee,{src:window.__getStaticUrl__("images/icons/ic_setting.svg"),text:t("setting.account.ownedResources"),color:te.colorPalette.blue5}),e.jsxs(Q,{gap:8,children:[!n&&e.jsx(tt,{}),e.jsx(st,{})]})]}),e.jsx(Ce,{resourceNameWidth:572,resources:s,tableProps:{loading:r}})]}),n&&e.jsx(ss,{})]})};var as=O(Z).withConfig({displayName:"ResourceOwner___StyledSectionCard",componentId:"sc-1pxri8m-0"})(["display:flex;flex-direction:column;gap:16px;"]);const Br=t=>{const{modulePermissionSet:s}=q();return e.jsxs(ns,{children:[e.jsx(Tt,{permissionLogsAxiosResult:t.permissionLogsAxiosResult}),s.has("OwnerLock")&&e.jsx(rs,{}),s.has("ApprovalProcess")&&e.jsx(Vt,{})]})};var ns=O("div").withConfig({displayName:"Account___StyledDiv",componentId:"sc-qflo45-0"})(["display:flex;flex-direction:column;gap:24px;margin:24px;"]);export{Br as AccountSettings};
4
5//# debugId=253024ad-4b40-55e1-ad52-8cd39ee9ee50

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.