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