2018-07-09 15:46:31 +00:00
|
|
|
/** @format */
|
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2019-03-27 00:33:04 +00:00
|
|
|
import { __, sprintf } from '@wordpress/i18n';
|
|
|
|
import { Button } from '@wordpress/components';
|
|
|
|
import { Component, Fragment } from '@wordpress/element';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WooCommerce dependencies
|
|
|
|
*/
|
|
|
|
import { Link, ProductImage, Section } from '@woocommerce/components';
|
2018-07-09 15:46:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2019-03-27 16:20:40 +00:00
|
|
|
import { ActivityCard } from '../../activity-card';
|
|
|
|
import ActivityHeader from '../../activity-header';
|
2018-07-09 15:46:31 +00:00
|
|
|
|
|
|
|
class StockPanel extends Component {
|
|
|
|
render() {
|
2019-03-27 00:33:04 +00:00
|
|
|
const product = {
|
|
|
|
id: 913,
|
|
|
|
name: 'Octopus Tshirt',
|
|
|
|
permalink: '',
|
|
|
|
image: {
|
|
|
|
src: '/wp-content/uploads/2018/12/img-206939428-150x150.png',
|
|
|
|
},
|
|
|
|
stock_quantity: 2,
|
|
|
|
};
|
|
|
|
const title = (
|
|
|
|
<Link href={ 'post.php?action=edit&post=' + product.id } type="wp-admin">
|
|
|
|
{ product.name }
|
|
|
|
</Link>
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Fragment>
|
|
|
|
<ActivityHeader title={ __( 'Stock', 'woocommerce-admin' ) } />
|
|
|
|
<Section>
|
|
|
|
<ActivityCard
|
|
|
|
className="woocommerce-stock-activity-card"
|
|
|
|
title={ title }
|
|
|
|
icon={ <ProductImage product={ product } /> }
|
|
|
|
actions={ <Button isDefault>{ __( 'Update stock', 'woocommerce-admin' ) }</Button> }
|
|
|
|
>
|
|
|
|
<span className="woocommerce-stock-activity-card__stock-quantity">
|
|
|
|
{ sprintf( __( '%d in stock', 'woocommerce-admin' ), product.stock_quantity ) }
|
|
|
|
</span>
|
|
|
|
</ActivityCard>
|
|
|
|
</Section>
|
|
|
|
</Fragment>
|
|
|
|
);
|
2018-07-09 15:46:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default StockPanel;
|