From b2690ea1a0c20d1581b1ba2289d695a2634d01e1 Mon Sep 17 00:00:00 2001 From: orgilshdeee Date: Tue, 31 Oct 2023 08:51:34 +0800 Subject: [PATCH] fix(settings): commented loaders and fixed collapse content ui --- .../src/components/GeneralSettings.tsx | 27 +++++++++++++++---- .../src/components/PerMoveSettings.tsx | 5 +++- .../src/components/PerRemSettings.tsx | 5 +++- .../src/components/PerSettings.tsx | 5 +++- .../src/components/PipelineSettings.tsx | 16 ++++++----- .../src/components/ReturnPerSettings.tsx | 5 +++- .../src/components/ReturnStageSettings.tsx | 15 ++++++----- .../src/components/StageMoveSettings.tsx | 14 +++++----- .../src/components/StageSettings.tsx | 15 ++++++----- .../src/containers/CheckSyncedDeals.tsx | 12 ++++----- .../src/containers/CheckSyncedOrders.tsx | 15 ++++++----- .../src/containers/InventoryCategory.tsx | 18 ++++++------- .../src/containers/InventoryProducts.tsx | 12 ++++----- .../src/containers/PosOrderDetail.tsx | 6 ++--- .../src/containers/Settings.tsx | 6 ++--- .../src/containers/SyncHistoryList.tsx | 6 ++--- 16 files changed, 111 insertions(+), 71 deletions(-) diff --git a/packages/plugin-syncerkhet-ui/src/components/GeneralSettings.tsx b/packages/plugin-syncerkhet-ui/src/components/GeneralSettings.tsx index ef4b411b1a2..a8f574f613b 100644 --- a/packages/plugin-syncerkhet-ui/src/components/GeneralSettings.tsx +++ b/packages/plugin-syncerkhet-ui/src/components/GeneralSettings.tsx @@ -3,7 +3,8 @@ import { CollapseContent, ControlLabel, FormControl, - FormGroup + FormGroup, + Icon } from '@erxes/ui/src/components'; import { MainStyleTitle as Title } from '@erxes/ui/src/styles/eindex'; import { __ } from '@erxes/ui/src/utils'; @@ -89,7 +90,11 @@ class GeneralSettings extends React.Component { const content = ( - + } + transparent={true} + > {this.renderItem('apiKey')} {this.renderItem('apiSecret')} {this.renderItem('apiToken')} @@ -98,7 +103,11 @@ class GeneralSettings extends React.Component { 'Get remainder from erkhet api url' )} - + } + transparent={true} + > {this.renderItem('costAccount', 'Cost Account fullCode on erkhet')} {this.renderItem('saleAccount', 'Sale Account fullCode on erkhet')} {this.renderItem( @@ -110,7 +119,11 @@ class GeneralSettings extends React.Component { 'Set description when incoming erkhet inventory' )} - + } + transparent={true} + > {this.renderItem('checkCompanyUrl')} {this.renderItem( 'customerDefaultName', @@ -127,7 +140,11 @@ class GeneralSettings extends React.Component { {this.renderItem('debtAccounts', 'Split "," account fullcode')} {isEnabled('loans') && ( - + } + transparent={true} + > {this.renderItem('userEmail', 'user email')} {this.renderItem( 'defaultCustomer', diff --git a/packages/plugin-syncerkhet-ui/src/components/PerMoveSettings.tsx b/packages/plugin-syncerkhet-ui/src/components/PerMoveSettings.tsx index f57b96cbd37..8e573283cf2 100644 --- a/packages/plugin-syncerkhet-ui/src/components/PerMoveSettings.tsx +++ b/packages/plugin-syncerkhet-ui/src/components/PerMoveSettings.tsx @@ -9,7 +9,8 @@ import { CollapseContent, ControlLabel, FormControl, - FormGroup + FormGroup, + Icon } from '@erxes/ui/src/components'; import { FieldsCombinedByType } from '@erxes/ui-forms/src/settings/properties/types'; import { FormColumn, FormWrapper } from '@erxes/ui/src/styles/main'; @@ -306,6 +307,8 @@ class PerSettings extends React.Component { return ( } + transparent={true} open={this.props.currentConfigKey === 'newMoveConfig' ? true : false} > diff --git a/packages/plugin-syncerkhet-ui/src/components/PerRemSettings.tsx b/packages/plugin-syncerkhet-ui/src/components/PerRemSettings.tsx index 5a69f8ffe44..fe46477541e 100644 --- a/packages/plugin-syncerkhet-ui/src/components/PerRemSettings.tsx +++ b/packages/plugin-syncerkhet-ui/src/components/PerRemSettings.tsx @@ -3,7 +3,8 @@ import { CollapseContent, ControlLabel, FormControl, - FormGroup + FormGroup, + Icon } from '@erxes/ui/src/components'; import { MainStyleModalFooter as ModalFooter } from '@erxes/ui/src/styles/eindex'; import { __ } from '@erxes/ui/src/utils'; @@ -91,6 +92,8 @@ class PerSettings extends React.Component { return ( } + transparent={true} open={ this.props.currentConfigKey === 'newremainderConfig' ? true : false } diff --git a/packages/plugin-syncerkhet-ui/src/components/PerSettings.tsx b/packages/plugin-syncerkhet-ui/src/components/PerSettings.tsx index b0695d1ad8b..078aa027f07 100644 --- a/packages/plugin-syncerkhet-ui/src/components/PerSettings.tsx +++ b/packages/plugin-syncerkhet-ui/src/components/PerSettings.tsx @@ -3,7 +3,8 @@ import { CollapseContent, ControlLabel, FormControl, - FormGroup + FormGroup, + Icon } from '@erxes/ui/src/components'; import client from '@erxes/ui/src/apolloClient'; import { gql } from '@apollo/client'; @@ -147,6 +148,8 @@ class PerSettings extends React.Component { return ( } + transparent={true} open={this.props.currentConfigKey === 'newEbarimtConfig' ? true : false} > diff --git a/packages/plugin-syncerkhet-ui/src/components/PipelineSettings.tsx b/packages/plugin-syncerkhet-ui/src/components/PipelineSettings.tsx index 23c01fcc55b..001f807e532 100755 --- a/packages/plugin-syncerkhet-ui/src/components/PipelineSettings.tsx +++ b/packages/plugin-syncerkhet-ui/src/components/PipelineSettings.tsx @@ -1,5 +1,5 @@ import { MainStyleTitle as Title } from '@erxes/ui/src/styles/eindex'; -import { __ } from '@erxes/ui/src/utils'; +import { __, confirm } from '@erxes/ui/src/utils'; import { Button } from '@erxes/ui/src/components'; import { Wrapper } from '@erxes/ui/src/layout'; import React from 'react'; @@ -49,19 +49,21 @@ class GeneralSettings extends React.Component { }; delete = (currentConfigKey: string) => { - const { configsMap } = this.state; - delete configsMap.remainderConfig[currentConfigKey]; - delete configsMap.remainderConfig['newPipelineConfig']; - - this.setState({ configsMap }); + confirm('This Action will delete this config are you sure?').then(() => { + const { configsMap } = this.state; + delete configsMap.remainderConfig[currentConfigKey]; + delete configsMap.remainderConfig.newPipelineConfig; + this.setState({ configsMap }); - this.props.save(configsMap); + this.props.save(configsMap); + }); }; renderConfigs(configs) { return Object.keys(configs).map(key => { return ( { return ( } + transparent={true} open={this.props.currentConfigKey === 'newEbarimtConfig' ? true : false} > diff --git a/packages/plugin-syncerkhet-ui/src/components/ReturnStageSettings.tsx b/packages/plugin-syncerkhet-ui/src/components/ReturnStageSettings.tsx index 1d47291e716..34c1f885304 100755 --- a/packages/plugin-syncerkhet-ui/src/components/ReturnStageSettings.tsx +++ b/packages/plugin-syncerkhet-ui/src/components/ReturnStageSettings.tsx @@ -1,5 +1,5 @@ import { MainStyleTitle as Title } from '@erxes/ui/src/styles/eindex'; -import { __ } from '@erxes/ui/src/utils'; +import { __, confirm } from '@erxes/ui/src/utils'; import { Button } from '@erxes/ui/src/components'; import { Wrapper } from '@erxes/ui/src/layout'; import React from 'react'; @@ -52,19 +52,22 @@ class GeneralSettings extends React.Component { }; delete = (currentConfigKey: string) => { - const { configsMap } = this.state; - delete configsMap.returnEbarimtConfig[currentConfigKey]; - delete configsMap.returnEbarimtConfig['newEbarimtConfig']; + confirm('This Action will delete this config are you sure?').then(() => { + const { configsMap } = this.state; + delete configsMap.returnEbarimtConfig[currentConfigKey]; + delete configsMap.returnEbarimtConfig['newEbarimtConfig']; - this.setState({ configsMap }); + this.setState({ configsMap }); - this.props.save(configsMap); + this.props.save(configsMap); + }); }; renderConfigs(configs) { return Object.keys(configs).map(key => { return ( { }; delete = (currentConfigKey: string) => { - const { configsMap } = this.state; - delete configsMap.stageInMoveConfig[currentConfigKey]; - delete configsMap.stageInMoveConfig['newStageInMoveConfig']; + confirm('This Action will delete this config are you sure?').then(() => { + const { configsMap } = this.state; + delete configsMap.stageInMoveConfig[currentConfigKey]; + delete configsMap.stageInMoveConfig.newStageInMoveConfig; - this.setState({ configsMap }); + this.setState({ configsMap }); - this.props.save(configsMap); + this.props.save(configsMap); + }); }; renderConfigs(configs) { diff --git a/packages/plugin-syncerkhet-ui/src/components/StageSettings.tsx b/packages/plugin-syncerkhet-ui/src/components/StageSettings.tsx index c96415e72f7..52c1730e8f0 100755 --- a/packages/plugin-syncerkhet-ui/src/components/StageSettings.tsx +++ b/packages/plugin-syncerkhet-ui/src/components/StageSettings.tsx @@ -1,5 +1,5 @@ import { MainStyleTitle as Title } from '@erxes/ui/src/styles/eindex'; -import { __ } from '@erxes/ui/src/utils'; +import { __, confirm } from '@erxes/ui/src/utils'; import { Button } from '@erxes/ui/src/components'; import { Wrapper } from '@erxes/ui/src/layout'; import React from 'react'; @@ -52,19 +52,22 @@ class GeneralSettings extends React.Component { }; delete = (currentConfigKey: string) => { - const { configsMap } = this.state; - delete configsMap.ebarimtConfig[currentConfigKey]; - delete configsMap.ebarimtConfig['newEbarimtConfig']; + confirm('This Action will delete this config are you sure?').then(() => { + const { configsMap } = this.state; + delete configsMap.ebarimtConfig[currentConfigKey]; + delete configsMap.ebarimtConfig.newEbarimtConfig; - this.setState({ configsMap }); + this.setState({ configsMap }); - this.props.save(configsMap); + this.props.save(configsMap); + }); }; renderConfigs(configs) { return Object.keys(configs).map(key => { return ( { }); }; - if ( - checkSyncItemsQuery.loading || - checkSyncedDealsTotalCountQuery.loading - ) { - return ; - } + // if ( + // checkSyncItemsQuery.loading || + // checkSyncedDealsTotalCountQuery.loading + // ) { + // return ; + // } const deals = checkSyncItemsQuery.deals || []; const totalCount = checkSyncedDealsTotalCountQuery.dealsTotalCount || 0; diff --git a/packages/plugin-syncerkhet-ui/src/containers/CheckSyncedOrders.tsx b/packages/plugin-syncerkhet-ui/src/containers/CheckSyncedOrders.tsx index 09f1d6fb0dd..0022b419506 100644 --- a/packages/plugin-syncerkhet-ui/src/containers/CheckSyncedOrders.tsx +++ b/packages/plugin-syncerkhet-ui/src/containers/CheckSyncedOrders.tsx @@ -106,13 +106,14 @@ class CheckSyncedOrdersContainer extends React.Component { }); }; - if ( - checkSyncItemsQuery.loading || - checkSyncedOrdersTotalCountQuery.loading || - posListQuery.loading - ) { - return ; - } + // if ( + // checkSyncItemsQuery.loading || + // checkSyncedOrdersTotalCountQuery.loading || + // posListQuery.loading + // ) { + // return ; + // } + const orders = checkSyncItemsQuery.posOrders || []; const totalCount = checkSyncedOrdersTotalCountQuery.posOrdersTotalCount || 0; diff --git a/packages/plugin-syncerkhet-ui/src/containers/InventoryCategory.tsx b/packages/plugin-syncerkhet-ui/src/containers/InventoryCategory.tsx index d866554fa21..5032a68fb52 100644 --- a/packages/plugin-syncerkhet-ui/src/containers/InventoryCategory.tsx +++ b/packages/plugin-syncerkhet-ui/src/containers/InventoryCategory.tsx @@ -54,7 +54,7 @@ class InventoryCategoryContainer extends React.Component { const setSyncStatusTrue = (data: any, categories: any, action: string) => { data[action].items = data[action].items.map(i => { if (categories.find(c => c.code === i.code)) { - let temp = i; + const temp = i; temp.syncStatus = true; return temp; } @@ -67,8 +67,8 @@ class InventoryCategoryContainer extends React.Component { this.props .toSyncCategories({ variables: { - action: action, - categories: categories + action, + categories } }) .then(() => { @@ -76,7 +76,7 @@ class InventoryCategoryContainer extends React.Component { Alert.success('Success. Please check again.'); }) .finally(() => { - let data = this.state.items; + const data = this.state.items; setSyncStatusTrue(data, categories, action.toLowerCase()); @@ -93,7 +93,7 @@ class InventoryCategoryContainer extends React.Component { this.props .toCheckCategories({ variables: {} }) .then(response => { - let data = response.data.toCheckCategories; + const data = response.data.toCheckCategories; setSyncStatus(data, 'create'); setSyncStatus(data, 'update'); @@ -108,13 +108,13 @@ class InventoryCategoryContainer extends React.Component { }); }; - if (loading) { - return ; - } + // if (loading) { + // return ; + // } const updatedProps = { ...this.props, - loading: loading, + loading, toCheckCategories, toSyncCategories, items diff --git a/packages/plugin-syncerkhet-ui/src/containers/InventoryProducts.tsx b/packages/plugin-syncerkhet-ui/src/containers/InventoryProducts.tsx index 5c8d82cd4a9..54f05159e56 100644 --- a/packages/plugin-syncerkhet-ui/src/containers/InventoryProducts.tsx +++ b/packages/plugin-syncerkhet-ui/src/containers/InventoryProducts.tsx @@ -54,7 +54,7 @@ class InventoryProductsContainer extends React.Component { const setSyncStatusTrue = (data: any, products: any, action: string) => { data[action].items = data[action].items.map(i => { if (products.find(c => c.code === i.code)) { - let temp = i; + const temp = i; temp.syncStatus = true; return temp; } @@ -67,8 +67,8 @@ class InventoryProductsContainer extends React.Component { this.props .toSyncProducts({ variables: { - action: action, - products: products + action, + products } }) .then(() => { @@ -76,7 +76,7 @@ class InventoryProductsContainer extends React.Component { Alert.success('Success. Please check again.'); }) .finally(() => { - let data = this.state.items; + const data = this.state.items; setSyncStatusTrue(data, products, action.toLowerCase()); @@ -94,7 +94,7 @@ class InventoryProductsContainer extends React.Component { variables: {} }) .then(response => { - let data = response.data.toCheckProducts; + const data = response.data.toCheckProducts; setSyncStatus(data, 'create'); setSyncStatus(data, 'update'); @@ -114,7 +114,7 @@ class InventoryProductsContainer extends React.Component { } const updatedProps = { ...this.props, - loading: loading, + loading, toCheckProducts, items, toSyncProducts diff --git a/packages/plugin-syncerkhet-ui/src/containers/PosOrderDetail.tsx b/packages/plugin-syncerkhet-ui/src/containers/PosOrderDetail.tsx index af5562ea3fc..3e9bd156e39 100644 --- a/packages/plugin-syncerkhet-ui/src/containers/PosOrderDetail.tsx +++ b/packages/plugin-syncerkhet-ui/src/containers/PosOrderDetail.tsx @@ -27,9 +27,9 @@ class OrdersDetailContainer extends React.Component { render() { const { orderDetailQuery } = this.props; - if (orderDetailQuery.loading) { - return ; - } + // if (orderDetailQuery.loading) { + // return ; + // } const order = orderDetailQuery.posOrderDetail; diff --git a/packages/plugin-syncerkhet-ui/src/containers/Settings.tsx b/packages/plugin-syncerkhet-ui/src/containers/Settings.tsx index 9056f369987..d0ba931a137 100644 --- a/packages/plugin-syncerkhet-ui/src/containers/Settings.tsx +++ b/packages/plugin-syncerkhet-ui/src/containers/Settings.tsx @@ -20,9 +20,9 @@ class SettingsContainer extends React.Component { render() { const { updateConfigs, configsQuery } = this.props; - if (configsQuery.loading) { - return ; - } + // if (configsQuery.loading) { + // return ; + // } // create or update action const save = (map: IConfigsMap) => { diff --git a/packages/plugin-syncerkhet-ui/src/containers/SyncHistoryList.tsx b/packages/plugin-syncerkhet-ui/src/containers/SyncHistoryList.tsx index 5d2d0201f39..757eb6f1d5d 100644 --- a/packages/plugin-syncerkhet-ui/src/containers/SyncHistoryList.tsx +++ b/packages/plugin-syncerkhet-ui/src/containers/SyncHistoryList.tsx @@ -38,9 +38,9 @@ class SyncHistoryListContainer extends React.Component { syncHistoriesCountQuery } = this.props; - if (syncHistoriesQuery.loading || syncHistoriesCountQuery.loading) { - return ; - } + // if (syncHistoriesQuery.loading || syncHistoriesCountQuery.loading) { + // return ; + // } const syncHistories = syncHistoriesQuery.syncHistories || []; const totalCount = syncHistoriesCountQuery.syncHistoriesCount || 0;