import{b as d,$ as j,h as y,k as I,i as _,j as t,_ as a,q as c}from"./main.2.8.1.js";import{u as w,h as M,d as r}from"./react-router-dom.9mCuUg3q.js";import{S as N}from"./SnackMsg.S8DrwLlT.js";import"./Note.BeM7sN-p.js";import{S,I as R,s as v}from"./Integrations.D2bgBas2.js";import{h as m,c as p}from"./CapsuleCRMCommonFunc.Bt5E39bP.js";import{C as F}from"./CapsuleCRMIntegLayout.Ce-pcv7m.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";function J({allIntegURL:f}){const u=w(),{id:k}=M(),[i,P]=d(j),[e,n]=d(y),[g,E]=r.useState(!1),[x,C]=r.useState({}),[h,s]=r.useState({show:!1}),l=I(_),b=()=>{if(!p(e)){s({show:!0,msg:a("Please map mandatory fields","bit-integrations")});return}if(e.actionName==="opportunity"||e.actionName==="project"){if(!e.selectedCRMParty){c.error(a("Please select a party","bit-integrations"));return}if(!e.selectedCRMMilestones&&e.actionName==="opportunity"){c.error(a("Please select a Milestone","bit-integrations"));return}}v({flow:i,allIntegURL:f,conf:e,navigate:u,edit:1,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:a("Integration Name:","bit-integrations")}),t.jsx("input",{className:"btcd-paper-inp w-5",onChange:o=>m(o,e,n),name:"name",value:e.name,type:"text",placeholder:a("Integration Name...","bit-integrations")})]}),t.jsx("br",{}),t.jsx(S,{entity:i.triggered_entity,setSnackbar:s}),t.jsx(F,{formID:i.triggered_entity_id,formFields:l,handleInput:o=>m(o,e,n),capsulecrmConf:e,setCapsuleCRMConf:n,loading:x,setLoading:C,setSnackbar:s}),t.jsx(R,{edit:!0,saveConfig:b,disabled:!p(e),isLoading:g,dataConf:e,setDataConf:n,formFields:l}),t.jsx("br",{})]})}export{J as default};
