2015-01-25 14:04:10 +01:00
|
|
|
var React = require('react');
|
|
|
|
|
var ItemActions = require('../../actions/itemActions');
|
2015-01-27 05:47:10 +01:00
|
|
|
var NavigationActions = require('../../actions/navigationActions');
|
|
|
|
|
var NavigationStore = require('../../stores/navigationStore')
|
2015-01-25 14:04:10 +01:00
|
|
|
|
|
|
|
|
var Router = require('react-router');
|
|
|
|
|
|
|
|
|
|
var SingleItem = React.createClass({
|
|
|
|
|
render: function() {
|
2015-02-14 07:53:57 +01:00
|
|
|
var hidePrice = this.props.hidePrice || false;
|
2015-01-25 14:04:10 +01:00
|
|
|
var self = this;
|
|
|
|
|
var itemClick = this.itemClick;
|
|
|
|
|
var firstImage = this.props.item.get('multi_media_descriptions')[0];
|
2015-02-12 06:51:52 +01:00
|
|
|
firstImage = firstImage || { url: "https://res.cloudinary.com/lfvt7ps2n/image/upload/c_crop,g_center,w_300/v1421732950/http_www.asms.ru_bitrix_templates_main_images_nophoto_irnofq.png" } ;
|
2015-02-14 07:53:57 +01:00
|
|
|
if (hidePrice) {
|
|
|
|
|
return (
|
2015-01-25 14:04:10 +01:00
|
|
|
<div className="single_item" onClick={itemClick}>
|
2015-02-14 07:53:57 +01:00
|
|
|
<img src={firstImage.url} className="item_list_image" />
|
|
|
|
|
<h1> { this.props.item.get('name') }</h1>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return (
|
|
|
|
|
<div className="single_item" onClick={itemClick}>
|
|
|
|
|
<img src={firstImage.url} className="item_list_image" />
|
|
|
|
|
<h1> { this.props.item.get('name') }</h1>
|
2015-03-28 14:38:15 +01:00
|
|
|
<div>{ this.props.item.get('brand')? this.props.item.get('brand').name : '' } </div>
|
2015-02-14 07:53:57 +01:00
|
|
|
<div> { this.props.item.get('list_price') } KM </div>
|
2015-01-25 14:04:10 +01:00
|
|
|
</div>
|
|
|
|
|
);
|
2015-02-14 07:53:57 +01:00
|
|
|
}
|
2015-01-25 14:04:10 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
itemClick: function(e) {
|
2015-01-27 05:47:10 +01:00
|
|
|
NavigationActions.goToItemDetails(this.props.item);
|
2015-03-11 07:32:05 +01:00
|
|
|
console.log(this.props.item)
|
2015-01-25 14:04:10 +01:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = SingleItem;
|