2015-01-24 18:49:47 +01:00
|
|
|
var React = require('react'),
|
2015-01-28 07:16:48 +01:00
|
|
|
Carousel = require('../shared/carousel'),
|
2015-02-03 06:27:54 +01:00
|
|
|
Traits = require('../items/traits'),
|
2015-01-28 07:16:48 +01:00
|
|
|
ItemDetailsActions = require('../../actions/itemDetailsActions'),
|
|
|
|
|
NavigationStore = require('../../stores/navigationStore'),
|
2015-02-04 06:38:22 +01:00
|
|
|
ItemDetailsStore = require('../../stores/itemDetailsStore'),
|
|
|
|
|
AddToCart = require('../cart/addToCart');
|
2015-01-25 10:26:10 +01:00
|
|
|
|
2015-01-25 12:52:31 +01:00
|
|
|
var Router = require('react-router');
|
2015-06-13 03:28:16 +02:00
|
|
|
var Globals = require('../../globals');
|
2015-01-24 18:49:47 +01:00
|
|
|
|
|
|
|
|
|
2015-01-27 05:47:10 +01:00
|
|
|
var ItemWithDetailsPage = React.createClass({
|
2015-01-25 10:26:10 +01:00
|
|
|
|
2015-01-24 18:49:47 +01:00
|
|
|
render: function() {
|
|
|
|
|
|
2015-01-25 16:42:16 +01:00
|
|
|
return (
|
2015-02-04 06:38:22 +01:00
|
|
|
|
2015-01-29 07:07:08 +01:00
|
|
|
<div className="item-with-details row-fluid center">
|
2015-06-21 10:40:58 +02:00
|
|
|
<div className="col-md-5 col-md-offset-2 item_image col-sm-offset-2 col-sm-3">
|
2015-05-13 16:32:53 +02:00
|
|
|
<img src={this.state.firstImage} width="100%" />
|
2015-02-03 06:27:54 +01:00
|
|
|
</div>
|
|
|
|
|
|
2015-06-21 10:40:58 +02:00
|
|
|
<div className="col-md-5 col-sm-7 center">
|
2015-05-13 16:32:53 +02:00
|
|
|
<div className='item_brand_name'> {this.state.item.get('brand').name}</div>
|
|
|
|
|
<div className='item_name'> {this.state.item.get('name')}</div>
|
2015-02-03 06:27:54 +01:00
|
|
|
<div>
|
2015-06-13 03:28:16 +02:00
|
|
|
<div className='item_price'> {Globals.FormatCurrency(this.state.item.get('list_price'))}</div>
|
2015-05-14 06:21:49 +02:00
|
|
|
|
2015-05-13 16:32:53 +02:00
|
|
|
<div>Količina</div>
|
|
|
|
|
|
2015-05-14 06:21:49 +02:00
|
|
|
<div> <AddToCart item={this.state.item} /></div>
|
2015-06-21 10:40:58 +02:00
|
|
|
</div>
|
2015-05-15 18:38:45 +02:00
|
|
|
|
2015-06-21 10:40:58 +02:00
|
|
|
</div>
|
|
|
|
|
<div className="item-with-details row-fluid center">
|
|
|
|
|
<div className="col-lg-offset-2 col-lg-10 hidden-md hidden-sm hidden-xs">
|
2015-05-15 18:38:45 +02:00
|
|
|
<div className="item_description_tab">Opis proizvoda</div>
|
|
|
|
|
<div className="item_description_tab_area"> </div>
|
2015-05-16 04:10:21 +02:00
|
|
|
<div className="item_description_text">{this.state.item.get('description')}</div>
|
2015-02-03 06:27:54 +01:00
|
|
|
</div>
|
2015-06-21 10:40:58 +02:00
|
|
|
<div className="col-xs-offset-2 col-xs-10 hidden-lg">
|
|
|
|
|
<h2>Opis proizvoda: </h2>
|
|
|
|
|
<div> </div>
|
|
|
|
|
<p className="lead">{this.state.item.get('description')}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="col-xs-offset-2 col-xs-10">
|
|
|
|
|
<Traits traits={this.state.item.get('traits')} />
|
|
|
|
|
</div>
|
2015-02-03 06:27:54 +01:00
|
|
|
</div>
|
2015-01-29 07:07:08 +01:00
|
|
|
</div>
|
2015-01-28 07:16:48 +01:00
|
|
|
);
|
2015-01-24 18:49:47 +01:00
|
|
|
|
2015-01-25 10:26:10 +01:00
|
|
|
},
|
|
|
|
|
|
2015-01-25 16:42:16 +01:00
|
|
|
// Add change listeners to stores
|
2015-01-25 10:26:10 +01:00
|
|
|
componentDidMount: function() {
|
2015-01-28 07:16:48 +01:00
|
|
|
ItemDetailsStore.addChangeListener(this._onChange);
|
2015-01-28 05:04:45 +01:00
|
|
|
NavigationStore.addChangeListener(this._onChange);
|
2015-01-28 07:16:48 +01:00
|
|
|
ItemDetailsActions.loadItemWithDetails();
|
2015-01-25 10:26:10 +01:00
|
|
|
},
|
|
|
|
|
|
2015-02-03 06:27:54 +01:00
|
|
|
componentWillUnmount: function () {
|
|
|
|
|
ItemDetailsStore.removeChangeListener(this._onChange);
|
|
|
|
|
NavigationStore.removeChangeListener(this._onChange);
|
|
|
|
|
},
|
|
|
|
|
|
2015-01-28 07:16:48 +01:00
|
|
|
|
|
|
|
|
onClickLeft: function() {
|
|
|
|
|
ItemDetailsActions.previousCarouselImage();
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onClickRight: function() {
|
|
|
|
|
ItemDetailsActions.nextCarouselImage();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onSelectImage: function(i) {
|
|
|
|
|
ItemDetailsActions.selectCarouselImage(i);
|
|
|
|
|
},
|
|
|
|
|
|
2015-01-25 10:26:10 +01:00
|
|
|
_onChange: function () {
|
2015-01-28 05:09:53 +01:00
|
|
|
|
2015-01-28 05:04:45 +01:00
|
|
|
if (this.isMounted()) {
|
2015-01-28 07:16:48 +01:00
|
|
|
this.setState(ItemDetailsStore.getState());
|
2015-01-28 05:04:45 +01:00
|
|
|
}
|
2015-01-28 05:09:53 +01:00
|
|
|
|
2015-01-25 10:26:10 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getInitialState: function () {
|
2015-01-28 07:16:48 +01:00
|
|
|
return ItemDetailsStore.getState();
|
2015-01-24 18:49:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = ItemWithDetailsPage;
|