Skip to content

Commit

Permalink
Move business details code to modules
Browse files Browse the repository at this point in the history
  • Loading branch information
cgsunkel committed Jan 8, 2024
1 parent 4ff3b42 commit 3f47703
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 88 deletions.
2 changes: 0 additions & 2 deletions src/apps/companies/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ const QUERY_FIELDS = Object.values(QUERY_FIELDS_MAP)
const NONE_TEXT = 'None'
const NOT_SET_TEXT = 'Not set'
const NOT_AVAILABLE_TEXT = 'Not available'
const COMPANY_DISSOLVED_OPTION = 'Company is dissolved'

module.exports = {
GLOBAL_NAV_ITEM,
Expand All @@ -92,5 +91,4 @@ module.exports = {
NONE_TEXT,
NOT_SET_TEXT,
NOT_AVAILABLE_TEXT,
COMPANY_DISSOLVED_OPTION,
}
21 changes: 0 additions & 21 deletions src/apps/companies/labels.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,6 @@ const exportPotentialLabels = {
},
}

const exportSegmentsLabels = {
hep: 'High export potential',
'non-hep': 'Not high export potential',
}
const exportSubSegmentsLabels = {
sustain_nurture_and_grow: 'Sustain: nurture & grow',
sustain_develop_export_capability: 'Sustain: develop export capability',
sustain_communicate_benefits: 'Sustain: communicate benefits',
sustain_increase_competitiveness: 'Sustain: increase competitiveness',
reassure_nurture_and_grow: 'Reassure: nurture & grow',
reassure_develop_export_capability: 'Reassure: develop export capability',
reassure_leave_be: 'Reassure: leave be',
reassure_change_the_game: 'Reassure: change the game',
promote_develop_export_capability: 'Promote: develop export capability',
promote_communicate_benefits: 'Promote: communicate benefits',
promote_change_the_game: 'Promote: change the game',
challenge: 'Challenge',
}

module.exports = {
companyDetailsLabels,
companyTypeOptions,
Expand All @@ -132,6 +113,4 @@ module.exports = {
aboutLabels,
businessHierarchyLabels,
exportPotentialLabels,
exportSegmentsLabels,
exportSubSegmentsLabels,
}
21 changes: 0 additions & 21 deletions src/client/modules/Companies/CollectionList/labels.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,25 +112,6 @@ const exportPotentialLabels = {
},
}

const exportSegmentsLabels = {
hep: 'High export potential',
'non-hep': 'Not high export potential',
}
const exportSubSegmentsLabels = {
sustain_nurture_and_grow: 'Sustain: nurture & grow',
sustain_develop_export_capability: 'Sustain: develop export capability',
sustain_communicate_benefits: 'Sustain: communicate benefits',
sustain_increase_competitiveness: 'Sustain: increase competitiveness',
reassure_nurture_and_grow: 'Reassure: nurture & grow',
reassure_develop_export_capability: 'Reassure: develop export capability',
reassure_leave_be: 'Reassure: leave be',
reassure_change_the_game: 'Reassure: change the game',
promote_develop_export_capability: 'Promote: develop export capability',
promote_communicate_benefits: 'Promote: communicate benefits',
promote_change_the_game: 'Promote: change the game',
challenge: 'Challenge',
}

export default {
companyDetailsLabels,
companyTypeOptions,
Expand All @@ -142,6 +123,4 @@ export default {
aboutLabels,
businessHierarchyLabels,
exportPotentialLabels,
exportSegmentsLabels,
exportSubSegmentsLabels,
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,27 @@ import SectionHierarchy from './SectionHierarchy'
import SectionRegion from './SectionRegion'
import SectionSector from './SectionSector'
import SectionOneList from './SectionOneList'
import ArchiveForm from '../../../../../client/components/ArchiveForm'
import { StatusMessage } from '../../../../../client/components/'
import { COMPANY_DISSOLVED_OPTION } from '../../../constants'
import ArchiveForm from '../../../components/ArchiveForm'
import { StatusMessage } from '../../../components'
import {
CompanyResource,
RelatedCompaniesCountResource,
} from '../../../../../client/components/Resource'
import CompanyLayoutNew from '../../../../../client/components/Layout/CompanyLayoutNew'
import urls from '../../../../../lib/urls'
} from '../../../components/Resource'
import CompanyLayoutNew from '../../../components/Layout/CompanyLayoutNew'
import Task from '../../../components/Task'
import urls from '../../../../lib/urls'
import { format } from '../../../utils/date'

import {
ID as CHECK_PENDING_REQUEST_ID,
ID,
TASK_ARCHIVE_COMPANY,
TASK_GET_GLOBAL_ULTIMATE,
state2props,
} from './state'
import {
COMPANIES__GLOBAL_ULTIMATE_LOADED,
DNB__CHECK_PENDING_REQUEST,
} from '../../../../../client/actions'
import Task from '../../../../../client/components/Task'

const { format } = require('../../../../../client/utils/date')
} from '../../../actions'

