import{u as y,k as b,d as c,r as o,h as I,j as t}from"./main-406.js";import{$ as _,g as w,h as M,d as N,_ as r,i as R,I as v,W as m,s as F}from"./bi.394.85.js";import{h as p,c as f}from"./bi.476.873.js";import{C as S}from"./bi.233.874.js";function A({allIntegURL:u}){const g=y();b();const[n,k]=c(_),[e,a]=c(w),[x,P]=o.useState(!1),[C,l]=o.useState({}),[h,s]=o.useState({show:!1}),d=I(M),j=()=>{if(!f(e)){s({show:!0,msg:r("Please map mandatory fields","bit-integrations")});return}if(e.actionName==="opportunity"||e.actionName==="project"){if(!e.selectedCRMParty){m.error("Please select a party");return}if(!e.selectedCRMMilestones&&e.actionName==="opportunity"){m.error("Please select a Milestone");return}}F({flow:n,allIntegURL:u,conf:e,navigate:g,edit:1,setLoading:l,setSnackbar:s})};return t.jsxs("div",{style:{width:900},children:[t.jsx(N,{snack:h,setSnackbar:s}),t.jsxs("div",{className:"flx mt-3",children:[t.jsx("b",{className:"wdt-200 d-in-b",children:r("Integration Name:","bit-integrations")}),t.jsx("input",{className:"btcd-paper-inp w-5",onChange:i=>p(i,e,a),name:"name",value:e.name,type:"text",placeholder:r("Integration Name...","bit-integrations")})]}),t.jsx("br",{}),t.jsx(R,{entity:n.triggered_entity,setSnackbar:s}),t.jsx(S,{formID:n.triggered_entity_id,formFields:d,handleInput:i=>p(i,e,a),capsulecrmConf:e,setCapsuleCRMConf:a,loading:C,setLoading:l,setSnackbar:s}),t.jsx(v,{edit:!0,saveConfig:j,disabled:!f(e),isLoading:x,dataConf:e,setDataConf:a,formFields:d}),t.jsx("br",{})]})}export{A as default};
