import{b as c,$ as S,h as I,k as _,i as w,j as t,_ as a,q as l}from"./main.2.8.1.js";import{u as y,h as N,d as r}from"./react-router-dom.9mCuUg3q.js";import{S as v}from"./SnackMsg.S8DrwLlT.js";import"./Note.BeM7sN-p.js";import{S as F,I as R,s as L}from"./Integrations.D2bgBas2.js";import{h as f,c as p}from"./OneHashCRMCommonFunc.BBcI7DZe.js";import{O as M}from"./OneHashCRMIntegLayout.DA9zRIgV.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";function G({allIntegURL:u}){const g=y(),{id:k}=N(),[i,E]=c(S),[e,n]=c(I),[h,d]=r.useState(!1),[x,C]=r.useState({}),[b,s]=r.useState({show:!1}),m=_(w),j=()=>{if(!p(e)){s({show:!0,msg:a("Please map mandatory fields","bit-integrations")});return}if(e.actionName==="customer"&&!e.selectedCustomerType){l.error(a("Please select Customer Type","bit-integrations"));return}if(e.actionName==="lead"&&!e.selectedLeadStatus){l.error(a("Please select Lead Status","bit-integrations"));return}L({flow:i,allIntegURL:u,conf:e,navigate:g,edit:1,setIsLoading:d,setSnackbar:s})};return t.jsxs("div",{style:{width:900},children:[t.jsx(v,{snack:b,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=>f(o,e,n),name:"name",value:e.name,type:"text",placeholder:a("Integration Name...","bit-integrations")})]}),t.jsx("br",{}),t.jsx(F,{entity:i.triggered_entity,setSnackbar:s}),t.jsx(M,{formID:i.triggered_entity_id,formFields:m,handleInput:o=>f(o,e,n),oneHashCRMConf:e,setOneHashCRMConf:n,loading:x,setLoading:C,setIsLoading:d,setSnackbar:s}),t.jsx(R,{edit:!0,saveConfig:j,disabled:!p(e),isLoading:h,dataConf:e,setDataConf:n,formFields:m}),t.jsx("br",{})]})}export{G as default};
