示例#1
0
	renderStatus = () => {
		const { order } = this.props;

		return isOrderWaitingPayment( order.status )
			? <OrderStatusSelect value={ this.state.status } onChange={ this.updateStatus } />
			: <OrderStatus status={ order.status } showShipping={ false } />;
	}
示例#2
0
	renderViewButtons = () => {
		const { isInvoiceSending, order, translate } = this.props;

		const buttons = [
			<Button key="edit" primary onClick={ this.toggleEditing }>
				{ translate( 'Edit Order' ) }
			</Button>,
		];

		if ( isOrderWaitingPayment( order.status ) ) {
			buttons.unshift(
				<Button
					key="resend-invoice"
					onClick={ this.triggerInvoice }
					busy={ isInvoiceSending }
					disabled={ isInvoiceSending }
				>
					{ translate( 'Resend Invoice' ) }
				</Button>
			);
		}

		// Unshifting so that the Delete is the first action in the row
		buttons.unshift(
			<Button key="delete" borderless scary onClick={ this.deleteOrder }>
				<Gridicon icon="trash" />
				{ translate( 'Delete' ) }
			</Button>
		);

		return buttons;
	};
示例#3
0
	getPaymentAction = () => {
		const { order, translate } = this.props;
		const codProcessing = 'cod' === order.payment_method && 'processing' === order.status;
		if ( 'refunded' === order.status || codProcessing ) {
			return null;
		} else if ( isOrderWaitingPayment( order.status ) ) {
			return <Button onClick={ this.markAsPaid }>{ translate( 'Mark as Paid' ) }</Button>;
		}
		return <Button onClick={ this.toggleDialog }>{ translate( 'Submit Refund' ) }</Button>;
	};
示例#4
0
	saveOrder = () => {
		const { siteId, order, translate } = this.props;
		const successOpts = { duration: 8000 };
		if ( isOrderWaitingPayment( order.status ) ) {
			successOpts.button = translate( 'Send new invoice to customer' );
			successOpts.onClick = this.triggerInvoice;
		}
		const onSuccess = dispatch => {
			dispatch( successNotice( translate( 'Order successfully updated.' ), successOpts ) );
		};
		const onFailure = dispatch => {
			dispatch( errorNotice( translate( 'Unable to save order.' ), { duration: 8000 } ) );
		};

		recordTrack( 'calypso_woocommerce_order_edit_save' );
		this.props.saveOrder( siteId, order, onSuccess, onFailure );
	};
示例#5
0
		const onSuccess = ( dispatch, orderId ) => {
			const successOpts = {
				duration: 8000,
				displayOnNextPage: true,
			};
			dispatch(
				successNotice(
					translate( 'Order successfully created. {{ordersLink}}View all orders{{/ordersLink}}.', {
						components: {
							ordersLink: <a href={ getLink( '/store/orders/:site/', site ) } />,
						},
					} ),
					successOpts
				)
			);
			// Send invoice if the order is awaiting payment and there is an email
			if ( isOrderWaitingPayment( order.status ) && get( order, 'billing.email', false ) ) {
				this.triggerInvoice( siteId, orderId );
			}
			page.redirect( getLink( `/store/order/:site/${ orderId }`, site ) );
		};