const StyledRoot = styled('div')`
& > table {
Expand All @@ -59,6 +57,8 @@ const canEditOneList = (permissions) =>
'company.change_one_list_tier_and_global_account_manager'
)

const COMPANY_DISSOLVED_OPTION = 'Company is dissolved'

const CompanyBusinessDetails = ({
globalUltimate,
isDnbPending,
Expand Down Expand Up @@ -94,7 +94,7 @@ const CompanyBusinessDetails = ({
)}
<Task.Status
name={DNB__CHECK_PENDING_REQUEST}
id={CHECK_PENDING_REQUEST_ID}
id={ID}
progressMessage="Checking for pending change requests"
startOnRender={{
payload: company.dunsNumber,
Expand Down Expand Up @@ -155,7 +155,7 @@ const CompanyBusinessDetails = ({
/>
<Task.Status
name={TASK_GET_GLOBAL_ULTIMATE}
id={CHECK_PENDING_REQUEST_ID}
id={ID}
progressMessage="laoding subsidiary details"
startOnRender={{
payload: company.globalUltimateDunsNumber,
Expand Down Expand Up @@ -203,7 +203,7 @@ const CompanyBusinessDetails = ({
)}
<ArchiveForm
type="company"
id={CHECK_PENDING_REQUEST_ID}
id={ID}
submissionTaskName={TASK_ARCHIVE_COMPANY}
isArchived={isArchived(company.archived)}
isDnbCompany={isDnbCompany(company.dunsNumber)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import Link from '@govuk-react/link'
import { isEmpty } from 'lodash'
import { SPACING_POINTS, LINE_HEIGHT } from '@govuk-react/constants'

import { currencyGBP } from '../../../../../client/utils/number-utils'
import { NewWindowLink, SummaryTable } from '../../../../../client/components/'
import { exportSegmentsLabels, exportSubSegmentsLabels } from '../../../labels'
import urls from '../../../../../lib/urls'
import { currencyGBP } from '../../../utils/number-utils'
import { NewWindowLink, SummaryTable } from '../../../components'
import { exportSegmentsLabels, exportSubSegmentsLabels } from './labels'
import urls from '../../../../lib/urls'

const TableDetails = styled('div')`
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import Link from '@govuk-react/link'
import Table from '@govuk-react/table'
import { SPACING_POINTS } from '@govuk-react/constants'

import { Badge, SummaryTable } from '../../../../../client/components/'
import urls from '../../../../../lib/urls'
import { Badge, SummaryTable } from '../../../components'
import urls from '../../../../lib/urls'

