From b7eada65158f6498ff5f57c4beeee2260733311d Mon Sep 17 00:00:00 2001 From: Rishad Alam <101513331+RishadAlam@users.noreply.github.com> Date: Sat, 25 Apr 2026 13:04:43 +0600 Subject: [PATCH 1/6] feat: wp wrp action init --- backend/Actions/WpErp/RecordApiHelper.php | 108 +++++++ backend/Actions/WpErp/Routes.php | 14 + backend/Actions/WpErp/WpErpController.php | 122 ++++++++ backend/Core/Util/AllTriggersName.php | 1 + backend/Flow/Flow.php | 5 + .../components/AllIntegrations/EditInteg.jsx | 4 + .../components/AllIntegrations/IntegInfo.jsx | 3 + .../components/AllIntegrations/NewInteg.jsx | 10 + .../AllIntegrations/WpErp/EditWpErp.jsx | 76 +++++ .../AllIntegrations/WpErp/WpErp.jsx | 103 +++++++ .../WpErp/WpErpAuthorization.jsx | 106 +++++++ .../AllIntegrations/WpErp/WpErpCommonFunc.js | 68 +++++ .../AllIntegrations/WpErp/WpErpFieldMap.jsx | 104 +++++++ .../WpErp/WpErpIntegLayout.jsx | 279 ++++++++++++++++++ .../AllIntegrations/WpErp/staticData.js | 189 ++++++++++++ .../src/components/Flow/New/SelectAction.jsx | 1 + frontend/src/resource/img/integ/wpErp.webp | Bin 0 -> 4144 bytes 17 files changed, 1193 insertions(+) create mode 100644 backend/Actions/WpErp/RecordApiHelper.php create mode 100644 backend/Actions/WpErp/Routes.php create mode 100644 backend/Actions/WpErp/WpErpController.php create mode 100644 frontend/src/components/AllIntegrations/WpErp/EditWpErp.jsx create mode 100644 frontend/src/components/AllIntegrations/WpErp/WpErp.jsx create mode 100644 frontend/src/components/AllIntegrations/WpErp/WpErpAuthorization.jsx create mode 100644 frontend/src/components/AllIntegrations/WpErp/WpErpCommonFunc.js create mode 100644 frontend/src/components/AllIntegrations/WpErp/WpErpFieldMap.jsx create mode 100644 frontend/src/components/AllIntegrations/WpErp/WpErpIntegLayout.jsx create mode 100644 frontend/src/components/AllIntegrations/WpErp/staticData.js create mode 100644 frontend/src/resource/img/integ/wpErp.webp diff --git a/backend/Actions/WpErp/RecordApiHelper.php b/backend/Actions/WpErp/RecordApiHelper.php new file mode 100644 index 000000000..77debf398 --- /dev/null +++ b/backend/Actions/WpErp/RecordApiHelper.php @@ -0,0 +1,108 @@ +_integrationDetails = $integrationDetails; + $this->_integrationID = $integId; + } + + public function execute($fieldValues, $fieldMap, $utilities) + { + if (!\function_exists('erp_insert_people')) { + return [ + 'success' => false, + 'message' => __('WP ERP is not installed or activated', 'bit-integrations') + ]; + } + + $fieldData = static::generateReqDataFromFieldMap($fieldMap, $fieldValues); + $mainAction = $this->_integrationDetails->mainAction ?? ''; + + $defaultResponse = [ + 'success' => false, + // translators: %s: Plugin name + 'message' => wp_sprintf(__('%s plugin is not installed or activate', 'bit-integrations'), 'Bit Integrations Pro') + ]; + + $hookMap = [ + 'createContact' => ['hook' => 'wperp_create_contact', 'type' => 'contact'], + 'updateContact' => ['hook' => 'wperp_update_contact', 'type' => 'contact'], + 'deleteContact' => ['hook' => 'wperp_delete_contact', 'type' => 'contact'], + 'createCompany' => ['hook' => 'wperp_create_company', 'type' => 'company'], + 'updateCompany' => ['hook' => 'wperp_update_company', 'type' => 'company'], + 'deleteCompany' => ['hook' => 'wperp_delete_company', 'type' => 'company'], + 'createContactGroup' => ['hook' => 'wperp_create_contact_group', 'type' => 'contact_group'], + 'addContactToGroup' => ['hook' => 'wperp_add_contact_to_group', 'type' => 'contact_group'], + 'removeContactFromGroup' => ['hook' => 'wperp_remove_contact_from_group', 'type' => 'contact_group'], + 'addNote' => ['hook' => 'wperp_add_note', 'type' => 'note'], + 'createTask' => ['hook' => 'wperp_create_task', 'type' => 'task'], + 'createEmployee' => ['hook' => 'wperp_create_employee', 'type' => 'employee'], + 'updateEmployee' => ['hook' => 'wperp_update_employee', 'type' => 'employee'], + 'createDepartment' => ['hook' => 'wperp_create_department', 'type' => 'department'], + 'createDesignation' => ['hook' => 'wperp_create_designation', 'type' => 'designation'], + 'createHoliday' => ['hook' => 'wperp_create_holiday', 'type' => 'holiday'], + 'createExpense' => ['hook' => 'wperp_create_expense', 'type' => 'expense'], + 'createPayment' => ['hook' => 'wperp_create_payment', 'type' => 'payment'], + ]; + + if (!isset($hookMap[$mainAction])) { + $response = [ + 'success' => false, + 'message' => __('Invalid action', 'bit-integrations') + ]; + $type = 'WpErp'; + $actionType = 'unknown'; + } else { + $entry = $hookMap[$mainAction]; + $response = Hooks::apply( + Config::withPrefix($entry['hook']), + $defaultResponse, + $fieldData, + $utilities, + ); + $type = $entry['type']; + $actionType = $mainAction; + } + + $responseType = isset($response['success']) && $response['success'] ? 'success' : 'error'; + LogHandler::save($this->_integrationID, ['type' => $type, 'type_name' => $actionType], $responseType, $response); + + return $response; + } + + private static function generateReqDataFromFieldMap($fieldMap, $fieldValues) + { + $dataFinal = []; + foreach ($fieldMap as $item) { + $triggerValue = $item->formField; + $actionValue = $item->wpErpField; + + if (empty($actionValue)) { + continue; + } + + $dataFinal[$actionValue] = $triggerValue === 'custom' && isset($item->customValue) + ? Common::replaceFieldWithValue($item->customValue, $fieldValues) + : ($fieldValues[$triggerValue] ?? ''); + } + + return $dataFinal; + } +} diff --git a/backend/Actions/WpErp/Routes.php b/backend/Actions/WpErp/Routes.php new file mode 100644 index 000000000..c2e951bc5 --- /dev/null +++ b/backend/Actions/WpErp/Routes.php @@ -0,0 +1,14 @@ + $group['id'] ?? '', + 'label' => $group['name'] ?? '', + ]; + }, + (array) erp_crm_get_contact_groups(['number' => -1]) + ); + } + + wp_send_json_success(['groups' => $groups], 200); + } + + public function refreshLifeStages() + { + self::isExists(); + + $stages = []; + + if (\function_exists('erp_crm_get_life_stages_dropdown_raw')) { + foreach ((array) erp_crm_get_life_stages_dropdown_raw() as $value => $label) { + $stages[] = (object) ['value' => $value, 'label' => $label]; + } + } + + wp_send_json_success(['stages' => $stages], 200); + } + + public function refreshDepartments() + { + self::isExists(); + + $out = []; + + if (\function_exists('erp_hr_get_departments')) { + foreach ((array) erp_hr_get_departments(['number' => -1, 'no_object' => true]) as $dept) { + $dept = (array) $dept; + $out[] = (object) [ + 'value' => $dept['id'] ?? '', + 'label' => $dept['title'] ?? '', + ]; + } + } + + wp_send_json_success(['departments' => $out], 200); + } + + public function refreshDesignations() + { + self::isExists(); + + $out = []; + + if (\function_exists('erp_hr_get_designations')) { + foreach ((array) erp_hr_get_designations(['number' => -1, 'no_object' => true]) as $designation) { + $designation = (array) $designation; + $out[] = (object) [ + 'value' => $designation['id'] ?? '', + 'label' => $designation['title'] ?? '', + ]; + } + } + + wp_send_json_success(['designations' => $out], 200); + } + + public function execute($integrationData, $fieldValues) + { + $integrationDetails = $integrationData->flow_details; + $integId = $integrationData->id; + $fieldMap = $integrationDetails->field_map; + $utilities = isset($integrationDetails->utilities) ? $integrationDetails->utilities : []; + + if (empty($fieldMap)) { + return new WP_Error('field_map_empty', __('Field map is empty', 'bit-integrations')); + } + + $recordApiHelper = new RecordApiHelper($integrationDetails, $integId); + $wpErpResponse = $recordApiHelper->execute($fieldValues, $fieldMap, $utilities); + + if (is_wp_error($wpErpResponse)) { + return $wpErpResponse; + } + + return $wpErpResponse; + } +} diff --git a/backend/Core/Util/AllTriggersName.php b/backend/Core/Util/AllTriggersName.php index fce2979b7..11a286fd2 100644 --- a/backend/Core/Util/AllTriggersName.php +++ b/backend/Core/Util/AllTriggersName.php @@ -155,6 +155,7 @@ public static function allTriggersName() 'WSForm' => ['name' => 'WSForm', 'isPro' => true, 'is_active' => false], 'WishlistMember' => ['name' => 'Wishlist Member', 'isPro' => true, 'is_active' => false], 'WpAllImport' => ['name' => 'WP All Import', 'isPro' => true, 'is_active' => false], + 'WpErp' => ['name' => 'WP ERP', 'isPro' => true, 'is_active' => false], 'WPLMS' => ['name' => 'WPLMS', 'isPro' => true, 'is_active' => false], 'WPLoyalty' => ['name' => 'WPLoyalty', 'isPro' => true, 'is_active' => false], 'WPSubscription' => ['name' => 'WPSubscription', 'isPro' => true, 'is_active' => false], diff --git a/backend/Flow/Flow.php b/backend/Flow/Flow.php index 3450a1d79..126a3dc89 100644 --- a/backend/Flow/Flow.php +++ b/backend/Flow/Flow.php @@ -498,6 +498,11 @@ public static function execute($triggered_entity, $triggered_entity_id, $data, $ break; + case 'WPERP': + $integrationName = 'WpErp'; + + break; + default: $integrationName = $integrationName; diff --git a/frontend/src/components/AllIntegrations/EditInteg.jsx b/frontend/src/components/AllIntegrations/EditInteg.jsx index d1354c08d..1741d436b 100644 --- a/frontend/src/components/AllIntegrations/EditInteg.jsx +++ b/frontend/src/components/AllIntegrations/EditInteg.jsx @@ -172,6 +172,7 @@ const EditWishlistMember = lazy(() => import('./WishlistMember/EditWishlistMembe const EditCreatorLms = lazy(() => import('./CreatorLms/EditCreatorLms')) const EditUltimateAffiliatePro = lazy(() => import('./UltimateAffiliatePro/EditUltimateAffiliatePro')) const EditFluentCart = lazy(() => import('./FluentCart/EditFluentCart')) +const EditWpErp = lazy(() => import('./WpErp/EditWpErp')) const EditNinjaTables = lazy(() => import('./NinjaTables/EditNinjaTables')) const EditWCAffiliate = lazy(() => import('./WCAffiliate/EditWCAffiliate')) const EditWPCafe = lazy(() => import('./WPCafe/EditWPCafe')) @@ -258,6 +259,7 @@ export default function EditInteg({ allIntegURL }) { ) } const IntegType = memo(({ allIntegURL, flow }) => { + console.log(flow?.flow_details?.type) switch (flow?.flow_details?.type) { case 'Zoho CRM': return @@ -593,6 +595,8 @@ const IntegType = memo(({ allIntegURL, flow }) => { return case 'FluentCart': return + case 'WP ERP': + return case 'Ninja Tables': return case 'WC Affiliate': diff --git a/frontend/src/components/AllIntegrations/IntegInfo.jsx b/frontend/src/components/AllIntegrations/IntegInfo.jsx index 092b907d9..74f49596a 100644 --- a/frontend/src/components/AllIntegrations/IntegInfo.jsx +++ b/frontend/src/components/AllIntegrations/IntegInfo.jsx @@ -175,6 +175,7 @@ const UltimateAffiliateProAuthorization = lazy( () => import('./UltimateAffiliatePro/UltimateAffiliateProAuthorization') ) const FluentCartAuthorization = lazy(() => import('./FluentCart/FluentCartAuthorization')) +const WpErpAuthorization = lazy(() => import('./WpErp/WpErpAuthorization')) const NinjaTablesAuthorization = lazy(() => import('./NinjaTables/NinjaTablesAuthorization')) const WCAffiliateAuthorization = lazy(() => import('./WCAffiliate/WCAffiliateAuthorization')) const WPCafeAuthorization = lazy(() => import('./WPCafe/WPCafeAuthorization')) @@ -636,6 +637,8 @@ export default function IntegInfo() { ) case 'FluentCart': return + case 'WP ERP': + return case 'Ninja Tables': return case 'WC Affiliate': diff --git a/frontend/src/components/AllIntegrations/NewInteg.jsx b/frontend/src/components/AllIntegrations/NewInteg.jsx index 0db113b5c..9de5b69ef 100644 --- a/frontend/src/components/AllIntegrations/NewInteg.jsx +++ b/frontend/src/components/AllIntegrations/NewInteg.jsx @@ -171,6 +171,7 @@ const WishlistMember = lazy(() => import('./WishlistMember/WishlistMember')) const CreatorLms = lazy(() => import('./CreatorLms/CreatorLms')) const UltimateAffiliatePro = lazy(() => import('./UltimateAffiliatePro/UltimateAffiliatePro')) const FluentCart = lazy(() => import('./FluentCart/FluentCart')) +const WpErp = lazy(() => import('./WpErp/WpErp')) const NinjaTables = lazy(() => import('./NinjaTables/NinjaTables')) const WCAffiliate = lazy(() => import('./WCAffiliate/WCAffiliate')) const WPCafe = lazy(() => import('./WPCafe/WPCafe')) @@ -1668,6 +1669,15 @@ export default function NewInteg({ allIntegURL }) { setFlow={setFlow} /> ) + case 'WP ERP': + return ( + + ) case 'Ninja Tables': return ( + + +
+ {__('Integration Name:', 'bit-integrations')} + handleInput(e, wpErpConf, setWpErpConf)} + name="name" + value={wpErpConf.name} + type="text" + placeholder={__('Integration Name...', 'bit-integrations')} + /> +
+
+ + + + + + + saveActionConf({ + flow, + setFlow, + allIntegURL, + conf: wpErpConf, + navigate, + id, + edit: 1, + setIsLoading, + setSnackbar + }) + } + disabled={!checkMappedFields(wpErpConf)} + isLoading={isLoading} + dataConf={wpErpConf} + setDataConf={setWpErpConf} + formFields={formFields} + /> +
+ + ) +} diff --git a/frontend/src/components/AllIntegrations/WpErp/WpErp.jsx b/frontend/src/components/AllIntegrations/WpErp/WpErp.jsx new file mode 100644 index 000000000..65942aaf2 --- /dev/null +++ b/frontend/src/components/AllIntegrations/WpErp/WpErp.jsx @@ -0,0 +1,103 @@ +import { useState } from 'react' +import 'react-multiple-select-dropdown-lite/dist/index.css' +import { useNavigate, useParams } from 'react-router' +import BackIcn from '../../../Icons/BackIcn' +import { __ } from '../../../Utils/i18nwrap' +import SnackMsg from '../../Utilities/SnackMsg' +import { saveIntegConfig } from '../IntegrationHelpers/IntegrationHelpers' +import IntegrationStepThree from '../IntegrationHelpers/IntegrationStepThree' +import WpErpAuthorization from './WpErpAuthorization' +import { checkMappedFields } from './WpErpCommonFunc' +import WpErpIntegLayout from './WpErpIntegLayout' + +export default function WpErp({ formFields, setFlow, flow, allIntegURL }) { + const navigate = useNavigate() + const { formID } = useParams() + const [isLoading, setIsLoading] = useState(false) + const [step, setStep] = useState(1) + const [snack, setSnackbar] = useState({ show: false }) + const [wpErpConf, setWpErpConf] = useState({ + name: 'WP ERP', + type: 'WP ERP', + field_map: [{ formField: '', wpErpField: '' }], + actions: {}, + utilities: {}, + mainAction: '' + }) + + const nextPage = val => { + setTimeout(() => { + document.getElementById('btcd-settings-wrp').scrollTop = 0 + }, 300) + + if (val === 3) { + if (!checkMappedFields(wpErpConf)) { + setSnackbar({ + show: true, + msg: __('Please map all required fields to continue.', 'bit-integrations') + }) + return + } + + if (wpErpConf.name !== '' && wpErpConf.field_map.length > 0) { + setStep(val) + } + } else { + setStep(val) + } + } + + return ( +
+ + + + +
+ +
+
+
+ +
+ + + saveIntegConfig(flow, setFlow, allIntegURL, wpErpConf, navigate, '', '', setIsLoading) + } + isLoading={isLoading} + /> +
+ ) +} diff --git a/frontend/src/components/AllIntegrations/WpErp/WpErpAuthorization.jsx b/frontend/src/components/AllIntegrations/WpErp/WpErpAuthorization.jsx new file mode 100644 index 000000000..418fd7344 --- /dev/null +++ b/frontend/src/components/AllIntegrations/WpErp/WpErpAuthorization.jsx @@ -0,0 +1,106 @@ +import { useState } from 'react' +import BackIcn from '../../../Icons/BackIcn' +import bitsFetch from '../../../Utils/bitsFetch' +import { __ } from '../../../Utils/i18nwrap' +import LoaderSm from '../../Loaders/LoaderSm' + +export default function WpErpAuthorization({ + wpErpConf, + setWpErpConf, + step, + nextPage, + isLoading, + setIsLoading, + setSnackbar +}) { + const [isAuthorized, setIsAuthorized] = useState(false) + const [showAuthMsg, setShowAuthMsg] = useState(false) + + const authorizeHandler = () => { + setIsLoading('auth') + bitsFetch({}, 'wp_erp_authorize').then(result => { + if (result?.success) { + setIsAuthorized(true) + setSnackbar({ + show: true, + msg: __('Connected with WP ERP Successfully', 'bit-integrations') + }) + } + setIsLoading(false) + setShowAuthMsg(true) + }) + } + + const handleInput = e => { + const newConf = { ...wpErpConf } + newConf[e.target.name] = e.target.value + setWpErpConf(newConf) + } + + return ( +
+
+ {__('Integration Name:', 'bit-integrations')} +
+ + + {isLoading === 'auth' && ( +
+ + {__('Checking if WP ERP is authorized!!!', 'bit-integrations')} +
+ )} + + {showAuthMsg && !isAuthorized && !isLoading && ( +
+
+
+ +
+
+ {__('WP ERP is not activated or not installed', 'bit-integrations')} +
+
+
+ )} + + {showAuthMsg && isAuthorized && !isLoading && ( +
+
+ +
+
{__('WP ERP is activated', 'bit-integrations')}
+
+ )} + + +
+ +
+ ) +} diff --git a/frontend/src/components/AllIntegrations/WpErp/WpErpCommonFunc.js b/frontend/src/components/AllIntegrations/WpErp/WpErpCommonFunc.js new file mode 100644 index 000000000..c47f93a73 --- /dev/null +++ b/frontend/src/components/AllIntegrations/WpErp/WpErpCommonFunc.js @@ -0,0 +1,68 @@ +import { create } from 'mutative' +import toast from 'react-hot-toast' +import bitsFetch from '../../../Utils/bitsFetch' +import { __, sprintf } from '../../../Utils/i18nwrap' + +export const handleInput = (e, wpErpConf, setWpErpConf) => { + const { name, value } = e.target + + setWpErpConf(prevConf => + create(prevConf, draftConf => { + draftConf[name] = value + }) + ) +} + +export const checkMappedFields = wpErpConf => { + if (!wpErpConf?.mainAction) return false + + const mappedFields = wpErpConf?.field_map + ? wpErpConf.field_map.filter( + mappedField => + !mappedField.formField || + !mappedField.wpErpField || + (mappedField.formField === 'custom' && !mappedField.customValue) + ) + : [] + + return mappedFields.length === 0 +} + +export const generateMappedField = fields => { + const requiredFlds = fields.filter(fld => fld.required === true) + return requiredFlds.length > 0 + ? requiredFlds.map(field => ({ formField: '', wpErpField: field.key })) + : [{ formField: '', wpErpField: '' }] +} + +const refreshGeneric = (endpoint, dataKey, setWpErpConf, setIsLoading, draftKey, label) => { + setIsLoading(true) + bitsFetch(null, endpoint) + .then(result => { + if (result?.success && result?.data?.[dataKey]) { + setWpErpConf(prevConf => + create(prevConf, draftConf => { + draftConf[draftKey] = result.data[dataKey] + }) + ) + setIsLoading(false) + toast.success(sprintf(__(`%s fetched successfully`, 'bit-integrations'), label)) + return + } + setIsLoading(false) + toast.error(sprintf(__(`%s fetch failed. Please try again`, 'bit-integrations'), label)) + }) + .catch(() => setIsLoading(false)) +} + +export const refreshContactGroups = (setWpErpConf, setIsLoading) => + refreshGeneric('refresh_wp_erp_contact_groups', 'groups', setWpErpConf, setIsLoading, 'allContactGroups', 'Contact groups') + +export const refreshLifeStages = (setWpErpConf, setIsLoading) => + refreshGeneric('refresh_wp_erp_life_stages', 'stages', setWpErpConf, setIsLoading, 'allLifeStages', 'Life stages') + +export const refreshDepartments = (setWpErpConf, setIsLoading) => + refreshGeneric('refresh_wp_erp_departments', 'departments', setWpErpConf, setIsLoading, 'allDepartments', 'Departments') + +export const refreshDesignations = (setWpErpConf, setIsLoading) => + refreshGeneric('refresh_wp_erp_designations', 'designations', setWpErpConf, setIsLoading, 'allDesignations', 'Designations') diff --git a/frontend/src/components/AllIntegrations/WpErp/WpErpFieldMap.jsx b/frontend/src/components/AllIntegrations/WpErp/WpErpFieldMap.jsx new file mode 100644 index 000000000..542773e61 --- /dev/null +++ b/frontend/src/components/AllIntegrations/WpErp/WpErpFieldMap.jsx @@ -0,0 +1,104 @@ +import { useRecoilValue } from 'recoil' +import { $appConfigState } from '../../../GlobalStates' +import { __, sprintf } from '../../../Utils/i18nwrap' +import { SmartTagField } from '../../../Utils/StaticData/SmartTagField' +import TagifyInput from '../../Utilities/TagifyInput' +import { + addFieldMap, + delFieldMap, + handleCustomValue, + handleFieldMapping +} from '../GlobalIntegrationHelper' + +export default function WpErpFieldMap({ i, formFields, field, wpErpConf, setWpErpConf }) { + const btcbi = useRecoilValue($appConfigState) + const { isPro } = btcbi + + const requiredFlds = wpErpConf?.wpErpFields?.filter(fld => fld.required === true) || [] + const nonRequiredFlds = wpErpConf?.wpErpFields?.filter(fld => fld.required === false) || [] + + return ( +
+
+
+ + + {field.formField === 'custom' && ( + handleCustomValue(e, i, wpErpConf, setWpErpConf)} + label={__('Custom Value', 'bit-integrations')} + className="mr-2" + type="text" + value={field.customValue} + placeholder={__('Custom Value', 'bit-integrations')} + formFields={formFields} + /> + )} + + +
+ {i >= requiredFlds.length && ( + <> + + + + )} +
+
+ ) +} diff --git a/frontend/src/components/AllIntegrations/WpErp/WpErpIntegLayout.jsx b/frontend/src/components/AllIntegrations/WpErp/WpErpIntegLayout.jsx new file mode 100644 index 000000000..478ff56f7 --- /dev/null +++ b/frontend/src/components/AllIntegrations/WpErp/WpErpIntegLayout.jsx @@ -0,0 +1,279 @@ +import { create } from 'mutative' +import { useEffect } from 'react' +import MultiSelect from 'react-multiple-select-dropdown-lite' +import { useRecoilValue } from 'recoil' +import { $appConfigState } from '../../../GlobalStates' +import { __ } from '../../../Utils/i18nwrap' +import Loader from '../../Loaders/Loader' +import { checkIsPro, getProLabel } from '../../Utilities/ProUtilHelpers' +import { addFieldMap } from '../IntegrationHelpers/IntegrationHelpers' +import { + generateMappedField, + refreshContactGroups, + refreshDepartments, + refreshDesignations, + refreshLifeStages +} from './WpErpCommonFunc' +import WpErpFieldMap from './WpErpFieldMap' +import { + CompanyDeleteFields, + CompanyFields, + CompanyUpdateFields, + ContactDeleteFields, + ContactFields, + ContactGroupFields, + ContactUpdateFields, + DepartmentFields, + DesignationFields, + EmployeeFields, + EmployeeUpdateFields, + ExpenseFields, + GroupSubscriberFields, + HolidayFields, + modules, + NoteFields, + PaymentFields, + TaskFields +} from './staticData' + +const FIELDS_BY_ACTION = { + createContact: ContactFields, + updateContact: ContactUpdateFields, + deleteContact: ContactDeleteFields, + createCompany: CompanyFields, + updateCompany: CompanyUpdateFields, + deleteCompany: CompanyDeleteFields, + createContactGroup: ContactGroupFields, + addContactToGroup: GroupSubscriberFields, + removeContactFromGroup: GroupSubscriberFields, + addNote: NoteFields, + createTask: TaskFields, + createEmployee: EmployeeFields, + updateEmployee: EmployeeUpdateFields, + createDepartment: DepartmentFields, + createDesignation: DesignationFields, + createHoliday: HolidayFields, + createExpense: ExpenseFields, + createPayment: PaymentFields +} + +const CRM_GROUP_ACTIONS = ['createContact', 'updateContact', 'addContactToGroup', 'removeContactFromGroup'] +const LIFE_STAGE_ACTIONS = ['createContact', 'updateContact'] +const HRM_DEPT_ACTIONS = ['createEmployee', 'updateEmployee'] + +export default function WpErpIntegLayout({ + formFields, + wpErpConf, + setWpErpConf, + isLoading, + setIsLoading +}) { + const btcbi = useRecoilValue($appConfigState) + const { isPro } = btcbi + + const handleMainAction = value => { + setWpErpConf(prevConf => + create(prevConf, draftConf => { + draftConf.mainAction = value + draftConf.wpErpFields = FIELDS_BY_ACTION[value] || [] + draftConf.field_map = generateMappedField(draftConf.wpErpFields) + }) + ) + + if (CRM_GROUP_ACTIONS.includes(value)) refreshContactGroups(setWpErpConf, setIsLoading) + if (LIFE_STAGE_ACTIONS.includes(value)) refreshLifeStages(setWpErpConf, setIsLoading) + if (HRM_DEPT_ACTIONS.includes(value)) { + refreshDepartments(setWpErpConf, setIsLoading) + refreshDesignations(setWpErpConf, setIsLoading) + } + } + + useEffect(() => { + if (wpErpConf?.mainAction && !wpErpConf?.wpErpFields) { + setWpErpConf(prev => + create(prev, draft => { + draft.wpErpFields = FIELDS_BY_ACTION[prev.mainAction] || [] + }) + ) + } + }, [wpErpConf?.mainAction]) + + const setUtility = (key, val) => + setWpErpConf(prev => + create(prev, draft => { + draft.utilities = { ...(draft.utilities || {}), [key]: val } + }) + ) + + const groupedOptions = modules.map(action => ({ + label: checkIsPro(isPro, action.is_pro) + ? `${action.group}: ${action.label}` + : getProLabel(`${action.group}: ${action.label}`), + value: action.name, + disabled: !checkIsPro(isPro, action.is_pro) + })) + + return ( + <> +
+
+ {__('Action:', 'bit-integrations')} + handleMainAction(value)} + options={groupedOptions} + singleSelect + closeOnSelect + /> +
+ + {LIFE_STAGE_ACTIONS.includes(wpErpConf?.mainAction) && ( + <> +
+
+ {__('Life Stage:', 'bit-integrations')} + setUtility('lifeStage', val)} + singleSelect + closeOnSelect + /> + +
+ + )} + + {CRM_GROUP_ACTIONS.includes(wpErpConf?.mainAction) && ( + <> +
+
+ {__('Contact Groups:', 'bit-integrations')} + ({ label: group?.label, value: group?.value?.toString() }))} + onChange={val => setUtility('groupId', val)} + /> + +
+ + )} + + {HRM_DEPT_ACTIONS.includes(wpErpConf?.mainAction) && ( + <> +
+
+ {__('Department:', 'bit-integrations')} + ({ label: dept?.label, value: dept?.value?.toString() }))} + onChange={val => setUtility('department', val)} + singleSelect + closeOnSelect + /> + +
+
+
+ {__('Designation:', 'bit-integrations')} + ({ label: designation?.label, value: designation?.value?.toString() }))} + onChange={val => setUtility('designation', val)} + singleSelect + closeOnSelect + /> + +
+ + )} + + {isLoading && ( + + )} + + {wpErpConf?.mainAction && wpErpConf?.wpErpFields && ( +
+ {__('Map Fields', 'bit-integrations')} +
+
+
+ {__('Form Fields', 'bit-integrations')} +
+
+ {__('WP ERP Fields', 'bit-integrations')} +
+
+ + {wpErpConf?.field_map?.map((itm, i) => ( + + ))} +
+ +
+
+
+ )} + + ) +} diff --git a/frontend/src/components/AllIntegrations/WpErp/staticData.js b/frontend/src/components/AllIntegrations/WpErp/staticData.js new file mode 100644 index 000000000..402c5fc71 --- /dev/null +++ b/frontend/src/components/AllIntegrations/WpErp/staticData.js @@ -0,0 +1,189 @@ +import { __ } from '../../../Utils/i18nwrap' + +export const modules = [ + // CRM + { name: 'createContact', label: __('Create Contact', 'bit-integrations'), is_pro: true, group: 'CRM' }, + { name: 'updateContact', label: __('Update Contact', 'bit-integrations'), is_pro: true, group: 'CRM' }, + { name: 'deleteContact', label: __('Delete Contact', 'bit-integrations'), is_pro: true, group: 'CRM' }, + { name: 'createCompany', label: __('Create Company', 'bit-integrations'), is_pro: true, group: 'CRM' }, + { name: 'updateCompany', label: __('Update Company', 'bit-integrations'), is_pro: true, group: 'CRM' }, + { name: 'deleteCompany', label: __('Delete Company', 'bit-integrations'), is_pro: true, group: 'CRM' }, + { name: 'createContactGroup', label: __('Create Contact Group', 'bit-integrations'), is_pro: true, group: 'CRM' }, + { name: 'addContactToGroup', label: __('Add Contact To Group', 'bit-integrations'), is_pro: true, group: 'CRM' }, + { name: 'removeContactFromGroup', label: __('Remove Contact From Group', 'bit-integrations'), is_pro: true, group: 'CRM' }, + { name: 'addNote', label: __('Add Note To Contact', 'bit-integrations'), is_pro: true, group: 'CRM' }, + { name: 'createTask', label: __('Create Task', 'bit-integrations'), is_pro: true, group: 'CRM' }, + // HRM + { name: 'createEmployee', label: __('Create Employee', 'bit-integrations'), is_pro: true, group: 'HRM' }, + { name: 'updateEmployee', label: __('Update Employee', 'bit-integrations'), is_pro: true, group: 'HRM' }, + { name: 'createDepartment', label: __('Create Department', 'bit-integrations'), is_pro: true, group: 'HRM' }, + { name: 'createDesignation', label: __('Create Designation', 'bit-integrations'), is_pro: true, group: 'HRM' }, + { name: 'createHoliday', label: __('Create Holiday', 'bit-integrations'), is_pro: true, group: 'HRM' }, + // Accounting + { name: 'createExpense', label: __('Create Expense', 'bit-integrations'), is_pro: true, group: 'Accounting' }, + { name: 'createPayment', label: __('Create Payment', 'bit-integrations'), is_pro: true, group: 'Accounting' } +] + +export const ContactFields = [ + { key: 'first_name', label: __('First Name', 'bit-integrations'), required: true }, + { key: 'email', label: __('Email', 'bit-integrations'), required: true }, + { key: 'last_name', label: __('Last Name', 'bit-integrations'), required: false }, + { key: 'company', label: __('Company', 'bit-integrations'), required: false }, + { key: 'phone', label: __('Phone', 'bit-integrations'), required: false }, + { key: 'mobile', label: __('Mobile', 'bit-integrations'), required: false }, + { key: 'website', label: __('Website', 'bit-integrations'), required: false }, + { key: 'fax', label: __('Fax', 'bit-integrations'), required: false }, + { key: 'notes', label: __('Notes', 'bit-integrations'), required: false }, + { key: 'street_1', label: __('Street 1', 'bit-integrations'), required: false }, + { key: 'street_2', label: __('Street 2', 'bit-integrations'), required: false }, + { key: 'city', label: __('City', 'bit-integrations'), required: false }, + { key: 'state', label: __('State', 'bit-integrations'), required: false }, + { key: 'postal_code', label: __('Postal Code', 'bit-integrations'), required: false }, + { key: 'country', label: __('Country', 'bit-integrations'), required: false }, + { key: 'currency', label: __('Currency', 'bit-integrations'), required: false } +] + +export const ContactUpdateFields = [ + { key: 'id', label: __('Contact ID', 'bit-integrations'), required: true }, + { key: 'first_name', label: __('First Name', 'bit-integrations'), required: false }, + { key: 'last_name', label: __('Last Name', 'bit-integrations'), required: false }, + { key: 'email', label: __('Email', 'bit-integrations'), required: false }, + { key: 'phone', label: __('Phone', 'bit-integrations'), required: false }, + { key: 'mobile', label: __('Mobile', 'bit-integrations'), required: false }, + { key: 'company', label: __('Company', 'bit-integrations'), required: false }, + { key: 'website', label: __('Website', 'bit-integrations'), required: false }, + { key: 'street_1', label: __('Street 1', 'bit-integrations'), required: false }, + { key: 'street_2', label: __('Street 2', 'bit-integrations'), required: false }, + { key: 'city', label: __('City', 'bit-integrations'), required: false }, + { key: 'state', label: __('State', 'bit-integrations'), required: false }, + { key: 'postal_code', label: __('Postal Code', 'bit-integrations'), required: false }, + { key: 'country', label: __('Country', 'bit-integrations'), required: false } +] + +export const ContactDeleteFields = [ + { key: 'contact_id', label: __('Contact ID', 'bit-integrations'), required: true }, + { key: 'force_delete', label: __('Force Delete (1/0)', 'bit-integrations'), required: false } +] + +export const CompanyFields = [ + { key: 'company', label: __('Company Name', 'bit-integrations'), required: true }, + { key: 'email', label: __('Email', 'bit-integrations'), required: true }, + { key: 'phone', label: __('Phone', 'bit-integrations'), required: false }, + { key: 'website', label: __('Website', 'bit-integrations'), required: false }, + { key: 'fax', label: __('Fax', 'bit-integrations'), required: false }, + { key: 'street_1', label: __('Street 1', 'bit-integrations'), required: false }, + { key: 'street_2', label: __('Street 2', 'bit-integrations'), required: false }, + { key: 'city', label: __('City', 'bit-integrations'), required: false }, + { key: 'state', label: __('State', 'bit-integrations'), required: false }, + { key: 'postal_code', label: __('Postal Code', 'bit-integrations'), required: false }, + { key: 'country', label: __('Country', 'bit-integrations'), required: false } +] + +export const CompanyUpdateFields = [ + { key: 'id', label: __('Company ID', 'bit-integrations'), required: true }, + ...CompanyFields.map(f => ({ ...f, required: false })).filter(f => f.key !== 'id') +] + +export const CompanyDeleteFields = [ + { key: 'company_id', label: __('Company ID', 'bit-integrations'), required: true }, + { key: 'force_delete', label: __('Force Delete (1/0)', 'bit-integrations'), required: false } +] + +export const ContactGroupFields = [ + { key: 'name', label: __('Group Name', 'bit-integrations'), required: true }, + { key: 'description', label: __('Description', 'bit-integrations'), required: false } +] + +export const GroupSubscriberFields = [ + { key: 'contact_id', label: __('Contact ID', 'bit-integrations'), required: true }, + { key: 'group_id', label: __('Group ID', 'bit-integrations'), required: true } +] + +export const NoteFields = [ + { key: 'user_id', label: __('Contact User ID', 'bit-integrations'), required: true }, + { key: 'message', label: __('Message', 'bit-integrations'), required: true } +] + +export const TaskFields = [ + { key: 'title', label: __('Title', 'bit-integrations'), required: true }, + { key: 'contact_id', label: __('Contact ID', 'bit-integrations'), required: true }, + { key: 'message', label: __('Message', 'bit-integrations'), required: false }, + { key: 'start_date', label: __('Start Date (Y-m-d H:i:s)', 'bit-integrations'), required: false }, + { key: 'end_date', label: __('End Date (Y-m-d H:i:s)', 'bit-integrations'), required: false }, + { key: 'assigned_to', label: __('Assigned To User ID', 'bit-integrations'), required: false } +] + +export const EmployeeFields = [ + { key: 'first_name', label: __('First Name', 'bit-integrations'), required: true }, + { key: 'last_name', label: __('Last Name', 'bit-integrations'), required: true }, + { key: 'user_email', label: __('Email', 'bit-integrations'), required: true }, + { key: 'middle_name', label: __('Middle Name', 'bit-integrations'), required: false }, + { key: 'phone', label: __('Phone', 'bit-integrations'), required: false }, + { key: 'mobile', label: __('Mobile', 'bit-integrations'), required: false }, + { key: 'employee_id', label: __('Employee ID', 'bit-integrations'), required: false }, + { key: 'date_of_birth', label: __('Date of Birth', 'bit-integrations'), required: false }, + { key: 'hiring_date', label: __('Hiring Date', 'bit-integrations'), required: false }, + { key: 'location', label: __('Location', 'bit-integrations'), required: false }, + { key: 'type', label: __('Employment Type', 'bit-integrations'), required: false }, + { key: 'status', label: __('Status', 'bit-integrations'), required: false }, + { key: 'gender', label: __('Gender', 'bit-integrations'), required: false }, + { key: 'marital_status', label: __('Marital Status', 'bit-integrations'), required: false }, + { key: 'nationality', label: __('Nationality', 'bit-integrations'), required: false }, + { key: 'reporting_to', label: __('Reporting To', 'bit-integrations'), required: false }, + { key: 'pay_rate', label: __('Pay Rate', 'bit-integrations'), required: false }, + { key: 'pay_type', label: __('Pay Type', 'bit-integrations'), required: false }, + { key: 'personal_email', label: __('Personal Email', 'bit-integrations'), required: false }, + { key: 'street_1', label: __('Street 1', 'bit-integrations'), required: false }, + { key: 'street_2', label: __('Street 2', 'bit-integrations'), required: false }, + { key: 'city', label: __('City', 'bit-integrations'), required: false }, + { key: 'state', label: __('State', 'bit-integrations'), required: false }, + { key: 'postal_code', label: __('Postal Code', 'bit-integrations'), required: false }, + { key: 'country', label: __('Country', 'bit-integrations'), required: false } +] + +export const EmployeeUpdateFields = [ + { key: 'user_id', label: __('User ID', 'bit-integrations'), required: true }, + ...EmployeeFields.map(f => ({ ...f, required: false })) +] + +export const DepartmentFields = [ + { key: 'title', label: __('Department Title', 'bit-integrations'), required: true }, + { key: 'description', label: __('Description', 'bit-integrations'), required: false }, + { key: 'lead', label: __('Lead User ID', 'bit-integrations'), required: false }, + { key: 'parent', label: __('Parent Department ID', 'bit-integrations'), required: false } +] + +export const DesignationFields = [ + { key: 'title', label: __('Designation Title', 'bit-integrations'), required: true }, + { key: 'description', label: __('Description', 'bit-integrations'), required: false } +] + +export const HolidayFields = [ + { key: 'title', label: __('Title', 'bit-integrations'), required: true }, + { key: 'start', label: __('Start Date', 'bit-integrations'), required: true }, + { key: 'end', label: __('End Date', 'bit-integrations'), required: true }, + { key: 'description', label: __('Description', 'bit-integrations'), required: false } +] + +export const ExpenseFields = [ + { key: 'amount', label: __('Amount', 'bit-integrations'), required: true }, + { key: 'people_id', label: __('People ID', 'bit-integrations'), required: false }, + { key: 'voucher_date', label: __('Voucher Date (Y-m-d)', 'bit-integrations'), required: false }, + { key: 'trn_date', label: __('Transaction Date (Y-m-d)', 'bit-integrations'), required: false }, + { key: 'ref', label: __('Reference', 'bit-integrations'), required: false }, + { key: 'check_no', label: __('Check No', 'bit-integrations'), required: false }, + { key: 'name', label: __('Name', 'bit-integrations'), required: false }, + { key: 'particulars', label: __('Particulars', 'bit-integrations'), required: false }, + { key: 'trn_by', label: __('Transaction By (1=Cash)', 'bit-integrations'), required: false }, + { key: 'ledger_id', label: __('Ledger ID', 'bit-integrations'), required: false } +] + +export const PaymentFields = [ + { key: 'amount', label: __('Amount', 'bit-integrations'), required: true }, + { key: 'customer_id', label: __('Customer ID', 'bit-integrations'), required: false }, + { key: 'trn_date', label: __('Transaction Date (Y-m-d)', 'bit-integrations'), required: false }, + { key: 'particulars', label: __('Particulars', 'bit-integrations'), required: false }, + { key: 'ref', label: __('Reference', 'bit-integrations'), required: false }, + { key: 'deposit_to', label: __('Deposit To', 'bit-integrations'), required: false }, + { key: 'trn_by', label: __('Transaction By (1=Cash)', 'bit-integrations'), required: false } +] diff --git a/frontend/src/components/Flow/New/SelectAction.jsx b/frontend/src/components/Flow/New/SelectAction.jsx index 5110534f0..dc278abe9 100644 --- a/frontend/src/components/Flow/New/SelectAction.jsx +++ b/frontend/src/components/Flow/New/SelectAction.jsx @@ -176,6 +176,7 @@ export default function SelectAction() { { type: 'MailerPress' }, { type: 'CreatorLms' }, { type: 'FluentCart' }, + { type: 'WP ERP', logo: 'wpErp' }, { type: 'Ninja Tables' }, { type: 'WC Affiliate' }, { type: 'WPCafe' }, diff --git a/frontend/src/resource/img/integ/wpErp.webp b/frontend/src/resource/img/integ/wpErp.webp new file mode 100644 index 0000000000000000000000000000000000000000..22ceefcc9eefaa3d58c526245a60dd52dc0ede63 GIT binary patch literal 4144 zcmV-05YO*YNk&E}5C8yIMM6+kP&il$0000G0000F0RRsH06|PpNOuVU00D2pux;D0 zxmmKCMMQjBC^HpU1gti1EX$F1De_X6F?tuhKYNABQUTPpZI{wkuZr`Kn8~DKteT+K zp=?KNL?vh->UaJJRE5QYwfMIi(fbc*eD}bW`0wMck^~RftdO8lfvq*I*$p&PGv$Nb(dNNarDum zP#%_Q0r6BjQV7q>P7X0OIiV14v?7?N^ZC-v?QJQalC|=NxOenAn5OPt2fATeU*9Jp zqOYx?zsgwECf+yiIWW9?9hv(RF*Neh)jSg4=Vcwf6F05Jme@P5lJ%4LK29Ft`?+VH zDBzw{X~eZNF2ZN}dAcPYrwMs_C!U>O1^9d(S;VWEl_iZhc7{24zv*p>XEQHH@5Jv> zFTiuUWf1TC8yQlG-(?k^Z+jMnaG#Z*+L@bm4PH~P9~4Gw@SK*O!htxoJMfzASro#r zshWWNDm&s-&%k3z-xL4ehMI>I8^q_P29FQZ6Y;;*N|0oY`23Z`^@qiYxVNScDKJ$O z38@p8<~^?8O^N@H*EE=B8WYRvNQYu`F-+oWesm(<_xc@}R@#O`e;Y-~SQ3YybzIF3 zzKQeikJl_%7CNgVU3XQfXcLEj3b@+Z6X(|87AypyBHC2XSt;vS64| zjRP^%la}yU^d*ayAO7NfSn#858 zh)<_r4>kN}ur;HOa@ zK69E)(fBARjRNcffDzc@20n{JhoVv!)H;Yq0BI|rtqPx2-KFT%XvIXFkLGqe0QDizw#=cgN~WgZG+2 zQM?k7Np-Y>3EIiWX^?_frR!2; z9|cr61~a^ZJHykW1kXP|DZ1^6fa(;imAnEx>-!6q{shmp6-Bl=tSb<3Hz4YG0J0CQ zx7I@zo^v`ywDU)+Bq8QyP)^1R%Z@{lY>gWQh}#T`WvM1M~lb{I7*iduKs$w30^Je-Ft%1eq^XVor34m&&$t?&I5^dm*ILfOYn1@UbUai0dGt&94er=UY>YE(**MkD)4H{M0kQ==wA+ zx#LH$P5;nM@*b0R-2#}VRDDmr^*CfUlVF)u7Z$M`i0dE>qXDKrMtfqciOUkhd0qp{ zhtZbUx5Tv(!t5Rl^O{M4{t(wX`i_$-{HN5#7X^GHE+guWlQR6@jw}lND=V&9#LcVl zoq9D+#Njp}u3@AttMFYKS;Xf8;_gJ)pBMO6rzhfdATTwuc1`$AwYJ2s^B}PMh&ptW z@R{yyiDRP#f#;k^S{C6mKiCt;r#Faw6G59gd}aq<#Pdf9f?r0?d91*DO4}3HJqW)a zHJf{QPrO;g^~Wv5Uym4Ff%j*Vxc=54gN0+19GdW6niAi}4HzZ`gmr|ha`3Kw6W9A! zFw6}rA{s}B4)3=g#P@%BFnqL~q=?kW(BL^WBECPK!7w=_`VA51+=%GF^V62NcHY3U zwjm-_Nca;CO?XWVi0jiR3xsdBo@T8^#+zo|45hJoT#+$HE=y^5Xbvo8Y~+dx^6(!g=5%ET)+Jy zew|(xEFV|owIM7RVe4GG-4nOpqY_vabn<*q#8nTOTey<{B3@5=2`n>RhrH_$chU-% ziOVUIcwO9qY1<;dRe_-&uE~`iar*HLrcIN4uORZA8>;T5{D}|q2beb2#PCIE7>BBJ zsYN_mtpr%U7{qdy5L@vW0Rs-cdTB6B)Yrte3Bk|8)V-ty_C3mjWn)c@cS+He&mo#z zdJ5=U&x2v+=Z2U!A^dTO%u5L~h%fyH40GL2V!um>FXx8GEnL78yZtB+hWENdK{g

hhJJJ@^LFVrmj zD|O>cfsY}H%kWsqD?s*bx;+ummofN}2E$6%A`Wdu7IIE#NcR9BRl2>s&4Xn|HC*Dd z4ry$Lhcr*jUw(fQrxQrzGCb4?NU04s#I3E!MA8lqO_IzKh33p6o@Xob{3ZgNmYe4gtWd3Y66MXgfxfLz6)px$<>52gY^Cs%mfnLIEthXDXv=L=s=Ro z8$lfEkmkfh2xbv7-8n|zM1fr2TM_4WAl-@{X{#b+yzv=b8YEpAMwC&3yw}zd^x1^m zx2=eAe`O&1ie^X2q=Gn@86KiyRz+OQXjTNc<0|5$(q4yb^Q(Z^c|Sgc##yQf#8Ra> zbHZR~1;p5bIS2=Z3kn zY{xkq?47xq>)qx{Rlz_1|MUMp|Np;#09H^qAc_V60I)9rodGHk0T2N`wOXZ3zrVkt zCe-+|@D_<5`yT6RThf0oKdbYd@Slo#d{R%LA5_i*_#gLg_&?gd z06&0#Md<K7c>DdVqg$^o#Wa^Z@eg_8k7P|Bu)o_M89zum}JDP!Ih* zX#Fhyu|?`Dp#n6+^6CU>hvn1=(+|t25vCuPP$Nt~E}%wuXArQ?(~0(7K#cgm(wPXD zbn6PM_9IOe%&vS3^6CUh%bf8 zeoFfu4L$S2@IREqzLLR2Jr057aBlT!sw#hy5a7VW@vAcK;>pY;YFgp2aY(!net+_D znn-cQv}G7DY%gZUx~#S%<*5xE4w|TcT7w>36Wk0x9oGKdb{AREZ9}9sM(u7I%sQdW zGMZspmQ@8EUAf%}din5_AV!#BMn5=1j5xiP*i^YqF#NiK8g8qPE`kJUhvn1=(+|t2 z5vCuPP!a$D{$|(!0001(71#g&L&kZ4Z3o|dDiA}mFz4#<&IpQHMj2O+?8vZ2N?oUh zsKw|5mz(t|F1IgRVPiV1N1s=%%GF5N(lG#}(>-GdQ_>Wy^ZT8hiVXx^u)U4#lB6oE z2%@c%0l>)Zh;ap(PSXbp9>%~)5yMn=Z1@r6h=3|m0-JUu%!u$r#}Ojr#Z5zMXVrs2<0$QI@9<{_aW(ZbIZjxS$;wDIhqBN?Ii+h zB9dLSIqlfB-Q^+b5fXKJXtkm3b%_2u>N*r?m1P=wN)(mF5xkL6UdSM4#yZwn_75w2 zz}Tj6454>YHezaa)~NUJShaLg20xqUgDoQoiB4JQZ(wgg7(3L{JM!vBo}87#0ORpY-Lj!2=< ze7VZI`&5fux@$h88CpKf~0iVu1#fhea4rBUu3m(WzYYzy1gkqyg|d(Er@ zW21DGr%(@ZCHD}CI{ELSPtGnDGQTRFdmR|m3#5E()}6z=4m7`%fF;-qgBBHDR|nZQ zItF83=*Y+1aBOG}i6DBWBVny695qr1CYDrv=2TXf_DfMvUxe7#_NiZy`15P>_{UNQ z93_kp`TEyZ74;$~Kn{t>MpHZYf;wHDpItpgu6n(K?`<$+2R+hf+4%#vsu%-DOg5?a zGEYA(fFO_nDhEs8}}lPY=KIYrxdai8oDff2f?1>Y@lECZV|*PFm3nKo=ut3;v%_r5t7wF!wh z%M;N31}OP#0_@)WPVI%!WA_uM=Y|y7U2h51_86DdLRiCCmygUuB5N%*yVa{#gr+0% zM$XV53@;h#17GXP8qs9f+D7!+|7N6jc^L@x7FQTEga2f-SDRRj%oKtJi=kUTbn?Pe z+?4h}GL!OJtN}hE5p_6nrT>-MM17yV12?|I8ZBrM2+2lmQC}>St2)cO98S_aMA{~i zn0;|*s=am>nme)4ze9tYGB4XF;y0AAn##kcIi#R4C&})zRqtxQ&%FeE`5wU3^^4}U ztsd<+h_#?^=VU#MzDzigFxCCIz@Z$G3D%we+;sH{pB4pS?>__`Z4tEhHo_= z|N5s-pAmrQl4YtDAZh>rc)o{hi%JDG_+xDL${kC9p91X_yFi8>!i?iE%H*eyVo8`zlOTM(Xm)-gvq3w#49< literal 0 HcmV?d00001 From aa3a5b3fa4483961e8585448468b42f3363e715e Mon Sep 17 00:00:00 2001 From: Rishad Alam <101513331+RishadAlam@users.noreply.github.com> Date: Sat, 25 Apr 2026 13:33:32 +0600 Subject: [PATCH 2/6] feat: wp erp utilities added --- .../AllIntegrations/WpErp/WpErpActions.jsx | 38 +++++++++++++++++++ .../WpErp/WpErpIntegLayout.jsx | 7 ++++ .../AllIntegrations/WpErp/staticData.js | 7 +--- 3 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 frontend/src/components/AllIntegrations/WpErp/WpErpActions.jsx diff --git a/frontend/src/components/AllIntegrations/WpErp/WpErpActions.jsx b/frontend/src/components/AllIntegrations/WpErp/WpErpActions.jsx new file mode 100644 index 000000000..96eb28ce7 --- /dev/null +++ b/frontend/src/components/AllIntegrations/WpErp/WpErpActions.jsx @@ -0,0 +1,38 @@ +/* eslint-disable no-param-reassign */ + +import 'react-multiple-select-dropdown-lite/dist/index.css' +import { __ } from '../../../Utils/i18nwrap' +import TableCheckBox from '../../Utilities/TableCheckBox' + +const deleteActions = ['deleteContact', 'deleteCompany'] +export default function WpErpActions({ wpErpConf, setWpErpConf }) { + + const actionHandler = (e, type) => { + const newConf = { ...wpErpConf } + + if (e.target.checked) { + newConf.utilities[type] = true + } else { + delete newConf.utilities[type] + } + + setWpErpConf({ ...newConf }) + } + + return ( +

+ {deleteActions.includes(wpErpConf.mainAction) && + ( + < TableCheckBox + checked={wpErpConf.utilities?.force_delete || false} + onChange={e => actionHandler(e, 'force_delete')} + className="wdt-200 mt-4 mr-2" + value="force_delete" + title={__('Force Delete', 'bit-integrations')} + subTitle={__('Permanently delete without soft delete?', 'bit-integrations')} + /> + ) + } +
+ ) +} diff --git a/frontend/src/components/AllIntegrations/WpErp/WpErpIntegLayout.jsx b/frontend/src/components/AllIntegrations/WpErp/WpErpIntegLayout.jsx index 478ff56f7..a698b8e67 100644 --- a/frontend/src/components/AllIntegrations/WpErp/WpErpIntegLayout.jsx +++ b/frontend/src/components/AllIntegrations/WpErp/WpErpIntegLayout.jsx @@ -15,6 +15,7 @@ import { refreshLifeStages } from './WpErpCommonFunc' import WpErpFieldMap from './WpErpFieldMap' +import WpErpActions from './WpErpActions' import { CompanyDeleteFields, CompanyFields, @@ -272,6 +273,12 @@ export default function WpErpIntegLayout({

+
+
+ {__('Utilities', 'bit-integrations')} +
+
+
)} diff --git a/frontend/src/components/AllIntegrations/WpErp/staticData.js b/frontend/src/components/AllIntegrations/WpErp/staticData.js index 402c5fc71..ac8362f5d 100644 --- a/frontend/src/components/AllIntegrations/WpErp/staticData.js +++ b/frontend/src/components/AllIntegrations/WpErp/staticData.js @@ -61,8 +61,7 @@ export const ContactUpdateFields = [ ] export const ContactDeleteFields = [ - { key: 'contact_id', label: __('Contact ID', 'bit-integrations'), required: true }, - { key: 'force_delete', label: __('Force Delete (1/0)', 'bit-integrations'), required: false } + { key: 'contact_id', label: __('Contact ID', 'bit-integrations'), required: true } ] export const CompanyFields = [ @@ -85,8 +84,7 @@ export const CompanyUpdateFields = [ ] export const CompanyDeleteFields = [ - { key: 'company_id', label: __('Company ID', 'bit-integrations'), required: true }, - { key: 'force_delete', label: __('Force Delete (1/0)', 'bit-integrations'), required: false } + { key: 'company_id', label: __('Company ID', 'bit-integrations'), required: true } ] export const ContactGroupFields = [ @@ -96,7 +94,6 @@ export const ContactGroupFields = [ export const GroupSubscriberFields = [ { key: 'contact_id', label: __('Contact ID', 'bit-integrations'), required: true }, - { key: 'group_id', label: __('Group ID', 'bit-integrations'), required: true } ] export const NoteFields = [ From 272f24ca9d12c8df717980e6081421407007ddc3 Mon Sep 17 00:00:00 2001 From: Rishad Alam <101513331+RishadAlam@users.noreply.github.com> Date: Sat, 25 Apr 2026 14:14:49 +0600 Subject: [PATCH 3/6] refactor: wp erp action frontend --- backend/Actions/WpErp/RecordApiHelper.php | 2 +- frontend/src/components/AllIntegrations/EditInteg.jsx | 1 - frontend/src/components/AllIntegrations/WpErp/WpErpActions.jsx | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/Actions/WpErp/RecordApiHelper.php b/backend/Actions/WpErp/RecordApiHelper.php index 77debf398..86b4046ab 100644 --- a/backend/Actions/WpErp/RecordApiHelper.php +++ b/backend/Actions/WpErp/RecordApiHelper.php @@ -38,7 +38,7 @@ public function execute($fieldValues, $fieldMap, $utilities) $defaultResponse = [ 'success' => false, // translators: %s: Plugin name - 'message' => wp_sprintf(__('%s plugin is not installed or activate', 'bit-integrations'), 'Bit Integrations Pro') + 'message' => wp_sprintf(__('%s plugin is not installed or activated', 'bit-integrations'), 'Bit Integrations Pro') ]; $hookMap = [ diff --git a/frontend/src/components/AllIntegrations/EditInteg.jsx b/frontend/src/components/AllIntegrations/EditInteg.jsx index 1741d436b..9ab52d73c 100644 --- a/frontend/src/components/AllIntegrations/EditInteg.jsx +++ b/frontend/src/components/AllIntegrations/EditInteg.jsx @@ -259,7 +259,6 @@ export default function EditInteg({ allIntegURL }) { ) } const IntegType = memo(({ allIntegURL, flow }) => { - console.log(flow?.flow_details?.type) switch (flow?.flow_details?.type) { case 'Zoho CRM': return diff --git a/frontend/src/components/AllIntegrations/WpErp/WpErpActions.jsx b/frontend/src/components/AllIntegrations/WpErp/WpErpActions.jsx index 96eb28ce7..37c644ee2 100644 --- a/frontend/src/components/AllIntegrations/WpErp/WpErpActions.jsx +++ b/frontend/src/components/AllIntegrations/WpErp/WpErpActions.jsx @@ -23,7 +23,7 @@ export default function WpErpActions({ wpErpConf, setWpErpConf }) {
{deleteActions.includes(wpErpConf.mainAction) && ( - < TableCheckBox + actionHandler(e, 'force_delete')} className="wdt-200 mt-4 mr-2" From d857ec15a549e7af64dd08cb78783ed7d798fe3f Mon Sep 17 00:00:00 2001 From: Rishad Alam <101513331+RishadAlam@users.noreply.github.com> Date: Wed, 6 May 2026 10:55:43 +0600 Subject: [PATCH 4/6] refactor: remove employee and delete actions from WpErp integration components --- backend/Actions/WpErp/RecordApiHelper.php | 4 -- .../AllIntegrations/WpErp/WpErpActions.jsx | 38 ----------- .../WpErp/WpErpIntegLayout.jsx | 68 ------------------- .../AllIntegrations/WpErp/staticData.js | 45 ------------ 4 files changed, 155 deletions(-) delete mode 100644 frontend/src/components/AllIntegrations/WpErp/WpErpActions.jsx diff --git a/backend/Actions/WpErp/RecordApiHelper.php b/backend/Actions/WpErp/RecordApiHelper.php index 86b4046ab..19f412c6f 100644 --- a/backend/Actions/WpErp/RecordApiHelper.php +++ b/backend/Actions/WpErp/RecordApiHelper.php @@ -44,17 +44,13 @@ public function execute($fieldValues, $fieldMap, $utilities) $hookMap = [ 'createContact' => ['hook' => 'wperp_create_contact', 'type' => 'contact'], 'updateContact' => ['hook' => 'wperp_update_contact', 'type' => 'contact'], - 'deleteContact' => ['hook' => 'wperp_delete_contact', 'type' => 'contact'], 'createCompany' => ['hook' => 'wperp_create_company', 'type' => 'company'], 'updateCompany' => ['hook' => 'wperp_update_company', 'type' => 'company'], - 'deleteCompany' => ['hook' => 'wperp_delete_company', 'type' => 'company'], 'createContactGroup' => ['hook' => 'wperp_create_contact_group', 'type' => 'contact_group'], 'addContactToGroup' => ['hook' => 'wperp_add_contact_to_group', 'type' => 'contact_group'], 'removeContactFromGroup' => ['hook' => 'wperp_remove_contact_from_group', 'type' => 'contact_group'], 'addNote' => ['hook' => 'wperp_add_note', 'type' => 'note'], 'createTask' => ['hook' => 'wperp_create_task', 'type' => 'task'], - 'createEmployee' => ['hook' => 'wperp_create_employee', 'type' => 'employee'], - 'updateEmployee' => ['hook' => 'wperp_update_employee', 'type' => 'employee'], 'createDepartment' => ['hook' => 'wperp_create_department', 'type' => 'department'], 'createDesignation' => ['hook' => 'wperp_create_designation', 'type' => 'designation'], 'createHoliday' => ['hook' => 'wperp_create_holiday', 'type' => 'holiday'], diff --git a/frontend/src/components/AllIntegrations/WpErp/WpErpActions.jsx b/frontend/src/components/AllIntegrations/WpErp/WpErpActions.jsx deleted file mode 100644 index 37c644ee2..000000000 --- a/frontend/src/components/AllIntegrations/WpErp/WpErpActions.jsx +++ /dev/null @@ -1,38 +0,0 @@ -/* eslint-disable no-param-reassign */ - -import 'react-multiple-select-dropdown-lite/dist/index.css' -import { __ } from '../../../Utils/i18nwrap' -import TableCheckBox from '../../Utilities/TableCheckBox' - -const deleteActions = ['deleteContact', 'deleteCompany'] -export default function WpErpActions({ wpErpConf, setWpErpConf }) { - - const actionHandler = (e, type) => { - const newConf = { ...wpErpConf } - - if (e.target.checked) { - newConf.utilities[type] = true - } else { - delete newConf.utilities[type] - } - - setWpErpConf({ ...newConf }) - } - - return ( -
- {deleteActions.includes(wpErpConf.mainAction) && - ( - actionHandler(e, 'force_delete')} - className="wdt-200 mt-4 mr-2" - value="force_delete" - title={__('Force Delete', 'bit-integrations')} - subTitle={__('Permanently delete without soft delete?', 'bit-integrations')} - /> - ) - } -
- ) -} diff --git a/frontend/src/components/AllIntegrations/WpErp/WpErpIntegLayout.jsx b/frontend/src/components/AllIntegrations/WpErp/WpErpIntegLayout.jsx index a698b8e67..c0bb57116 100644 --- a/frontend/src/components/AllIntegrations/WpErp/WpErpIntegLayout.jsx +++ b/frontend/src/components/AllIntegrations/WpErp/WpErpIntegLayout.jsx @@ -10,24 +10,17 @@ import { addFieldMap } from '../IntegrationHelpers/IntegrationHelpers' import { generateMappedField, refreshContactGroups, - refreshDepartments, - refreshDesignations, refreshLifeStages } from './WpErpCommonFunc' import WpErpFieldMap from './WpErpFieldMap' -import WpErpActions from './WpErpActions' import { - CompanyDeleteFields, CompanyFields, CompanyUpdateFields, - ContactDeleteFields, ContactFields, ContactGroupFields, ContactUpdateFields, DepartmentFields, DesignationFields, - EmployeeFields, - EmployeeUpdateFields, ExpenseFields, GroupSubscriberFields, HolidayFields, @@ -40,17 +33,13 @@ import { const FIELDS_BY_ACTION = { createContact: ContactFields, updateContact: ContactUpdateFields, - deleteContact: ContactDeleteFields, createCompany: CompanyFields, updateCompany: CompanyUpdateFields, - deleteCompany: CompanyDeleteFields, createContactGroup: ContactGroupFields, addContactToGroup: GroupSubscriberFields, removeContactFromGroup: GroupSubscriberFields, addNote: NoteFields, createTask: TaskFields, - createEmployee: EmployeeFields, - updateEmployee: EmployeeUpdateFields, createDepartment: DepartmentFields, createDesignation: DesignationFields, createHoliday: HolidayFields, @@ -60,7 +49,6 @@ const FIELDS_BY_ACTION = { const CRM_GROUP_ACTIONS = ['createContact', 'updateContact', 'addContactToGroup', 'removeContactFromGroup'] const LIFE_STAGE_ACTIONS = ['createContact', 'updateContact'] -const HRM_DEPT_ACTIONS = ['createEmployee', 'updateEmployee'] export default function WpErpIntegLayout({ formFields, @@ -83,10 +71,6 @@ export default function WpErpIntegLayout({ if (CRM_GROUP_ACTIONS.includes(value)) refreshContactGroups(setWpErpConf, setIsLoading) if (LIFE_STAGE_ACTIONS.includes(value)) refreshLifeStages(setWpErpConf, setIsLoading) - if (HRM_DEPT_ACTIONS.includes(value)) { - refreshDepartments(setWpErpConf, setIsLoading) - refreshDesignations(setWpErpConf, setIsLoading) - } } useEffect(() => { @@ -180,53 +164,6 @@ export default function WpErpIntegLayout({ )} - {HRM_DEPT_ACTIONS.includes(wpErpConf?.mainAction) && ( - <> -
-
- {__('Department:', 'bit-integrations')} - ({ label: dept?.label, value: dept?.value?.toString() }))} - onChange={val => setUtility('department', val)} - singleSelect - closeOnSelect - /> - -
-
-
- {__('Designation:', 'bit-integrations')} - ({ label: designation?.label, value: designation?.value?.toString() }))} - onChange={val => setUtility('designation', val)} - singleSelect - closeOnSelect - /> - -
- - )} - {isLoading && (

-
- {__('Utilities', 'bit-integrations')} -
-
-
)} diff --git a/frontend/src/components/AllIntegrations/WpErp/staticData.js b/frontend/src/components/AllIntegrations/WpErp/staticData.js index ac8362f5d..138d94710 100644 --- a/frontend/src/components/AllIntegrations/WpErp/staticData.js +++ b/frontend/src/components/AllIntegrations/WpErp/staticData.js @@ -4,18 +4,14 @@ export const modules = [ // CRM { name: 'createContact', label: __('Create Contact', 'bit-integrations'), is_pro: true, group: 'CRM' }, { name: 'updateContact', label: __('Update Contact', 'bit-integrations'), is_pro: true, group: 'CRM' }, - { name: 'deleteContact', label: __('Delete Contact', 'bit-integrations'), is_pro: true, group: 'CRM' }, { name: 'createCompany', label: __('Create Company', 'bit-integrations'), is_pro: true, group: 'CRM' }, { name: 'updateCompany', label: __('Update Company', 'bit-integrations'), is_pro: true, group: 'CRM' }, - { name: 'deleteCompany', label: __('Delete Company', 'bit-integrations'), is_pro: true, group: 'CRM' }, { name: 'createContactGroup', label: __('Create Contact Group', 'bit-integrations'), is_pro: true, group: 'CRM' }, { name: 'addContactToGroup', label: __('Add Contact To Group', 'bit-integrations'), is_pro: true, group: 'CRM' }, { name: 'removeContactFromGroup', label: __('Remove Contact From Group', 'bit-integrations'), is_pro: true, group: 'CRM' }, { name: 'addNote', label: __('Add Note To Contact', 'bit-integrations'), is_pro: true, group: 'CRM' }, { name: 'createTask', label: __('Create Task', 'bit-integrations'), is_pro: true, group: 'CRM' }, // HRM - { name: 'createEmployee', label: __('Create Employee', 'bit-integrations'), is_pro: true, group: 'HRM' }, - { name: 'updateEmployee', label: __('Update Employee', 'bit-integrations'), is_pro: true, group: 'HRM' }, { name: 'createDepartment', label: __('Create Department', 'bit-integrations'), is_pro: true, group: 'HRM' }, { name: 'createDesignation', label: __('Create Designation', 'bit-integrations'), is_pro: true, group: 'HRM' }, { name: 'createHoliday', label: __('Create Holiday', 'bit-integrations'), is_pro: true, group: 'HRM' }, @@ -60,10 +56,6 @@ export const ContactUpdateFields = [ { key: 'country', label: __('Country', 'bit-integrations'), required: false } ] -export const ContactDeleteFields = [ - { key: 'contact_id', label: __('Contact ID', 'bit-integrations'), required: true } -] - export const CompanyFields = [ { key: 'company', label: __('Company Name', 'bit-integrations'), required: true }, { key: 'email', label: __('Email', 'bit-integrations'), required: true }, @@ -83,10 +75,6 @@ export const CompanyUpdateFields = [ ...CompanyFields.map(f => ({ ...f, required: false })).filter(f => f.key !== 'id') ] -export const CompanyDeleteFields = [ - { key: 'company_id', label: __('Company ID', 'bit-integrations'), required: true } -] - export const ContactGroupFields = [ { key: 'name', label: __('Group Name', 'bit-integrations'), required: true }, { key: 'description', label: __('Description', 'bit-integrations'), required: false } @@ -110,39 +98,6 @@ export const TaskFields = [ { key: 'assigned_to', label: __('Assigned To User ID', 'bit-integrations'), required: false } ] -export const EmployeeFields = [ - { key: 'first_name', label: __('First Name', 'bit-integrations'), required: true }, - { key: 'last_name', label: __('Last Name', 'bit-integrations'), required: true }, - { key: 'user_email', label: __('Email', 'bit-integrations'), required: true }, - { key: 'middle_name', label: __('Middle Name', 'bit-integrations'), required: false }, - { key: 'phone', label: __('Phone', 'bit-integrations'), required: false }, - { key: 'mobile', label: __('Mobile', 'bit-integrations'), required: false }, - { key: 'employee_id', label: __('Employee ID', 'bit-integrations'), required: false }, - { key: 'date_of_birth', label: __('Date of Birth', 'bit-integrations'), required: false }, - { key: 'hiring_date', label: __('Hiring Date', 'bit-integrations'), required: false }, - { key: 'location', label: __('Location', 'bit-integrations'), required: false }, - { key: 'type', label: __('Employment Type', 'bit-integrations'), required: false }, - { key: 'status', label: __('Status', 'bit-integrations'), required: false }, - { key: 'gender', label: __('Gender', 'bit-integrations'), required: false }, - { key: 'marital_status', label: __('Marital Status', 'bit-integrations'), required: false }, - { key: 'nationality', label: __('Nationality', 'bit-integrations'), required: false }, - { key: 'reporting_to', label: __('Reporting To', 'bit-integrations'), required: false }, - { key: 'pay_rate', label: __('Pay Rate', 'bit-integrations'), required: false }, - { key: 'pay_type', label: __('Pay Type', 'bit-integrations'), required: false }, - { key: 'personal_email', label: __('Personal Email', 'bit-integrations'), required: false }, - { key: 'street_1', label: __('Street 1', 'bit-integrations'), required: false }, - { key: 'street_2', label: __('Street 2', 'bit-integrations'), required: false }, - { key: 'city', label: __('City', 'bit-integrations'), required: false }, - { key: 'state', label: __('State', 'bit-integrations'), required: false }, - { key: 'postal_code', label: __('Postal Code', 'bit-integrations'), required: false }, - { key: 'country', label: __('Country', 'bit-integrations'), required: false } -] - -export const EmployeeUpdateFields = [ - { key: 'user_id', label: __('User ID', 'bit-integrations'), required: true }, - ...EmployeeFields.map(f => ({ ...f, required: false })) -] - export const DepartmentFields = [ { key: 'title', label: __('Department Title', 'bit-integrations'), required: true }, { key: 'description', label: __('Description', 'bit-integrations'), required: false }, From a033cdc1b3f40c50a23cbb7b05cf93bd47f807cf Mon Sep 17 00:00:00 2001 From: Rishad Alam <101513331+RishadAlam@users.noreply.github.com> Date: Wed, 6 May 2026 11:21:20 +0600 Subject: [PATCH 5/6] fix: enhance response handling and improve button visibility in WpErp integration components --- backend/Actions/WpErp/RecordApiHelper.php | 2 +- backend/Actions/WpErp/WpErpController.php | 2 +- .../WpErp/WpErpAuthorization.jsx | 46 +++++++++++-------- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/backend/Actions/WpErp/RecordApiHelper.php b/backend/Actions/WpErp/RecordApiHelper.php index 19f412c6f..630e8e17f 100644 --- a/backend/Actions/WpErp/RecordApiHelper.php +++ b/backend/Actions/WpErp/RecordApiHelper.php @@ -77,7 +77,7 @@ public function execute($fieldValues, $fieldMap, $utilities) $actionType = $mainAction; } - $responseType = isset($response['success']) && $response['success'] ? 'success' : 'error'; + $responseType = (!is_wp_error($response) && isset($response['success']) && $response['success']) ? 'success' : 'error'; LogHandler::save($this->_integrationID, ['type' => $type, 'type_name' => $actionType], $responseType, $response); return $response; diff --git a/backend/Actions/WpErp/WpErpController.php b/backend/Actions/WpErp/WpErpController.php index fd8235aae..5d08cd517 100644 --- a/backend/Actions/WpErp/WpErpController.php +++ b/backend/Actions/WpErp/WpErpController.php @@ -104,7 +104,7 @@ public function execute($integrationData, $fieldValues) $integrationDetails = $integrationData->flow_details; $integId = $integrationData->id; $fieldMap = $integrationDetails->field_map; - $utilities = isset($integrationDetails->utilities) ? $integrationDetails->utilities : []; + $utilities = $integrationDetails->utilities ?? []; if (empty($fieldMap)) { return new WP_Error('field_map_empty', __('Field map is empty', 'bit-integrations')); diff --git a/frontend/src/components/AllIntegrations/WpErp/WpErpAuthorization.jsx b/frontend/src/components/AllIntegrations/WpErp/WpErpAuthorization.jsx index 418fd7344..382e48254 100644 --- a/frontend/src/components/AllIntegrations/WpErp/WpErpAuthorization.jsx +++ b/frontend/src/components/AllIntegrations/WpErp/WpErpAuthorization.jsx @@ -11,7 +11,8 @@ export default function WpErpAuthorization({ nextPage, isLoading, setIsLoading, - setSnackbar + setSnackbar, + isInfo }) { const [isAuthorized, setIsAuthorized] = useState(false) const [showAuthMsg, setShowAuthMsg] = useState(false) @@ -51,6 +52,7 @@ export default function WpErpAuthorization({ value={wpErpConf.name} type="text" placeholder={__('Integration Name...', 'bit-integrations')} + disabled={isInfo} /> {isLoading === 'auth' && ( @@ -82,25 +84,29 @@ export default function WpErpAuthorization({
)} - -
- + {!isInfo && ( + <> + +
+ + + )} ) } From 3d6aa2dd87cf08ee9de0514f1d8be2085e64be6d Mon Sep 17 00:00:00 2001 From: Rishad Alam <101513331+RishadAlam@users.noreply.github.com> Date: Wed, 6 May 2026 14:14:52 +0600 Subject: [PATCH 6/6] fix: enhance button disable logic in WpErp integration component --- frontend/src/components/AllIntegrations/WpErp/WpErp.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/AllIntegrations/WpErp/WpErp.jsx b/frontend/src/components/AllIntegrations/WpErp/WpErp.jsx index 65942aaf2..f7d863c46 100644 --- a/frontend/src/components/AllIntegrations/WpErp/WpErp.jsx +++ b/frontend/src/components/AllIntegrations/WpErp/WpErp.jsx @@ -83,7 +83,7 @@ export default function WpErp({ formFields, setFlow, flow, allIntegURL }) {