@@ -185,34 +185,35 @@ export const configureFiles = (data) => {
185
185
return allFiles
186
186
}
187
187
188
- export const configureDocuments = ( documents , requestIdentifier ) => {
189
- return documents ?. map ( document => ( {
190
- identifier : document . identifier ,
188
+ export const configureDocument = ( document , requestIdentifier ) => {
189
+ return {
191
190
date : normalizeDate ( document . created_at ) ,
192
191
documentStatus : document . status ,
193
192
documentStatusColor : statusColors [ configureStatus ( document . status ) ] . bg ,
194
193
documentType : document . type ,
195
194
documentTypeColor : 'bg-dark' ,
195
+ identifier : document . identifier ,
196
196
lineItems : configureLineItems ( document . line_items ) ,
197
197
requestIdentifier,
198
- subtotalPrice : document . retail_subtotal_price_currency ,
199
- taxAmount : document . tax_cost_currency ,
200
- terms : document . payment_terms ,
201
- totalPrice : document . retail_total_price_currency ,
202
198
shippingPrice : document . shipping_cost_currency ,
203
199
shipTo : {
204
- organizationName : document . ship_to ? .organization_name ,
205
- text : document . ship_to ? .text ,
200
+ organizationName : document . ship_to . organization_name ,
201
+ text : document . ship_to . text ,
206
202
} ,
207
203
shipFrom : {
208
- organizationName : document . ship_from ? .organization_name ,
209
- text : document . ship_from ? .text ,
204
+ organizationName : document . ship_from . organization_name ,
205
+ text : document . ship_from . text ,
210
206
} ,
211
- // the following properties only need to exist on POs
212
- turnaroundTime : document . turn_around_time . human || null ,
213
- poNumber : document . po_number || null ,
214
- relatedSOWIdentifier : document . proposal_ref ?. identifier || null ,
215
- adPO : document . scientist_identifier || null ,
207
+ subtotalPrice : document . retail_subtotal_price_currency ,
208
+ taxAmount : document . tax_cost_currency ,
209
+ terms : document . payment_terms ,
210
+ totalPrice : document . retail_total_price_currency ,
211
+ }
212
+ }
213
+
214
+ export const configureSOWs = ( sows , requestIdentifier ) => {
215
+ return sows ?. map ( ( sow ) => ( {
216
+ ...configureDocument ( sow , requestIdentifier ) ,
216
217
} ) )
217
218
}
218
219
0 commit comments