Merge branch 'master' into package-details

This commit is contained in:
Almira Krdzic
2018-09-06 23:30:03 +02:00
53 changed files with 2053 additions and 621 deletions

View File

@@ -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);

View File

@@ -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'],

View 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,
}
};