-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] development to marketplace (#2730)
development to marketplace
- Loading branch information
Showing
49 changed files
with
293 additions
and
477 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
.fileStorage/ | ||
.vscode | ||
.idea | ||
.c9 | ||
*.csv | ||
*.dat | ||
*.gz | ||
|
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 |
---|---|---|
|
@@ -116,6 +116,7 @@ Template.memberSettings.helpers({ | |
}); | ||
} | ||
}); | ||
|
||
return permissionGroups; | ||
}, | ||
|
||
|
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
186 changes: 186 additions & 0 deletions
186
imports/plugins/core/orders/client/components/ordersList.js
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,186 @@ | ||
import React, { Component } from "react"; | ||
import PropTypes from "prop-types"; | ||
import classnames from "classnames/dedupe"; | ||
import Avatar from "react-avatar"; | ||
import moment from "moment"; | ||
import { formatPriceString } from "/client/api"; | ||
import { Badge, ClickToCopy, Icon, Translation } from "@reactioncommerce/reaction-ui"; | ||
import ProductImage from "./productImage"; | ||
|
||
class OrdersList extends Component { | ||
static propTypes = { | ||
displayMedia: PropTypes.func, | ||
handleClick: PropTypes.func, | ||
orders: PropTypes.array | ||
} | ||
|
||
/** | ||
* Fullfilment Badge | ||
* @param {Object} order object containing info for order and coreOrderWorkflow | ||
* @return {string} A string containing the type of Badge | ||
*/ | ||
fulfillmentBadgeStatus(order) { | ||
const orderStatus = order.workflow.status; | ||
|
||
if (orderStatus === "new") { | ||
return "info"; | ||
} else if (orderStatus === "coreOrderWorkflow/processing") { | ||
return "success"; | ||
} else if (orderStatus === "coreOrderWorkflow/canceled") { | ||
return "danger"; | ||
} else if (orderStatus === "coreOrderWorkflow/completed") { | ||
return "primary"; | ||
} | ||
|
||
return "default"; | ||
} | ||
|
||
/** | ||
* Shipping Badge | ||
* TODO: any logic here, we don't have shipping status changes at the moment | ||
* @return {string} A string containing the type of Badge | ||
*/ | ||
shippingBadgeStatus() { | ||
return "basic"; | ||
} | ||
|
||
renderOrderButton(order) { | ||
const startWorkflow = order.workflow.status === "new"; | ||
const classes = classnames({ | ||
"rui": true, | ||
"btn": true, | ||
"btn-success": startWorkflow | ||
}); | ||
|
||
return ( | ||
<button className={classes} onClick={() => this.props.handleClick(order, startWorkflow)}> | ||
<Icon icon="fa fa-chevron-right" /> | ||
</button> | ||
); | ||
} | ||
|
||
renderOrderInfo(order) { | ||
const { displayMedia } = this.props; | ||
|
||
return ( | ||
<div className="order-info"> | ||
<div className="order-totals"> | ||
<span className="order-data order-data-date"> | ||
<strong>Date: </strong> | ||
{moment(order.createdAt).fromNow()} | {moment(order.createdAt).format("MM/D/YYYY")} | ||
</span> | ||
|
||
<span className="order-data order-data-id"> | ||
<strong>Order ID: </strong> | ||
<ClickToCopy | ||
copyToClipboard={order._id} | ||
displayText={order._id} | ||
i18nKeyTooltip="admin.orderWorkflow.summary.copyOrderLink" | ||
tooltip="Copy Order Link" | ||
/> | ||
</span> | ||
|
||
<span className="order-data order-data-total"> | ||
<strong>Total: {formatPriceString(order.billing[0].invoice.total)}</strong> | ||
</span> | ||
</div> | ||
|
||
<div className="order-items"> | ||
{order.items.map((item, i) => { | ||
return ( | ||
<div className="order-item" key={i}> | ||
<div className="order-item-media"> | ||
<ProductImage | ||
item={item} | ||
displayMedia={displayMedia} | ||
size="small" | ||
badge={true} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
renderShipmentInfo(order) { | ||
const emailAddress = order.email || <Translation defaultValue={"Email not availabe"} i18nKey={"admin.orderWorkflow.ordersList.emailNotFound"} />; | ||
return ( | ||
<div className="shipment-info"> | ||
<div className="customer-info"> | ||
<Avatar | ||
email={order.email} | ||
round={true} | ||
name={order.shipping[0].address.fullName} | ||
size={30} | ||
className="rui-order-avatar" | ||
/> | ||
<strong>{order.shipping[0].address.fullName}</strong> | {emailAddress} | ||
</div> | ||
<div className="workflow-info"> | ||
<Badge | ||
badgeSize="large" | ||
i18nKeyLabel={`cartDrawer.${order.shipping[0].workflow.status}`} | ||
label={order.shipping[0].workflow.status} | ||
status={this.shippingBadgeStatus(order)} | ||
/> | ||
<Badge | ||
badgeSize="large" | ||
i18nKeyLabel={`cartDrawer.${order.workflow.status}`} | ||
label={order.workflow.status} | ||
status={this.fulfillmentBadgeStatus(order)} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
|
||
renderOrderCard(order) { | ||
const { handleClick } = this.props; | ||
|
||
return ( | ||
<div className="rui card order"> | ||
<div className="content" onClick={() => handleClick(order, false)}> | ||
{this.renderShipmentInfo(order)} | ||
{this.renderOrderInfo(order)} | ||
</div> | ||
<div className="controls" onClick={() => handleClick(order)}> | ||
{this.renderOrderButton(order)} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
|
||
render() { | ||
const { orders } = this.props; | ||
|
||
if (orders.length) { | ||
return ( | ||
<div className="container-fluid-sm"> | ||
{orders.map((order, i) => { | ||
return ( | ||
<div key={i}> | ||
{this.renderOrderCard(order)} | ||
</div> | ||
); | ||
})} | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className="container-fluid-sm"> | ||
<div className="empty-view-message"> | ||
<Icon icon="fa fa-sun-o" /> | ||
<Translation defaultValue={"No orders found"} i18nKey={"order.ordersNotFound"} /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default OrdersList; |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
export { default as SortableTable } from "./sortableTable"; | ||
export { default as SortableTableLegacy } from "./sortableTableLegacy"; |
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.