import{h as m,$ as j,g as y,k as I,i as _,j as t,_ as a,q as c}from"./main.2.9.0.js";import{u as w,e as M,b as r}from"./react-router.DMwpH23k.js";import{S as N}from"./SnackMsg.DYSD96P4.js";import"./Note.NSUdvR3c.js";import"./CopyIcn.CEA_lFLo.js";import{S,I as R,s as v}from"./Integrations.DL8wqGct.js";import{h as d,c as p}from"./CapsuleCRMCommonFunc.D4e30CY6.js";import{C as F}from"./CapsuleCRMIntegLayout.Cs5ObTaN.js";import"./react-vendor.P7K3d6op.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";function K({allIntegURL:f}){const u=w(),{id:k}=M(),[n,P]=m(j),[e,i]=m(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:n,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=>d(o,e,i),name:"name",value:e.name,type:"text",placeholder:a("Integration Name...","bit-integrations")})]}),t.jsx("br",{}),t.jsx(S,{entity:n.triggered_entity,setSnackbar:s}),t.jsx(F,{formID:n.triggered_entity_id,formFields:l,handleInput:o=>d(o,e,i),capsulecrmConf:e,setCapsuleCRMConf:i,loading:x,setLoading:C,setSnackbar:s}),t.jsx(R,{edit:!0,saveConfig:b,disabled:!p(e),isLoading:g,dataConf:e,setDataConf:i,formFields:l}),t.jsx("br",{})]})}export{K as default};
