import{u as b,k as I,d as u,r as i,h as y,j as t}from"./main-406.js";import{$ as S,g as N,h as R,d as _,_ as l,i as w,I as L,W as s,s as v}from"./bi.394.85.js";import{h as f,c as m}from"./bi.858.915.js";import{P as F}from"./bi.757.916.js";function D({allIntegURL:g}){const p=b();I();const[n,M]=u(S),[e,r]=u(N),[x,d]=i.useState(!1),[P,j]=i.useState({}),[C,a]=i.useState({show:!1}),c=y(R),h=()=>{if(!m(e)){a({show:!0,msg:l("Please map mandatory fields","bit-integrations")});return}if(e.actionName==="contact"&&!e.selectedCustomer){s.error("Please select a Customer");return}if(e.actionName==="lead"&&(!e.selectedLeadStatusId||!e.selectedLeadSourceId)){s.error("Lead Status Id and Lead Source Id are required!");return}if(e.actionName==="project"){if(!e.selectedProjectStatus){s.error("Please select Project status");return}if(!e.selectedProjectType){s.error("Please select Project Related With...");return}if(!e.selectedbillingType){s.error("Please select a Billing type");return}if(!e.selectedCustomer){s.error("Please select a Customer");return}if(Number(e.selectedbillingType)===1&&!e.totalRate){s.error("Please select a Total Rate");return}if(Number(e.selectedbillingType)===2&&!e.ratePerHour){s.error("Please select a Rate Per Hour");return}}v({flow:n,allIntegURL:g,conf:e,navigate:p,edit:1,setIsLoading:d,setSnackbar:a})};return t.jsxs("div",{style:{width:900},children:[t.jsx(_,{snack:C,setSnackbar:a}),t.jsxs("div",{className:"flx mt-3",children:[t.jsx("b",{className:"wdt-200 d-in-b",children:l("Integration Name:","bit-integrations")}),t.jsx("input",{className:"btcd-paper-inp w-5",onChange:o=>f(o,e,r),name:"name",value:e.name,type:"text",placeholder:l("Integration Name...","bit-integrations")})]}),t.jsx("br",{}),t.jsx(w,{entity:n.triggered_entity,setSnackbar:a}),t.jsx(F,{formID:n.triggered_entity_id,formFields:c,handleInput:o=>f(o,e,r),perfexCRMConf:e,setPerfexCRMConf:r,loading:P,setLoading:j,setIsLoading:d,setSnackbar:a}),t.jsx(L,{edit:!0,saveConfig:h,disabled:!m(e),isLoading:x,dataConf:e,setDataConf:r,formFields:c}),t.jsx("br",{})]})}export{D as default};
