-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add export wins rejected tab (#6550)
- Loading branch information
Showing
16 changed files
with
200 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react' | ||
import { Redirect } from 'react-router-dom' | ||
|
||
import urls from '../../../../lib/urls' | ||
|
||
// Redirect from /exportwins to /exportwins/rejected | ||
const ExportsWinsRedirect = () => ( | ||
<Redirect to={urls.companies.exportWins.rejected()} /> | ||
) | ||
|
||
export default ExportsWinsRedirect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React from 'react' | ||
import { Link as ReactRouterLink } from 'react-router-dom' | ||
import { Button } from 'govuk-react' | ||
import styled from 'styled-components' | ||
|
||
import ExportWinsResource from '../../../components/Resource/ExportWins' | ||
import { currencyGBP } from '../../../utils/number-utils' | ||
import { formatMediumDate } from '../../../utils/date' | ||
import { CollectionItem } from '../../../components' | ||
import { WIN_FILTERS } from './constants' | ||
import urls from '../../../../lib/urls' | ||
|
||
const ButtonContainer = styled('div')({ | ||
marginTop: 10, | ||
}) | ||
|
||
export default () => ( | ||
<ExportWinsResource.Paginated | ||
id="export-wins-rejected" | ||
payload={{ confirmed: WIN_FILTERS.REJECTED }} | ||
> | ||
{(page) => ( | ||
<ul> | ||
{page.map((item) => ( | ||
<li key={item.id}> | ||
<CollectionItem | ||
headingText={item.company.name} | ||
headingUrl={urls.companies.overview.index(item.company.id)} | ||
metadata={[ | ||
{ label: 'Destination:', value: item.country.name }, | ||
{ | ||
label: 'Contact name:', | ||
// TODO: This needs to be a link, the MetadataItem | ||
// needs to take a JSX element as a paramter. | ||
value: item.company_contacts[0].name, | ||
}, | ||
{ | ||
label: 'Total value:', | ||
value: currencyGBP(item.total_expected_export_value), | ||
}, | ||
{ label: 'Date won:', value: formatMediumDate(item.date) }, | ||
{ | ||
label: 'Date modified:', | ||
value: formatMediumDate(item.modified_on), | ||
}, | ||
]} | ||
buttonRenderer={() => ( | ||
<ButtonContainer> | ||
<Button | ||
as={ReactRouterLink} | ||
to={urls.companies.exportWins.details(item.id)} | ||
> | ||
Review export win | ||
</Button> | ||
</ButtonContainer> | ||
)} | ||
/> | ||
</li> | ||
))} | ||
</ul> | ||
)} | ||
</ExportWinsResource.Paginated> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React from 'react' | ||
import { Link as ReactRouterLink } from 'react-router-dom' | ||
import { Button } from 'govuk-react' | ||
import styled from 'styled-components' | ||
|
||
import ExportWinsResource from '../../../components/Resource/ExportWins' | ||
import { currencyGBP } from '../../../utils/number-utils' | ||
import { formatMediumDate } from '../../../utils/date' | ||
import { CollectionItem } from '../../../components' | ||
import { WIN_FILTERS } from './constants' | ||
import urls from '../../../../lib/urls' | ||
|
||
const ButtonContainer = styled('div')({ | ||
marginTop: 10, | ||
}) | ||
|
||
export default () => ( | ||
<ExportWinsResource.Paginated | ||
id="export-wins-sent" | ||
payload={{ confirmed: WIN_FILTERS.SENT }} | ||
> | ||
{(page) => ( | ||
<ul> | ||
{page.map((item) => ( | ||
<li key={item.id}> | ||
<CollectionItem | ||
headingText={item.company.name} | ||
headingUrl={urls.companies.overview.index(item.company.id)} | ||
metadata={[ | ||
{ label: 'Destination: ', value: item.country.name }, | ||
{ | ||
label: 'Contact name:', | ||
// TODO: This needs to be a link, the MetadataItem | ||
// needs to take a JSX element | ||
value: item.company_contacts[0].name, | ||
}, | ||
{ | ||
label: 'Total value: ', | ||
value: currencyGBP(item.total_expected_export_value), | ||
}, | ||
{ label: 'Date won: ', value: formatMediumDate(item.date) }, | ||
{ label: 'First sent: ', value: '???' }, | ||
{ label: 'Last sent: ', value: '???' }, | ||
]} | ||
buttonRenderer={() => ( | ||
<ButtonContainer> | ||
<Button as={ReactRouterLink} onClick={() => alert('TODO')}> | ||
Resend export win | ||
</Button> | ||
</ButtonContainer> | ||
)} | ||
/> | ||
</li> | ||
))} | ||
</ul> | ||
)} | ||
</ExportWinsResource.Paginated> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.