import{u as b,k as I,d as c,r as i,h as _,j as t}from"./main-406.js";import{$ as w,g as y,h as N,d as R,_ as r,i as v,I as F,W as p,s as M}from"./bi.394.85.js";import{h as m,c as f}from"./bi.662.887.js";import{C as P}from"./bi.577.888.js";function A({allIntegURL:g}){const u=b();I();const[n,S]=c(w),[e,a]=c(y),[x,k]=i.useState(!1),[C,d]=i.useState({}),[h,s]=i.useState({show:!1}),l=_(N),j=()=>{if(!f(e)){s({show:!0,msg:r("Please map mandatory fields","bit-integrations")});return}if(e.actionName==="opportunity"){if(!e.selectedCRMPeople){p.error("Please select a people");return}if(!e.selectedCRMPipelines&&e.actionName==="opportunity"){p.error("Please select a Pipeline");return}}M({flow:n,allIntegURL:g,conf:e,navigate:u,edit:1,setLoading:d,setSnackbar:s})};return t.jsxs("div",{style:{width:900},children:[t.jsx(R,{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:o=>m(o,e,a),name:"name",value:e.name,type:"text",placeholder:r("Integration Name...","bit-integrations")})]}),t.jsx("br",{}),t.jsx(v,{entity:n.triggered_entity,setSnackbar:s}),t.jsx(P,{formID:n.triggered_entity_id,formFields:l,handleInput:o=>m(o,e,a),coppercrmConf:e,setCopperCRMConf:a,loading:C,setLoading:d,setSnackbar:s}),t.jsx(F,{edit:!0,saveConfig:j,disabled:!f(e),isLoading:x,dataConf:e,setDataConf:a,formFields:l}),t.jsx("br",{})]})}export{A as default};
