PageSourceSearch

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

js omnisegment.com collected 2026-10-07 15:22:57 UTC 25,980 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]="5effac5a-0090-58bb-8ebb-757e347a89ba")}catch(e){}}();
3import{r as q,j as e,e as v,K as G,n as ge}from"./index.modern-Bk2HkT0W.js";import{S as le}from"./SectionCard-JS35EyeR.js";import{I as ie}from"./IconHeader-CIpOlg9o.js";import{o as ce}from"./omniStyles-D0WK32US.js";import{aO as D,ar as pe,aU as T,b4 as R,P as xe,b3 as ve}from"./i18next-CszFfP19.js";import{O as H,a as x,b as J}from"./index-M-PNOqPT.js";import{S as fe}from"./index-Dd5yBUji.js";import{H as we,S as Se}from"./SearchColumnDropdown-B0bsFa8L.js";import{aQ as de,J as Y,ak as je,a5 as B,u as ue,I as be,s as X,A as Pe,N as Ae,V as Ce,F as Ie,Q as ke,G as Fe}from"./main-LStdChlz.js";import{u as K}from"./useQuery-Bu9IAIDW.js";import{T as V}from"./Table-BLuy6k3H.js";import{B as b,b as E,E as qe}from"./index-BQ2d9Nl-.js";import{D as Te}from"./DownloadOutlined-1rVSR8g9.js";import{F as De}from"./utils-CSAAr35u.js";import{C as U}from"./index-D-ik_bUf.js";import{A as Me}from"./ApprovalStepApprovers-BWkCAqFE.js";import{g as Ne}from"./style-BlhGWqsG.js";import{u as Oe}from"./useAntdTableHandler-emfNQVP0.js";import{u as Ee}from"./useSort-CAv1je6x.js";import{T as Ue}from"./TransText-Bwe-759-.js";import{C as Z}from"./index-CREkANFA.js";import{C as Ge}from"./index-Esn6J2e9.js";import{D as me}from"./DeleteOutlined-BagnrRyR.js";import{u as te}from"./useMutation-BvMljKdw.js";import{i as Be,a as He}from"./isNonNullish-CATHZ622.js";import{p as Ke}from"./pickBy-CYN_Ov7V.js";import{o as $e}from"./omit-D_5uR4aN.js";import"./moment-DdbtTH-v.js";import"./index-AwK2lYAB.js";import"./useForceUpdate-CMpVYnmX.js";import"./index-D_yrCVzT.js";import"./Compact-PbnmyqLK.js";import"./useFlexGapSupport-jkLCp-NU.js";import"./react-router-dom-DXdvtoRG.js";import"./hoist-non-react-statics.cjs-B15GkqZC.js";import"./react-error-boundary.esm-hP1M-t7m.js";import"./css-CG3sgCP8.js";import"./index-BblopUiD.js";import"./CaretDownOutlined-BYd2v7Ye.js";import"./keys-coJY5a-s.js";const ae=10,Le=10*1e3,Re=()=>{var g;const{t}=D(),[a,h]=q.useState(!1),[u,s]=q.useState(1),_={page:u,page_size:ae},{data:r,isLoading:n}=K({queryKey:["/ma_approval/history-export/",_],queryFn:async()=>(await T.get("/ma_approval/history-export/",{params:_})).data,enabled:a,refetchInterval:d=>(d==null?void 0:d.results.some(y=>["pending","running"].includes(y.state)))?Le:!1});return e.jsx(H,{width:900,onOpenChange:d=>{h(d)},destroyOnClose:!0,title:t("all.exportResource",{resource:t("setting.approvalProcess.approvalHistory")}),onCancel:()=>{s(1)},renderTrigger:({open:d})=>e.jsx(b,{"data-test-id":"approval-history-export-log",onClick:d,children:t("setting.approvalProcess.exportLog")}),footer:null,children:e.jsx(V,{loading:n,rowKey:"id",dataSource:(g=r==null?void 0:r.results)!=null?g:[],pagination:{current:u,pageSize:ae,total:r==null?void 0:r.count,showSizeChanger:!1,onChange:d=>{s(d)}},columns:[{title:t("fileName"),key:"filename",dataIndex:"filename"},{title:t("setting.approvalProcess.exportDataYearMonth"),key:"export_month",dataIndex:"export_month"},{title:t("actionTime"),key:"created_at",render:(d,i)=>de(i.created_at,"YYYY-MM-DD HH:mm")},{title:t("status"),key:"state",render:(d,i)=>{const y=i.state;return e.jsx(fe,{statusMap:{pending:{text:t("all.ReportStatus.InProgress"),color:"volcano"},running:{text:t("all.ReportStatus.InProgress"),color:"volcano"},completed:{text:t("completed"),color:"green"},failed:{text:t("all.ReportStatus.failed"),color:"red"}},status:y})}},{title:t("action"),key:"action",render:(d,i)=>{const y=i.is_downloadable,A=y?"/ma_approval/history-export/".concat(i.id,"/download/"):void 0;return e.jsx(pe,{title:!y&&i.state==="completed"&&t("setting.approvalProcess.exportExpiredError",{day:7}),children:e.jsx("span",{children:e.jsx(b,{size:"small",type:"default",icon:e.jsx(Te,{}),disabled:!y,href:A,"data-test-id":"approval-history-export-download-".concat(i.id),children:t("download")})})})}}]})})},Ye=6,Ve=(t,a)=>Math.abs((t.year()-a.year())*12+(t.month()-a.month())),ze=()=>{const{t}=D(),[a,h]=q.useState(!1),[u,s]=q.useState(null),_=Y(),[r]=x.useForm(),n=x.useWatch("export_months",r),{data:g,isLoading:d}=K({queryKey:["/ma_approval/history-export/available-months/"],queryFn:async()=>(await T.get("/ma_approval/history-export/available-months/")).data,placeholderData:[],enabled:a}),i=new Set(g),y=c=>!!(d||!c||!i.has(c.format("YYYY-MM"))||u&&Ve(c,u)>=Ye),A=async c=>{const S=c.export_months.map(l=>l==null?void 0:l.format("YYYY-MM"));await T.post("/ma_approval/history-export/",{export_month:S}),R.success(t("all.backgroundExecution.reportGenerationStart")),_.invali
3dateQueries({queryKey:["/ma_approval/history-export/"]}),r.resetFields()};return e.jsx(H,{destroyOnClose:!0,onOpenChange:c=>{h(c)},title:t("all.exportResource",{resource:t("setting.approvalProcess.approvalHistory")}),renderTrigger:({open:c})=>e.jsx(b,{"data-test-id":"approval-history-export",onClick:c,children:t("export")}),okText:t("export"),okButtonProps:{disabled:n==null||d},children:e.jsx(x,{layout:"vertical",form:r,onFinish:A,children:e.jsx(De.Item,{name:"export_months",label:t("setting.approvalProcess.exportDataYearMonth"),rules:[{required:!0}],children:e.jsx(We,{picker:"month",disabled:d,disabledDate:y,onCalendarChange:c=>{var S,l;s((l=(S=c==null?void 0:c[0])!=null?S:c==null?void 0:c[1])!=null?l:null)},onOpenChange:c=>{c&&s(null)}})})})})};var We=v(je).withConfig({displayName:"ExportProcessRecordButton___StyledBbDateRangePicker",componentId:"sc-91ah4j-0"})(["width:100%;"]);const Qe=()=>{const{t}=D();return e.jsx(Je,{children:e.jsxs(Xe,{children:[e.jsx(ie,{src:window.__getStaticUrl__("images/icons/ic_record_list.svg"),text:t("setting.approvalProcess.historyLog"),color:ce.colorPalette.blue5,contStyle:{margin:"0px 10px 0px 0px"}}),e.jsxs(U,{children:[e.jsx(ze,{}),e.jsx(Re,{})]})]})})};var Je=v(le).withConfig({displayName:"ApprovalProcessRecords___StyledSectionCard",componentId:"sc-1lrvrn0-0"})(["display:flex;flex-direction:column;gap:16px;min-width:0;"]),Xe=v("div").withConfig({displayName:"ApprovalProcessRecords___StyledDiv",componentId:"sc-1lrvrn0-1"})(["display:flex;justify-content:space-between;flex-wrap:wrap;"]);const se=({renderTrigger:t,children:a,id:h,open:u,onOpenChange:s,..._})=>{var S;const{t:r}=D(),[n,g]=q.useState(!1),d=u!=null?u:n,{data:i,isFetching:y}=K({queryKey:["approval-process-pending-requests",h],queryFn:async()=>(await T.get("/ma_approval/processes/".concat(h,"/"))).data,enabled:d&&h!=null}),A=t!=null?t:a?({open:l})=>e.jsx(E.Link,{onClick:l,children:a}):void 0,c=l=>G(l.entity_type).with("workflow",()=>r("workflow")).with("template",()=>G(l.sub_type).with("webbanner",()=>r("all.bannerEmbed")).otherwise(()=>r("editor"))).with("sql_export",()=>r("setting.resourceApprovalProcess.sqlCustomModelExport")).with("owner_transfer",()=>r("ownerTransfer")).otherwise(()=>l.entity_type);return e.jsx(Ze,{title:null,open:u,onOpenChange:l=>{g(l),s==null||s(l)},renderTrigger:A,closable:!1,..._,children:e.jsxs(B,{flexDirection:"column",gap:14,children:[e.jsxs(B,{gap:16,children:[e.jsx(xe,{style:{color:"#faad14",fontSize:22}}),e.jsx(E.Title,{level:5,children:r("setting.resourceApprovalProcess.change.warning",{n:(S=i==null?void 0:i.pending_requests)==null?void 0:S.length})})]}),e.jsxs(et,{flexDirection:"column",gap:8,children:[e.jsx(E.Text,{children:r("setting.resourceApprovalProcess.relatedItems")}),e.jsx(V,{rowKey:"id",loading:y,pagination:{hideOnSinglePage:!0},columns:[{title:r("Type"),dataIndex:"entity_type",render:(l,m)=>c(m)},{title:r("all.name"),dataIndex:"name"}],dataSource:i==null?void 0:i.pending_requests})]})]})})};var Ze=v(H).withConfig({displayName:"InUseModal___StyledOmniModal",componentId:"sc-i9s02x-0"})(["& > .ant-modal-footer{border-top:none;}"]),et=v(B).withConfig({displayName:"InUseModal___StyledStack",componentId:"sc-i9s02x-1"})(["padding-left:38px;"]);const ee="applicantSupervisor",tt=({mappedOptions:t})=>{const{t:a}=D(),{modulePermissionSet:h}=ue();return[t.general&&{value:"general",label:a("setting.resourceApprovalProcess.general")},h.has("WorkflowCustomField")&&Array.isArray(t.custom_field_workflow)&&{value:"custom_field_workflow",label:a("all.customerJourneyCustomField"),children:t.custom_field_workflow.length>0?t.custom_field_workflow.map(s=>({value:s.field_id,label:s.field_name,children:s.options.map(_=>({value:_,label:_}))})):[{label:a("all.noData"),disabled:!0}]},h.has("WorkflowNodeCustomField")&&Array.isArray(t.custom_field_workflow_node)&&{value:"custom_field_workflow_node",label:a("all.customerJourneyNodeCustomField"),children:t.custom_field_workflow_node.length>0?t.custom_field_workflow_node.map(s=>({value:s.field_id,label:s.field_name,children:s.options.map(_=>({value:_,label:_}))})):[{label:a("all.noData"),disabled:!0}]},Array.isArray(t.user_group)&&{value:"user_group",label:a("setting.resourceApprovalProcess.userGroup"),children:t.user_group.length>0?t.user_group.map(s=>({value:s.id,label:s.name})):[{label:a("all.noData"),disabled:!0}]}
3].filter(Boolean)},ne=5,_e=({initialValues:t={},onFinish:a,processId:h,isInUse:u=!1})=>{var m,C,j,p,f,P,I,F,k,re;const{t:s}=D(),{modulePermissionSet:_}=ue(),[r]=x.useForm(),{data:n,isLoading:g}=K({queryKey:["/ma_approval/processes/options/"],queryFn:async()=>(await T("/ma_approval/processes/options/")).data}),d=x.useWatch(["entity_type"],r),i=x.useWatch(["condition"],r),y=x.useWatch(["isExcludedUserGroups"],r),{options:A={},exclude_user_groups:c}=(C=(m=n==null?void 0:n.condition)==null?void 0:m[d])!=null?C:{},S=tt({mappedOptions:A}),l=[{value:ee,label:s("setting.resourceApprovalProcess.applicantManager")},{value:"user",label:s("Account"),children:((j=n==null?void 0:n.approval_step)==null?void 0:j.length)===0?[{label:s("all.noData"),disabled:!0}]:(p=n==null?void 0:n.approval_step)==null?void 0:p.map(o=>({value:o.id,label:o.username}))},{value:"userGroup",label:s("all.group"),children:((f=n==null?void 0:n.approval_step_group)==null?void 0:f.length)===0?[{label:s("all.noData"),disabled:!0}]:(P=n==null?void 0:n.approval_step_group)==null?void 0:P.map(o=>({value:o.id,label:"".concat(o.name,"(").concat(o.user_count,")")}))}];return e.jsxs(x,{form:r,layout:"vertical",initialValues:{approval_step:[{}],...t},onFinish:async o=>{const{isExcludedUserGroups:w,excludedUserGroups:M,...$}=o,N=o.entity_type!=="general"?{user_group_ids:[],custom_field_id:null,selected_value:null,...G(o.condition[0]).with("general",()=>({condition_type:"general",action:w?"exclude":"include",...w&&{user_group_ids:(M!=null?M:[]).map(Number)}})).with("custom_field_workflow",()=>({condition_type:"custom_field_workflow",custom_field_id:o.condition[1],selected_value:o.condition[2]})).with("custom_field_workflow_node",()=>({condition_type:"custom_field_workflow_node",custom_field_id:o.condition[1],selected_value:o.condition[2]})).with("user_group",()=>({condition_type:"user_group",user_group_ids:[o.condition[1]],action:"include"})).otherwise(()=>({}))}:null,z=o.approval_step.map(ye=>{var oe;return(oe=ye.approvers)==null?void 0:oe.reduce((L,O)=>{if(Array.isArray(O)){const Q=O==null?void 0:O[0];Q===ee?L.include_applicant_supervisor=!0:Q==="user"?L.user_ids.push(O[1]):Q==="userGroup"&&L.user_group_ids.push(O[1])}return L},{user_ids:[],user_group_ids:[],include_applicant_supervisor:!1})}),he={sub_types:null,...$,condition:N,approval_step:z},W=await a(he,o);W!=null&&W.keepForm||r.resetFields()},children:[e.jsx(x.Item,{name:"name",label:s("name"),rules:[{required:!0},()=>({validateTrigger:[],validator:async(o,w)=>{if(!w||w===t.name)return Promise.resolve();try{return(await T.post("/ma_approval/processes/?check_only=true",{name:w})).data.name_available===!1?Promise.reject(s("all.requiredresourceDuplicatename",{resource:w})):Promise.resolve()}catch{return Promise.resolve()}}})],children:e.jsx(be,{placeholder:s("all.pleaseInput"),maxLength:255})}),u&&e.jsx(st,{showIcon:!0,type:"warning",message:e.jsx(Ue,{as:"span",i18nKey:"setting.resourceApprovalProcess.change.autoRejectHint",components:{Goto:e.jsx(se,{id:h,footer:({onCancel:o})=>e.jsx(b,{onClick:o,children:s("I see")})})}})}),e.jsxs(x.Item,{required:!0,label:e.jsxs(U,{size:4,children:[s("setting.resourceApprovalProcess.scope"),e.jsx(X,{content:s("setting.resourceApprovalProcess.scope.tooltip")})]}),children:[e.jsx(x.Item,{noStyle:!0,name:"entity_type",rules:[{required:!0}],messageVariables:{label:s("setting.resourceApprovalProcess.scope")},children:e.jsx(J,{allowClear:!0,placeholder:s("all.pleaseSelect"),onChange:()=>{r.setFieldValue("condition",void 0),r.setFieldValue("sub_types",void 0)},options:Object.keys((I=n==null?void 0:n.condition)!=null?I:{}).filter(o=>({sql_export:!_.has("SQLFunction"),owner_transfer:!_.has("OwnerLock")})[o]!==!0).map(o=>{const w={general:s("setting.resourceApprovalProcess.general"),workflow:s("workflow"),template:s("editor"),sql_export:s("setting.resourceApprovalProcess.sqlCustomModelExport"),owner_transfer:s("ownerTransfer")};return{value:o,label:w[o]}})})}),d==="template"&&e.jsx(rt,{name:"sub_types",rules:[{required:!0}],messageVariables:{label:s("setting.customField.applicableEditor")},children:e.jsx(J,{mode:"multiple",placeholder:s("setting.customField.applicableEditor"),options:((re=(k=(F=n==null?void 0:n.condition)==null?void 0:F.template)==null?void 0:k.sub_types)!=null?re:[]).filter(o=>({webbanner:!_.has("WebBannerEmbed")})[o]!==!0).map(o=>{const w={webbanner:s("all.bannerEmbed")};return{value:o,label:w[o]}})})})]}),d&&d!=="general"&&e.jsx(x.Item,{name:"condition",label:e.jsxs(U,{children:[s("setting.resourceApprovalProcess.condition"),e.jsx(X,{content:s("setting.resourceApprovalProcess.condition.tooltip")})]}),rules:[{required:!0}],messageVariables:{label:s("setting.resourceApprovalProcess.condition")},extra:(i==null?void 0:i.at(0))==="general"?e.jsxs(ot,{children:[e.jsx(x.Item,{name:"isExcludedUserGroups",valuePropName:"checked",children:e.jsx(Ge,{onChange:()=>{r.setFieldValue("excludedUserGroups")},children:s("setting.resourceApprovalProcess.excludeUserGroup")})}),e.jsx(at,{name:"excludedUserGroups",rules:[{required:y}],dependencies:["isExcludedUserGroups"],messageVariables:{label:s("setting.resourceApprovalProcess.excludeUserGroup")},children:e.jsx(J,{showSearch:!0,optionFilterProp:"label",mode:"multiple",placeholder:s("all.pleaseSelect"),options:c==null?void 0:c.map(o=>({label:o.name,value:o.id})),disabled:!y})})]}):void 0,children:e.jsx(Z,{showSearch:!0,allowClear:!0,placeholder:s("all.pleaseSelect"),options:S,loading:g,onChange:()=>{r.setFieldValue("isExcludedUserGroups",!1),r.setFieldValue("excludedUserGroups",void 0)}})}),e.jsx(x.List,{name:"approval_step",children:(o,{add:w,remove:M})=>e.jsx(nt,{required:!0,labelCol:{style:{display:"block"}},label:e.jsxs(lt,{children:[e.jsxs(U,{size:4,children:[s("setting.resourceApprovalProcess.approvalLevel"),e.jsx(X,{content:s("setting.resourceApprovalProcess.approvalLevel.tooltip")})]}),e.jsxs(E.Text,{type:"secondary",children:[s("all.count"),": ",o.length," / ",ne]})]}),children:e.jsxs(it,{children:[e.jsx("div",{"data-test-id":"approval-step-table",children:e.jsx(V,{size:"small",dataSource:o,pagination:!1,columns:[{title:"#",width:32,render:($,N,z)=>z+1},{title:s("setting.resourceApprovalProcess.approvers"),render:($,N)=>e.jsx(ct,{name:[N.name,"approvers"],rules:[{required:!0}],messageVariables:{label:s("setting.resourceApprovalProcess.approvers")},children:e.jsx(Z,{loading:g,showSearch:!0,placeholder:s("all.pleaseSelect"),multiple:!0,showCheckedStrategy:Z.SHOW_CHILD,options:l})})},{title:s("action"),width:68,render:($,N)=>o.length<=1?null:e.jsx(b,{icon:e.jsx(me,{}),onClick:()=>{M(N.name)}})}]})}),o.length<ne&&e.jsx(b,{type:"dashed",onClick:()=>{w({})},children:s("add")})]})})}),e.jsx(x.Item,{name:"priority",label:s("setting.resourceApprovalProcess.approvalPriority"),extra:s("setting.resourceApprovalProcess.approvalPriority.tooltip"),rules:[{required:!0}],children:e.jsx(pt,{min:1,max:2147483647,precision:0,placeholder:s("all.pleaseInput")})})]})};var st=v(Pe).withConfig({displayName:"ApprovalProcessSettingForm___StyledAlert",componentId:"sc-eh95ss-0"})(["margin-bottom:16px;"]),rt=v(x.Item).withConfig({displayName:"ApprovalProcessSettingForm___StyledOmniFormItem",componentId:"sc-eh95ss-1"})(["margin:8px 0 0 0;"]),ot=v(B).withConfig({displayName:"ApprovalProcessSettingForm___StyledStack",componentId:"sc-eh95ss-2"})(["margin-top:8px;"]),at=v(x.Item).withConfig({displayName:"ApprovalProcessSettingForm___StyledOmniFormItem2",componentId:"sc-eh95ss-3"})(["flex-grow:1;"]),nt=v(x.Item).withConfig({displayName:"ApprovalProcessSettingForm___StyledOmniFormItem3",componentId:"sc-eh95ss-4"})([".ant-form-item-label > label{width:100%;}"]),lt=v("div").withConfig({displayName:"ApprovalProcessSettingForm___StyledDiv",componentId:"sc-eh95ss-5"})(["display:flex;justify-content:space-between;width:100%;"]),it=v("div").withConfig({displayName:"ApprovalProcessSettingForm___StyledDiv2",componentId:"sc-eh95ss-6"})(["display:flex;flex-direction:column;gap:16px;"]),ct=v(x.Item).withConfig({displayName:"ApprovalProcessSettingForm___StyledOmniFormItem4",componentId:"sc-eh95ss-7"})(["margin-bottom:0;"]),pt=v(Ae).withConfig({displayName:"ApprovalProcessSettingForm___StyledInputNumber",componentId:"sc-eh95ss-8"})(["width:100%;"]);const dt=()=>{const{t}=D(),a=Y(),{mutateAsync:h}=te({mutationKey:["/ma_approval/processes/"],mutationFn:async u=>(await T.post("/ma_approval/processes/",u)).data,onSuccess:async()=>{await a.invalidateQueries({queryKey:["/ma_approval/processes/"]}),R.success(t("msgCreateSuccessfully"))}});return e.jsx(H,{title:t("add"),renderTrigger:({open:u})=>e.jsx(ut,{type:"primary",icon:e.jsx(Ce,{}),onClick:u,children:t("add")}),children:e.jsx(_e,{onFinish:async u=>{await h({sub_types:null,condition:null,...u})}})})};var ut=v(b).withConfig({displayName:"AddApprovalProcessButton___StyledButton",componentId:"sc-1y5ripe-0"})(["width:fit-content;"]);const mt=({record:t})=>{const{t:a}=D(),h=Y(),[u,s]=q.useState(!1),{mutateAsync:_,isPending:r}=te({mutationKey:["/ma_approval/processes/",t.id],mutationFn:async()=>await T.delete("/ma_approval/processes/".concat(t.id,"/")),onSuccess:async()=>{await h.invalidateQueries({queryKey:["/ma_approval/processes/"]}),R.success(a("msgDeleteSuccessfully"))}}),n=()=>{Ie.confirm({title:e.jsx(ve,{i18nKey:"all.confirm.deleteObject",values:{object:t.name},components:{alert:e.jsx(E.Text,{type:"danger"})}}),content:a("all.deleteObjectConfirm.description"),okType:"danger",onOk:async()=>{await _(),s(!1)},okButtonProps:{disabled:r}})};return e.jsxs(e.Fragment,{children:[e.jsx(b,{icon:e.jsx(me,{}),onClick:()=>
3{if(t.has_pending_requests){s(!0);return}n()}}),e.jsx(se,{id:t.id,open:u,onCancel:()=>s(!1),footer:({onCancel:g})=>e.jsxs(e.Fragment,{children:[e.jsx(b,{onClick:g,children:a("cancel")}),e.jsx(b,{danger:!0,loading:r,onClick:n,children:a("delete")})]})})]})},_t=({record:t})=>{var c,S,l,m,C,j;const{t:a}=D(),h=Y(),[u,s]=q.useState(!1),[_,r]=q.useState(!1),[n,g]=q.useState(null),d=(l=(S=(c=t.condition)==null?void 0:c.user_groups)==null?void 0:S.map(p=>p.user_group__id))!=null?l:[],i={name:t.name,entity_type:t.entity_type,sub_types:t.sub_types,condition:G((m=t.condition)==null?void 0:m.condition_type).with("general",()=>["general"]).with("user_group",()=>["user_group",d[0]]).with("custom_field_workflow",()=>["custom_field_workflow",t.condition.custom_field_id,t.condition.selected_value]).with("custom_field_workflow_node",()=>["custom_field_workflow_node",t.condition.custom_field_id,t.condition.selected_value]).otherwise(()=>{}),isExcludedUserGroups:((C=t.condition)==null?void 0:C.action)==="exclude",excludedUserGroups:d,approval_step:(j=t.approval_step)==null?void 0:j.map(p=>{var I,F;return{approvers:[p.include_applicant_supervisor&&[ee],...((I=p.approvers)!=null?I:[]).map(k=>["user",k.id]),...((F=p.approver_groups)!=null?F:[]).map(k=>["userGroup",k.id])].filter(Boolean)}}),priority:t.priority},{mutateAsync:y,isPending:A}=te({mutationKey:["/ma_approval/processes/",t.id],mutationFn:async({values:p,nameOnly:f=!1})=>await T.put("/ma_approval/processes/".concat(t.id,"/"),f?{name:p.name}:p,f?{params:{name_only:!0}}:void 0),onSuccess:async()=>{await h.invalidateQueries({queryKey:["/ma_approval/processes/"]}),R.success(a("msgUpdateSuccessfully"))}});return e.jsxs(e.Fragment,{children:[e.jsx(H,{destroyOnClose:!0,title:a("edit"),open:u,onOpenChange:s,renderTrigger:({open:p})=>e.jsx(b,{icon:e.jsx(qe,{}),onClick:p}),footer:({onCancel:p,getForm:f})=>e.jsxs(e.Fragment,{children:[e.jsx(b,{onClick:p,children:a("cancel")}),e.jsx(b,{type:"primary",loading:A,onClick:()=>{const P=f();P==null||P.validateFields().then(()=>
3P.submit()).catch(()=>{})},children:a("ok")})]}),children:e.jsx(_e,{initialValues:i,processId:t.id,isInUse:t.has_pending_requests,onFinish:async(p,f)=>{if(!t.has_pending_requests){await y({values:p}),s(!1);return}const P=k=>He(k)&&k!==!1&&!(Array.isArray(k)&&k.length===0),I=k=>Ke($e(k,["name"]),P);if(Be(I(f),I(i))){await y({values:p,nameOnly:!0}),s(!1);return}return g(p),r(!0),{keepForm:!0}}})}),e.jsx(se,{id:t.id,open:_,zIndex:1001,onCancel:()=>{r(!1),g(null)},footer:({onCancel:p})=>e.jsxs(e.Fragment,{children:[e.jsx(b,{onClick:p,children:a("cancel")}),e.jsx(b,{danger:!0,loading:A,onClick:async()=>{await y({values:n}),r(!1),s(!1),g(null)},children:a("setting.resourceApprovalProcess.change.confirm")})]})})]})},ht=()=>{var c,S;const{t}=D(),[a,h]=q.useState(""),{sortState:u,onSort:s,buildSortOrder:_}=Ee({sortBy:"last_update_time",isAsc:!1}),{pagination:r,handleTableChange:n,filters:g}=Oe({onSort:s}),d={page:r.page,name:a,entity_type:(c=g.entity_type)!=null?c:null,ordering:u.sortBy?"".concat(u.isAsc?"":"-").concat(u.sortBy):void 0},{data:i,isLoading:y}=K({queryKey:["/ma_approval/processes/",d],queryFn:async()=>(await T.get("/ma_approval/processes/",{params:d})).data}),A=[{value:"general",text:t("setting.resourceApprovalProcess.general")},{value:"workflow",text:t("workflow")},{value:"template",text:t("editor")},{value:"sql_export",text:t("setting.resourceApprovalProcess.sqlCustomModelExport")},{value:"owner_transfer",text:t("ownerTransfer")}];return e.jsxs(yt,{children:[e.jsx(ie,{src:window.__getStaticUrl__("images/icons/ic_rule.svg"),text:t("setting.resourceApprovalProcess"),color:ce.colorPalette.blue5,contStyle:{margin:"0px 10px 0px 0px"}}),e.jsx(dt,{}),e.jsx("div",{"data-test-id":"approval-process-table",children:e.jsx(V,{rowKey:"id",scroll:{x:"max-content"},loading:y,dataSource:i==null?void 0:i.results,pagination:{...r,total:i==null?void 0:i.count,showSizeChanger:!1},onChange:n,columns:[{title:t("name"),dataIndex:"name",fixed:"left",width:240,filterIcon:e.jsx(ke,{}),filterDropdown:l=>e.jsx(Se,{...l,onSearch:m=>{h(String(m))}}),render:l=>e.jsx(pe,{title:l,children:e.jsx(gt,{$_css:[Ne(3),ge(["max-width:220px;"])],children:e.jsx(we,{highlightStyle:{color:"var(--primary-color)"},highlightTag:"span",searchWords:[a],autoEscape:!0,textToHighlight:l})})}),filteredValue:a?[a]:null},{title:t("setting.resourceApprovalProcess.scope"),dataIndex:"entity_type",width:200,filters:A,render:(l,m)=>{var p;const C=m.entity_type,j=(p=A.find(f=>f.value===C))==null?void 0:p.text;return G(C).with("template",()=>e.jsxs(U,{size:4,direction:"vertical",children:[e.jsx("div",{children:j}),e.jsx(Fe,{children:t("all.bannerEmbed")})]})).otherwise(()=>j)},filteredValue:(S=g.entity_type)!=null?S:null},{title:t("setting.resourceApprovalProcess.condition"),width:200,dataIndex:"condition",render:(l,{condition:m})=>{const C=m==null?void 0:m.condition_type;if(!C)return"--";const j={general:t("setting.resourceApprovalProcess.general"),custom_field_workflow:t("all.customerJourneyCustomField"),custom_field_workflow_node:t("all.customerJourneyNodeCustomField"),user_group:t("setting.resourceApprovalProcess.userGroup")}[C],p=(()=>{var f,P;switch(m.condition_type){case"general":{const I=(f=m.user_groups)==null?void 0:f.map(F=>F.user_group__name).join(", ");return[j,m.action==="exclude"&&"(".concat(t("setting.resourceApprovalProcess.excludeUserGroup")).concat(I?":".concat(I):"",")")].filter(Boolean).join(" ")}case"user_group":{const I=(P=m.user_groups)==null?void 0:P.map(F=>F.user_group__name).join(", ");return[j,I]}case"custom_field_workflow":case"custom_field_workflow_node":return[j,m.custom_field_name,m.selected_value]}})();return Array.isArray(p)?p.join(" / "):p}},{title:t("setting.resourceApprovalProcess.approvalLevel"),width:360,render:(l,m)=>{var j;const C=(j=m.approval_step)!=null?j:[];return e.jsx(B,{flexDirection:"column",gap:8,children:C.map((p,f)=>e.jsxs("div",{children:[e.jsxs(xt,{type:"secondary",children:[t("setting.resourceApprovalProcess.level")," ",f+1]}),e.jsx("div",{children:e.jsx(Me,{step:p})})]},p.id))})}},{title:t("setting.resourceApprovalProcess.approvalPriority"),width:140,dataIndex:"priority",sorter:!0,sortOrder:_(u,"priority")},{title:t("lastUpdateTime"),width:200,dataIndex:"last_update_time",sorter:!0,sortOrder:_(u,"last_update_time"),render:(l,m)=>de(m.last_update_time,"YYYY-MM-DD HH:mm:ss")},{title:t("action"),width:140,fixed:"right",render:(l,m)=>e.jsxs(U,{children:[e.jsx(_t,{record:m}),e.jsx(mt,{record:m})]})}]})})]})};var yt=v(le).withConfig({displayName:"ApprovalProcessSettings___StyledSectionCard",componentId:"sc-ylim6h-0"})(["display:flex;flex-direction:column;gap:16px;
3"]),gt=v("div").withConfig({displayName:"ApprovalProcessSettings___StyledDiv",componentId:"sc-ylim6h-1"})(["",""],t=>t.$_css),xt=v(E.Text).withConfig({displayName:"ApprovalProcessSettings___StyledTypographyText",componentId:"sc-ylim6h-2"})(["display:inline-block;"]);const ls=()=>e.jsxs(vt,{children:[e.jsx(ht,{}),e.jsx(Qe,{})]});var vt=v("div").withConfig({displayName:"ApprovalProcess___StyledDiv",componentId:"sc-vh9pt8-0"})(["margin:32px;display:flex;gap:24px;flex-direction:column;"]);export{ls as ApprovalProcessSettingPage};
4
5//# debugId=5effac5a-0090-58bb-8ebb-757e347a89ba

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.