import{h as m,$ as j,g as I,k as _,i as w,j as t,_ as a,q as d}from"./main.2.8.10.js";import{u as y,e as R,b as r}from"./react-router.DMwpH23k.js";import{S}from"./SnackMsg.7BjcJK1j.js";import"./Note.DalStCGz.js";import"./CopyIcn.BnhKHfEP.js";import{S as M,I as N,s as v}from"./Integrations.BFhED4ck.js";import{h as l,c}from"./CopperCRMCommonFunc.CcbCF8cq.js";import{C as F}from"./CopperCRMIntegLayout.BnhZYSpT.js";import"./react-vendor.P7K3d6op.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function Q({allIntegURL:f}){const g=y(),{id:P}=R(),[o,k]=m(j),[e,i]=m(I),[u,E]=r.useState(!1),[C,x]=r.useState({}),[h,s]=r.useState({show:!1}),p=_(w),b=()=>{if(!c(e)){s({show:!0,msg:a("Please map mandatory fields","bit-integrations")});return}if(e.actionName==="opportunity"){if(!e.selectedCRMPeople){d.error(a("Please select a people","bit-integrations"));return}if(!e.selectedCRMPipelines&&e.actionName==="opportunity"){d.error(a("Please select a Pipeline","bit-integrations"));return}}v({flow:o,allIntegURL:f,conf:e,navigate:g,edit:1,setSnackbar:s})};return t.jsxs("div",{style:{width:900},children:[t.jsx(S,{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:n=>l(n,e,i),name:"name",value:e.name,type:"text",placeholder:a("Integration Name...","bit-integrations")})]}),t.jsx("br",{}),t.jsx(M,{entity:o.triggered_entity,setSnackbar:s}),t.jsx(F,{formID:o.triggered_entity_id,formFields:p,handleInput:n=>l(n,e,i),copperCRMConf:e,setCopperCRMConf:i,loading:C,setLoading:x,setSnackbar:s}),t.jsx(N,{edit:!0,saveConfig:b,disabled:!c(e),isLoading:u,dataConf:e,setDataConf:i,formFields:p}),t.jsx("br",{})]})}export{Q as default};
