+
{this.state.item.get('brand').name}
+
{this.state.item.get('name')}
-
{this.state.item.get('brand').name}
-
{this.state.item.get('list_price')} KM
-
{this.state.item.get('pricePerUnit')}
+
{this.state.item.get('list_price')} KM
+
+
Količina
+
+
{this.state.item.get('description')}
diff --git a/front-ui/app/constants/cartConstants.js b/front-ui/app/constants/cartConstants.js
index 4a919fa..4a62ba0 100644
--- a/front-ui/app/constants/cartConstants.js
+++ b/front-ui/app/constants/cartConstants.js
@@ -4,11 +4,11 @@ var keyMirror = require('react/lib/keyMirror');
module.exports = keyMirror({
LOAD_CART_CONTENTS: null,
ADD_ITEM: null,
- // because REMOVE_ITEM could be used to completely remove item
- // and not just decrease count by 1
TAKE_ITEM_OUT: null ,
CART_DATA_LOADED: null,
SAVE_CART_STATE_FOR_ITEM: null,
CHANGE_DELIVERY_DESTINATION_PROPERTY: null,
- CONFIRM_DELIVERY: null
+ CONFIRM_DELIVERY: null,
+ SET_ITEM_COUNT: null,
+ REMOVE_ITEM: null
});
diff --git a/front-ui/app/css/items.css b/front-ui/app/css/items.css
index 4ddfaf5..1b88514 100644
--- a/front-ui/app/css/items.css
+++ b/front-ui/app/css/items.css
@@ -32,3 +32,22 @@
text-align: center;
padding-right: 5px;
}
+
+.item_name {
+ font-size: 16px;
+}
+
+.item_brand_name {
+ font-size: 24px;
+ text-transform: uppercase;
+
+}
+
+.item_price {
+
+ font-size: 36px;
+ padding-top: 36px;
+ padding-bottom: 36px;
+
+
+}
\ No newline at end of file
diff --git a/front-ui/app/css/main.css b/front-ui/app/css/main.css
index 238a4df..cd58290 100644
--- a/front-ui/app/css/main.css
+++ b/front-ui/app/css/main.css
@@ -464,3 +464,16 @@ text-decoration: none;
.error-message {
color: red;
}
+
+.white_button{
+ background-color: #f9f9f9;
+ width: 40px;
+ height: 40px;
+ padding-bottom: 7px;
+ display: block;
+ border-radius: 1px;
+ margin-top: 8px;
+ border: solid #cccccc 1px;
+ color: #4d4d4d !important;
+ font-size: 16px;
+}
diff --git a/front-ui/app/globals.js b/front-ui/app/globals.js
index 11deca3..a062ce7 100644
--- a/front-ui/app/globals.js
+++ b/front-ui/app/globals.js
@@ -5,5 +5,6 @@ module.exports = {
FormatCurrency: function(amount_s) {
var amount = parseFloat(amount_s);
return ( amount.toFixed(2) + " KM" )
- }
+ },
+ MaxNumberOfItemsToBeAdded: 1000
};
diff --git a/front-ui/app/stores/cartStore.js b/front-ui/app/stores/cartStore.js
index 7659d05..7a387d8 100644
--- a/front-ui/app/stores/cartStore.js
+++ b/front-ui/app/stores/cartStore.js
@@ -101,6 +101,19 @@ var takeItemOut = function(itemId) {
saveCartStateForItem(itemId);
};
+var setItemCount = function(itemId, count) {
+ var state = states[itemId] || new ItemInCart({
+ item_id: itemId,
+ count: 0
+ })
+ console.log("Old state", state.get('count'));
+
+ state.set('count', state.get('count') + count);
+ console.log("New state", state.get('count'));
+ states[itemId] = state;
+ saveCartStateForItem(itemId);
+}
+
var changeDeliveryDestinationProperty = function(property, value) {
_deliveryDestination.set(property, value);
@@ -274,6 +287,9 @@ AppDispatcher.register(function(payload) {
case CartConstants.CONFIRM_DELIVERY:
saveDeliveryDestination();
break;
+ case CartConstants.SET_ITEM_COUNT:
+ setItemCount(action.itemId, action.count);
+ break;
default:
return true;
}
diff --git a/front-ui/app/stores/itemDetailsStore.js b/front-ui/app/stores/itemDetailsStore.js
index 753e238..0c48b93 100644
--- a/front-ui/app/stores/itemDetailsStore.js
+++ b/front-ui/app/stores/itemDetailsStore.js
@@ -76,12 +76,13 @@ var ItemWithDetailsStore = _.extend({}, EventEmitter.prototype, {
getState: function() {
-
+ var firstImage = _images[0] || "https://res.cloudinary.com/lfvt7ps2n/image/upload/c_fit,h_172,w_226/v1421732950/http_www.asms.ru_bitrix_templates_main_images_nophoto_irnofq.png";
return {
item: _itemWithDetails,
images: _images,
currentImage: _currentImage,
- count: _count
+ count: _count,
+ firstImage: firstImage
}
},
diff --git a/front-ui/app/stores/itemStore.js b/front-ui/app/stores/itemStore.js
index 1a4af6f..80ee48c 100644
--- a/front-ui/app/stores/itemStore.js
+++ b/front-ui/app/stores/itemStore.js
@@ -53,33 +53,34 @@ var fetchItemWithDetails = function() {
}
var fetchItemsByCategory = function(categoryId, offset, limit, query) {
- //var items = _itemsByCategory;
- var items = new ItemCollection();
- items.clearFilter();
- items.setClassificationType(2);
- items.setClassificationId(categoryId);
- items.setLimit(limit);
- items.setOffset(offset);
+ //var items = _itemsByCategory;
+ var items = new ItemCollection();
+ items.clearFilter();
+ items.setClassificationType(2);
+ items.setClassificationId(categoryId);
+ items.setLimit(limit);
+ items.setOffset(offset);
- for(var key in query) {
- if (query.hasOwnProperty(key) && key != 'limit' && key !='offset') {
- items.addFilter(key, query[key]);
+ for (var key in query) {
+ if (query.hasOwnProperty(key) && key != 'limit' && key != 'offset') {
+ items.addFilter(key, query[key]);
+ }
}
- }
- items.fetch({
- success: function(collection, response, options) {
- var total = options.xhr.getResponseHeader('x-total-count');
- items.setTotalCount(total);
+ items.fetch({
+ success: function(collection, response, options) {
+ var total = options.xhr.getResponseHeader('x-total-count');
+ items.setTotalCount(total);
- ItemStore.emitChange();
- }});
+ ItemStore.emitChange();
+ }
+ });
- _itemsByCategory = items;
+ _itemsByCategory = items;
};
var fetchBestSellingItemsForSection = function(sectionId) {
- console.log('getting section', sectionId);
+ console.log('getting section', sectionId);
var items = _bestSellingForSection;
items.setClassificationType(1);
items.setClassificationId(sectionId);
@@ -87,15 +88,15 @@ var fetchBestSellingItemsForSection = function(sectionId) {
items.setOffset(0);
items.fetch({
- success: function() {
- ItemStore.emitChange();
- }
+ success: function() {
+ ItemStore.emitChange();
+ }
});
};
var fetchBestSellingItemsForGroup = function(groupId) {
- console.log('getting group', groupId);
+ console.log('getting group', groupId);
var items = _bestSellingForGroup;
items.setClassificationType(4);
items.setClassificationId(groupId);
@@ -103,9 +104,9 @@ var fetchBestSellingItemsForGroup = function(groupId) {
items.setOffset(0);
items.fetch({
- success: function() {
- ItemStore.emitChange();
- }
+ success: function() {
+ ItemStore.emitChange();
+ }
});
};
@@ -113,19 +114,19 @@ var fetchBestSellingItemsForGroup = function(groupId) {
// Extend ItemStore with EventEmitter to add eventing capabilities
var ItemStore = _.extend({}, EventEmitter.prototype, {
- getItemsForCategory: function() {
- return _itemsByCategory;
- },
+ getItemsForCategory: function() {
+ return _itemsByCategory;
+ },
getBestSellingForSection: function() {
- return _bestSellingForSection;
+ return _bestSellingForSection;
},
// item with details
getLoadedItemWithDetails: function() {
return _itemWithDetails;
},
- getItemsForGroup: function () {
+ getItemsForGroup: function() {
return _bestSellingForGroup;
},
@@ -190,4 +191,4 @@ AppDispatcher.register(function(payload) {
});
-module.exports = ItemStore;
+module.exports = ItemStore;
\ No newline at end of file
diff --git a/front-ui/package.json b/front-ui/package.json
index d214bdd..39762d5 100644
--- a/front-ui/package.json
+++ b/front-ui/package.json
@@ -9,21 +9,21 @@
"author": "",
"license": "BSD-2-Clause",
"devDependencies": {
+ "Backbone.Mutators": "~0.4.4",
"browserify": "~8.1.0",
"events": "^1.0.2",
"flux": "^2.0.1",
- "grunt": "~0.4.5",
+ "grunt": "^0.4.5",
"grunt-browserify": "~3.2.1",
"grunt-cli": "~0.1.13",
+ "grunt-config": "~0.2.2",
"grunt-contrib-concat": "~0.5.0",
"grunt-contrib-connect": "~0.9.0",
"grunt-contrib-uglify": "~0.7.0",
"grunt-contrib-watch": "~0.6.1",
+ "grunt-replace": "~0.8.0",
"reactify": "~0.17.1",
- "underscore": "^1.7.0",
- "Backbone.Mutators": "~0.4.4",
- "grunt-config": "~0.2.2",
- "grunt-replace": "~0.8.0"
+ "underscore": "^1.7.0"
},
"dependencies": {
"react": "~0.12.2",