Merge branch 'master' into package-details
This commit is contained in:
@@ -45,11 +45,14 @@ class HtmlClient {
|
||||
uploadFile(file, configParams = null) {
|
||||
let formData = new FormData();
|
||||
formData.append('file', file, file.name);
|
||||
/*
|
||||
if(configParams) {
|
||||
|
||||
Object.keys(configParams.data).forEach((paramKey) => {
|
||||
formData.append(paramKey, configParams.data[paramKey]);
|
||||
});
|
||||
}
|
||||
|
||||
}*/
|
||||
configParams.data = formData;
|
||||
const params = Object.assign({}, uploadParams(), configParams);
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import moment from 'moment';
|
||||
import {fromWiaasProcessStep} from './ProcessHelper';
|
||||
|
||||
function formatDate(date) {
|
||||
return date ? moment(date).format("Do MMM, YYYY") : undefined;
|
||||
@@ -9,6 +10,10 @@ function formatAddress(addressObject) {
|
||||
}
|
||||
|
||||
export const fromWCOrder = (WCOrder) => {
|
||||
let processInfo = Object.assign({},WCOrder['delivery-process']);
|
||||
if (WCOrder['delivery-process']){
|
||||
processInfo.steps = WCOrder['delivery-process'].steps.map(step=>fromWiaasProcessStep(step));
|
||||
}
|
||||
return {
|
||||
id: WCOrder.id,
|
||||
number: WCOrder.number,
|
||||
@@ -22,6 +27,12 @@ export const fromWCOrder = (WCOrder) => {
|
||||
recurringPrice: 0,
|
||||
status: WCOrder.status,
|
||||
currency: WCOrder.currency,
|
||||
billing:{
|
||||
firstName: WCOrder.billing.first_name,
|
||||
lastName: WCOrder.billing.last_name,
|
||||
email: WCOrder.billing.email,
|
||||
address: formatAddress(WCOrder.billing)
|
||||
},
|
||||
packages: WCOrder['line_items'].map(packageLine => {
|
||||
return {
|
||||
id: packageLine['product_id'],
|
||||
@@ -48,6 +59,14 @@ export const fromWCOrder = (WCOrder) => {
|
||||
})),
|
||||
};
|
||||
}),
|
||||
process: processInfo,
|
||||
comments: WCOrder.comments ? WCOrder.comments.map(comment => ({
|
||||
id: comment.id,
|
||||
comment: comment.content,
|
||||
username: comment.username,
|
||||
dateCreated: formatDate(comment.date),
|
||||
isOwner: comment['is_owner']
|
||||
})) : [],
|
||||
deliveryAddress: formatAddress(WCOrder.shipping),
|
||||
customer: WCOrder.customer,
|
||||
commercialLead: WCOrder['commercial_lead'],
|
||||
|
||||
19
frontend/src/helpers/ProcessHelper.js
Normal file
19
frontend/src/helpers/ProcessHelper.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import moment from "moment";
|
||||
|
||||
export const fromWiaasProcessStep = (step) => {
|
||||
return {
|
||||
actionCode: step.action_code,
|
||||
actualDate: step.actual_date,
|
||||
comments: step.comments,
|
||||
fullDesc: step.full_desc,
|
||||
idOrder: step.order_id,
|
||||
idProcess: step.step_form_entry_id, //not sure about this
|
||||
idProcessStep: step.step_id, //not sure about this
|
||||
isNewCommentVisible: 1, //TODO : get this from backend
|
||||
isVisibleForCustomer: 1, //TODO : get this from backend
|
||||
now: moment().format("Do MMM YY"),
|
||||
shortDesc: step.short_desc,
|
||||
status: step.status,
|
||||
stepType: step.step_type,
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user