-
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.
Merge pull request #837 from uktrade/develop
FE release 2.3
- Loading branch information
Showing
142 changed files
with
3,363 additions
and
1,745 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 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 |
---|---|---|
|
@@ -35,3 +35,8 @@ table { | |
text-align: right; | ||
} | ||
} | ||
|
||
|
||
.table__cell--plain { | ||
border-bottom: 0; | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const { search } = require('../../search/services') | ||
const { transformApiResponseToCollection } = require('../../transformers') | ||
const { transformOrderToListItem } = require('../../omis/transformers') | ||
|
||
async function renderOrders (req, res, next) { | ||
const token = req.session.token | ||
const page = req.query.page || 1 | ||
const { id, name } = res.locals.company | ||
|
||
try { | ||
const results = await search({ | ||
token, | ||
page, | ||
searchEntity: 'order', | ||
requestBody: { | ||
company: id, | ||
}, | ||
isAggregation: false, | ||
}) | ||
.then(transformApiResponseToCollection( | ||
{ query: req.query }, | ||
transformOrderToListItem, | ||
)) | ||
|
||
res | ||
.breadcrumb(name, `/companies/${id}`) | ||
.breadcrumb('Orders (OMIS)') | ||
.render('companies/views/orders', { | ||
results, | ||
}) | ||
} catch (error) { | ||
next(error) | ||
} | ||
} | ||
|
||
module.exports = { | ||
renderOrders, | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,46 @@ | ||
const ukOtherCompanyOptions = [ | ||
const { filter, map } = require('lodash') | ||
const { sentence } = require('case') | ||
|
||
const metadataRepository = require('../../lib/metadata') | ||
const ukOtherBusinessTypeNames = [ | ||
'Charity', | ||
'Government department', | ||
'Government Dept', | ||
'Intermediary', | ||
'Limited partnership', | ||
'Partnership', | ||
'Sole trader', | ||
].map(item => { | ||
return { | ||
value: item, | ||
label: item, | ||
} | ||
}) | ||
'Sole Trader', | ||
] | ||
const foreignOtherBusinessTypeNames = [ | ||
'Company', | ||
...ukOtherBusinessTypeNames, | ||
] | ||
|
||
/** | ||
* extract businessOptions from metadata by name and build an options list with | ||
* @param requestedProperties | ||
* @param metaDataOptions | ||
* @returns {{label: String, id: String}[]} | ||
*/ | ||
const buildBusinessTypeOptions = (requestedProperties, metaDataOptions) => { | ||
return map(filter(metaDataOptions, (option) => { | ||
return requestedProperties.indexOf(option.name) >= 0 | ||
}), (option) => { | ||
return { | ||
value: option.id, | ||
label: sentence(option.name.replace('Dept', 'department'), []), | ||
} | ||
}) | ||
} | ||
|
||
const foreignOtherCompanyOptions = [{ value: 'Company', label: 'Company' }, ...ukOtherCompanyOptions] | ||
const buildUkOtherCompanyOptions = () => { | ||
return buildBusinessTypeOptions(ukOtherBusinessTypeNames, metadataRepository.businessTypeOptions) | ||
} | ||
|
||
const buildForeignOtherCompanyOptions = () => { | ||
return buildBusinessTypeOptions(foreignOtherBusinessTypeNames, metadataRepository.businessTypeOptions) | ||
} | ||
|
||
module.exports = { | ||
ukOtherCompanyOptions, | ||
foreignOtherCompanyOptions, | ||
buildUkOtherCompanyOptions, | ||
buildForeignOtherCompanyOptions, | ||
} |
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.