import{h as c,$ as S,g as I,k as _,i as w,j as t,_ as a,q as l}from"./main.2.8.10.js";import{u as y,e as N,b as r}from"./react-router.DMwpH23k.js";import{S as v}from"./SnackMsg.7BjcJK1j.js";import"./Note.DalStCGz.js";import"./CopyIcn.BnhKHfEP.js";import{S as F,I as R,s as L}from"./Integrations.BFhED4ck.js";import{h as f,c as p}from"./OneHashCRMCommonFunc.DhdwQoKV.js";import{O as M}from"./OneHashCRMIntegLayout.CqPF7VLp.js";import"./react-vendor.P7K3d6op.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";function J({allIntegURL:g}){const u=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:g,conf:e,navigate:u,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{J as default};