const StyledAddressList = styled('ul')`
margin-top: ${SPACING_POINTS[2]}px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import pluralize from 'pluralize'
import styled from 'styled-components'
import { SPACING_POINTS } from '@govuk-react/constants'

import { SummaryTable } from '../../../../../client/components/'
import { SummaryTable } from '../../../components'
import WideSummaryTableRow from './WideSummaryTableRow'
import { hqLabels } from '../../../labels'
import urls, { companies } from '../../../../../lib/urls'
import { hqLabels } from '../../../../apps/companies/labels'
import { companies } from '../../../../lib/urls'

const StyledRowActionLink = styled(Link)`
float: right;
Expand Down Expand Up @@ -46,7 +46,7 @@ const SubsectionDnBHierarchy = ({

{!isGlobalUltimate && globalUltimate && (
<SummaryTable.Row heading="Ultimate HQ">
<Link href={urls.companies.detail(globalUltimate.id)}>
<Link href={companies.detail(globalUltimate.id)}>
{globalUltimate.name}
</Link>
</SummaryTable.Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Link from '@govuk-react/link'
import styled from 'styled-components'
import { SPACING_POINTS } from '@govuk-react/constants'

import { SummaryTable } from '../../../../../client/components/'
import urls from '../../../../../lib/urls'
import { SummaryTable } from '../../../components'
import urls from '../../../../lib/urls'

const StyledSummaryFooterLink = styled(Link)`
margin-top: -${SPACING_POINTS[7]}px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react'
import PropTypes from 'prop-types'
import Link from '@govuk-react/link'

import { SummaryTable } from '../../../../../client/components/'
import urls from '../../../../../lib/urls'
import { SummaryTable } from '../../../components'
import urls from '../../../../lib/urls'

const SectionRegion = ({ company, isArchived }) =>
!!company.ukBased ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react'
import PropTypes from 'prop-types'
import Link from '@govuk-react/link'

import { SummaryTable } from '../../../../../client/components/'
import urls from '../../../../../lib/urls'
import { SummaryTable } from '../../../components'
import urls from '../../../../lib/urls'

const SectionSector = ({ company, isArchived }) => (
<SummaryTable
Expand Down
19 changes: 19 additions & 0 deletions src/client/modules/Companies/CompanyBusinessDetails/labels.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export const exportSegmentsLabels = {
hep: 'High export potential',
'non-hep': 'Not high export potential',
}

export const exportSubSegmentsLabels = {
sustain_nurture_and_grow: 'Sustain: nurture & grow',
sustain_develop_export_capability: 'Sustain: develop export capability',
sustain_communicate_benefits: 'Sustain: communicate benefits',
sustain_increase_competitiveness: 'Sustain: increase competitiveness',
reassure_nurture_and_grow: 'Reassure: nurture & grow',
reassure_develop_export_capability: 'Reassure: develop export capability',
reassure_leave_be: 'Reassure: leave be',
reassure_change_the_game: 'Reassure: change the game',
promote_develop_export_capability: 'Promote: develop export capability',
promote_communicate_benefits: 'Promote: communicate benefits',
promote_change_the_game: 'Promote: change the game',
challenge: 'Challenge',
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
COMPANIES__GLOBAL_ULTIMATE_LOADED,
DNB__CHECK_PENDING_REQUEST,
} from '../../../../../client/actions'
} from '../../../actions'

export default (
state = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import axios from 'axios'

import urls from '../../../../../lib/urls'
import { apiProxyAxios } from '../../../../../client/components/Task/utils'
import urls from '../../../../lib/urls'
import { apiProxyAxios } from '../../../components/Task/utils'

const {
isDateAfter,
subtractDays,
today,
} = require('../../../../../client/utils/date')
const { isDateAfter, subtractDays, today } = require('../../../utils/date')

export function checkIfPendingRequest(duns_number) {
if (duns_number) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Link } from 'govuk-react'
import { SummaryTable } from '../../../components'
import { isOrderActive } from '../transformers'
import urls from '../../../../lib/urls'
import WideSummaryTableRow from '../../../../apps/companies/apps/business-details/client/WideSummaryTableRow'
import WideSummaryTableRow from '../../Companies/CompanyBusinessDetails/WideSummaryTableRow'

const buildSubscriberRows = (subscribers) =>
subscribers.map(({ name, ditTeam }) => (
Expand Down
4 changes: 2 additions & 2 deletions src/client/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import investmentOpportunitiesListReducer from './modules/Investments/Opportunit
import { ID as INVESTMENT_OPPORTUNITIES_DETAILS_ID } from './modules/Investments/Opportunities/state'
import investmentOpportunitiesDetailsReducer from './modules/Investments/Opportunities/reducer'

import { ID as DNB_CHECK_ID } from '../apps/companies/apps/business-details/client/state'
import dnbCheckReducer from '../apps/companies/apps/business-details/client/reducer'
import { ID as DNB_CHECK_ID } from './modules/Companies/CompanyBusinessDetails/state.js'
import dnbCheckReducer from './modules/Companies/CompanyBusinessDetails/reducer.js'

import { ID as INVESTMENT_PROFILES_ID } from './modules/Investments/Profiles/state'
import investmentProfileReducer from './modules/Investments/Profiles/reducer'
Expand Down
2 changes: 1 addition & 1 deletion src/client/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ import CreateOrder from './modules/Omis/CreateOrder/CreateOrder'
import PaymentReceipt from './modules/Omis/PaymentReceipt'
import { TaskFormAdd, TaskFormEdit } from './modules/Tasks/TaskForm'
import CompanyOverview from './modules/Companies/CompanyOverview/CompanyOverview'
import CompanyBusinessDetails from '../apps/companies/apps/business-details/client/CompanyBusinessDetails'
import CompanyBusinessDetails from './modules/Companies/CompanyBusinessDetails/CompanyBusinessDetails'
import SetGlobalHQ from './modules/Companies/CompanyBusinessDetails/LinkGlobalHQ/SetGlobalHQ'
import RemoveGlobalHQ from './modules/Companies/CompanyBusinessDetails/LinkGlobalHQ/RemoveGlobalHQ'

Expand Down
4 changes: 2 additions & 2 deletions src/client/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import {
DNB__CHECK_PENDING_REQUEST,
TASK_ARCHIVE_COMPANY,
TASK_GET_GLOBAL_ULTIMATE,
} from '../apps/companies/apps/business-details/client/state'
import * as businessDetails from '../apps/companies/apps/business-details/client/tasks'
} from './modules/Companies/CompanyBusinessDetails/state.js'
import * as businessDetails from './modules/Companies/CompanyBusinessDetails/tasks.js'

import {
TASK_GET_COMPANIES_LIST,
Expand Down

0 comments on commit 3f47703

Please sign in to comment.