Skip to content

Commit

Permalink
fix(settings): commented loaders and fixed collapse content ui
Browse files Browse the repository at this point in the history
  • Loading branch information
orgilshdeee committed Oct 31, 2023
1 parent cb6d9c0 commit b2690ea
Show file tree
Hide file tree
Showing 16 changed files with 111 additions and 71 deletions.
27 changes: 22 additions & 5 deletions packages/plugin-syncerkhet-ui/src/components/GeneralSettings.tsx
Expand Up @@ -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';
Expand Down Expand Up @@ -89,7 +90,11 @@ class GeneralSettings extends React.Component<Props, State> {

const content = (
<ContentBox id={'GeneralSettingsMenu'}>
<CollapseContent title="General settings">
<CollapseContent
title="General settings"
beforeTitle={<Icon icon="settings" />}
transparent={true}
>
{this.renderItem('apiKey')}
{this.renderItem('apiSecret')}
{this.renderItem('apiToken')}
Expand All @@ -98,7 +103,11 @@ class GeneralSettings extends React.Component<Props, State> {
'Get remainder from erkhet api url'
)}
</CollapseContent>
<CollapseContent title="Product to erkhet">
<CollapseContent
title="Product to erkhet"
beforeTitle={<Icon icon="settings" />}
transparent={true}
>
{this.renderItem('costAccount', 'Cost Account fullCode on erkhet')}
{this.renderItem('saleAccount', 'Sale Account fullCode on erkhet')}
{this.renderItem(
Expand All @@ -110,7 +119,11 @@ class GeneralSettings extends React.Component<Props, State> {
'Set description when incoming erkhet inventory'
)}
</CollapseContent>
<CollapseContent title="Customer to erkhet">
<CollapseContent
title="Customer to erkhet"
beforeTitle={<Icon icon="settings" />}
transparent={true}
>
{this.renderItem('checkCompanyUrl')}
{this.renderItem(
'customerDefaultName',
Expand All @@ -127,7 +140,11 @@ class GeneralSettings extends React.Component<Props, State> {
{this.renderItem('debtAccounts', 'Split "," account fullcode')}
</CollapseContent>
{isEnabled('loans') && (
<CollapseContent title="Loan transaction to erkhet">
<CollapseContent
title="Loan transaction to erkhet"
beforeTitle={<Icon icon="settings" />}
transparent={true}
>
{this.renderItem('userEmail', 'user email')}
{this.renderItem(
'defaultCustomer',
Expand Down
Expand Up @@ -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';
Expand Down Expand Up @@ -306,6 +307,8 @@ class PerSettings extends React.Component<Props, State> {
return (
<CollapseContent
title={__(config.title)}
beforeTitle={<Icon icon="settings" />}
transparent={true}
open={this.props.currentConfigKey === 'newMoveConfig' ? true : false}
>
<FormGroup>
Expand Down
Expand Up @@ -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';
Expand Down Expand Up @@ -91,6 +92,8 @@ class PerSettings extends React.Component<Props, State> {
return (
<CollapseContent
title={__(config.title)}
beforeTitle={<Icon icon="settings" />}
transparent={true}
open={
this.props.currentConfigKey === 'newremainderConfig' ? true : false
}
Expand Down
5 changes: 4 additions & 1 deletion packages/plugin-syncerkhet-ui/src/components/PerSettings.tsx
Expand Up @@ -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';
Expand Down Expand Up @@ -147,6 +148,8 @@ class PerSettings extends React.Component<Props, State> {
return (
<CollapseContent
title={__(config.title)}
beforeTitle={<Icon icon="settings" />}
transparent={true}
open={this.props.currentConfigKey === 'newEbarimtConfig' ? true : false}
>
<FormGroup>
Expand Down
@@ -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';
Expand Down Expand Up @@ -49,19 +49,21 @@ class GeneralSettings extends React.Component<Props, State> {
};

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 (
<PerRemSettings
key={key}
configsMap={this.state.configsMap}
config={configs[key]}
currentConfigKey={key}
Expand Down
Expand Up @@ -3,7 +3,8 @@ import {
CollapseContent,
ControlLabel,
FormControl,
FormGroup
FormGroup,
Icon
} from '@erxes/ui/src/components';
import BoardSelectContainer from '@erxes/ui-cards/src/boards/containers/BoardSelect';
import { __ } from '@erxes/ui/src/utils';
Expand Down Expand Up @@ -118,6 +119,8 @@ class PerSettings extends React.Component<Props, State> {
return (
<CollapseContent
title={__(config.title)}
beforeTitle={<Icon icon="settings" />}
transparent={true}
open={this.props.currentConfigKey === 'newEbarimtConfig' ? true : false}
>
<FormGroup>
Expand Down
@@ -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';
Expand Down Expand Up @@ -52,19 +52,22 @@ class GeneralSettings extends React.Component<Props, State> {
};

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 (
<PerSettings
key={key}
configsMap={this.state.configsMap}
config={configs[key]}
currentConfigKey={key}
Expand Down
@@ -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';
Expand Down Expand Up @@ -49,13 +49,15 @@ class GeneralSettings extends React.Component<Props, State> {
};

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) {
Expand Down
15 changes: 9 additions & 6 deletions 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';
Expand Down Expand Up @@ -52,19 +52,22 @@ class GeneralSettings extends React.Component<Props, State> {
};

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 (
<PerSettings
key={key}
configsMap={this.state.configsMap}
config={configs[key]}
currentConfigKey={key}
Expand Down
Expand Up @@ -101,12 +101,12 @@ class CheckSyncedDealsContainer extends React.Component<FinalProps, State> {
});
};

if (
checkSyncItemsQuery.loading ||
checkSyncedDealsTotalCountQuery.loading
) {
return <Spinner />;
}
// if (
// checkSyncItemsQuery.loading ||
// checkSyncedDealsTotalCountQuery.loading
// ) {
// return <Spinner />;
// }

const deals = checkSyncItemsQuery.deals || [];
const totalCount = checkSyncedDealsTotalCountQuery.dealsTotalCount || 0;
Expand Down
Expand Up @@ -106,13 +106,14 @@ class CheckSyncedOrdersContainer extends React.Component<FinalProps, State> {
});
};

if (
checkSyncItemsQuery.loading ||
checkSyncedOrdersTotalCountQuery.loading ||
posListQuery.loading
) {
return <Spinner />;
}
// if (
// checkSyncItemsQuery.loading ||
// checkSyncedOrdersTotalCountQuery.loading ||
// posListQuery.loading
// ) {
// return <Spinner />;
// }

const orders = checkSyncItemsQuery.posOrders || [];
const totalCount =
checkSyncedOrdersTotalCountQuery.posOrdersTotalCount || 0;
Expand Down
Expand Up @@ -54,7 +54,7 @@ class InventoryCategoryContainer extends React.Component<FinalProps, State> {
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;
}
Expand All @@ -67,16 +67,16 @@ class InventoryCategoryContainer extends React.Component<FinalProps, State> {
this.props
.toSyncCategories({
variables: {
action: action,
categories: categories
action,
categories
}
})
.then(() => {
this.setState({ loading: false });
Alert.success('Success. Please check again.');
})
.finally(() => {
let data = this.state.items;
const data = this.state.items;

setSyncStatusTrue(data, categories, action.toLowerCase());

Expand All @@ -93,7 +93,7 @@ class InventoryCategoryContainer extends React.Component<FinalProps, State> {
this.props
.toCheckCategories({ variables: {} })
.then(response => {
let data = response.data.toCheckCategories;
const data = response.data.toCheckCategories;

setSyncStatus(data, 'create');
setSyncStatus(data, 'update');
Expand All @@ -108,13 +108,13 @@ class InventoryCategoryContainer extends React.Component<FinalProps, State> {
});
};

if (loading) {
return <Spinner />;
}
// if (loading) {
// return <Spinner />;
// }

const updatedProps = {
...this.props,
loading: loading,
loading,
toCheckCategories,
toSyncCategories,
items
Expand Down

0 comments on commit b2690ea

Please sign in to comment.