Skip to content

Commit

Permalink
UIORGS-442 Change export type on integration type change
Browse files Browse the repository at this point in the history
  • Loading branch information
usavkov-epam committed Dec 20, 2024
1 parent 4d82de6 commit 6252fbb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import { useHistory, useLocation } from 'react-router-dom';
import {
useHistory,
useLocation,
} from 'react-router-dom';

import {
LoadingPane,
Expand All @@ -14,30 +16,30 @@ import {
useAcqMethods,
useIntegrationConfigMutation,
} from '../../common/hooks';

import {
CONNECTION_MODES,
EDI_CODE_TYPES,
EXPORT_TYPES,
FILE_FORMAT,
FTP_TYPES,
INTEGRATION_TYPE,
TRANSMISSION_METHOD,
TRANSMISSION_MODES,
CONNECTION_MODES,
INTEGRATION_TYPE,
} from '../constants';
import { OrganizationIntegrationForm } from '../OrganizationIntegrationForm';
import {
buildAvailableAccounts,
findDefaultIntegration,
getDefaultEdiNamingConvention,
} from '../utils';
import { OrganizationIntegrationForm } from '../OrganizationIntegrationForm';

// should be removed after lotus release
const buildInitialValues = (organization, withMigration) => {
const edi = withMigration ? organization.edi || {} : {};

return {
schedulePeriod: 'NONE',
type: 'EDIFACT_ORDERS_EXPORT',
type: EXPORT_TYPES.claims,
exportTypeSpecificParameters: {
vendorEdiOrdersExportConfig: {
vendorId: organization.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
import { validateRequired } from '@folio/stripes-acq-components';

import {
EXPORT_TYPES,
FILE_FORMAT,
INTEGRATION_TYPE,
TRANSMISSION_METHOD,
Expand Down Expand Up @@ -67,11 +68,13 @@ export const IntegrationInfoForm = ({

switch (value) {
case INTEGRATION_TYPE.ordering: {
change('type', EXPORT_TYPES.edifactOrders);
change('exportTypeSpecificParameters.vendorEdiOrdersExportConfig.transmissionMethod', TRANSMISSION_METHOD.ftp);
change('exportTypeSpecificParameters.vendorEdiOrdersExportConfig.fileFormat', FILE_FORMAT.edi);
break;
}
case INTEGRATION_TYPE.claiming: {
change('type', EXPORT_TYPES.claims);
change('exportTypeSpecificParameters.vendorEdiOrdersExportConfig.ediSchedule', null);
break;
}
Expand Down
5 changes: 5 additions & 0 deletions src/OrganizationIntegration/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export const EDI_NAMING_TOKENS = {
numberSequence: 'numberSequence',
};

export const EXPORT_TYPES = {
edifactOrders: 'EDIFACT_ORDERS_EXPORT',
claims: 'CLAIMS',
};

export const INTEGRATION_TYPE = {
claiming: 'Claiming',
ordering: 'Ordering',
Expand Down

0 comments on commit 6252fbb

Please sign in to comment.