From e503b70640c4ebc612c34f3fc60c8e14ac58dc45 Mon Sep 17 00:00:00 2001 From: Rifqy Zacky Ariadhy Date: Wed, 2 Jan 2019 21:16:50 +0700 Subject: [PATCH] update: shop page --- src/common/pages/App/index.js | 222 +-------------- src/common/pages/App/style.scss | 4 +- src/common/pages/Items/All/index.js | 334 ++++++++++++++++++++++- src/common/pages/Items/ItemCard/index.js | 15 +- src/common/pages/Items/index.js | 114 ++++---- 5 files changed, 387 insertions(+), 302 deletions(-) diff --git a/src/common/pages/App/index.js b/src/common/pages/App/index.js index b7b35ff..96434d7 100644 --- a/src/common/pages/App/index.js +++ b/src/common/pages/App/index.js @@ -538,226 +538,10 @@ export default class App extends React.Component { {/**/} - this.setState({open})} - open={this.state.open}> - - - { - // (this.settingStore.isIconEmpty) ? - - //
- // - // - // - //
- // : - //
- // - // - // - //
- } -
- - - -
- {/**/} - -
-
- - {/*}*/} - {/*className={(this.state.selectedMenu === '/app/dashboard') ? "menuAkunItem active" : 'menuAkunItem'}>Dashboard*/} - - {/*{*/} - {/*userData.role == 'administrator' ?*/} - {/* }*/} - {/*className={(this.state.selectedMenu === '/app/data') ? "menuAkunItem active" : 'menuAkunItem'}>Data : ''*/} - {/*}*/} - - {/*{*/} - {/*userData.role == 'administrator' &&*/} - {/* }*/} - {/*className={(this.state.selectedMenu === '/app/layout') ? "menuAkunItem active" : 'menuAkunItem'}>Layout*/} - {/*}*/} - - {/*{*/} - {/*userData.role == 'administrator' &&*/} - {/* }*/} - {/*className={(this.state.selectedMenu === '/app/content') ? "menuAkunItem active" : 'menuAkunItem'}>Content*/} - {/*}*/} - - {/*{*/} - {/*userData.role === 'administrator' &&*/} - {/* }*/} - {/*className={(this.state.selectedMenu === '/app/tasks') ? "menuAkunItem active" : 'menuAkunItem'}>Tasks*/} - {/*}*/} - - {/*{*/} - {/*userData.role == 'store' ?*/} - {/* }*/} - {/*className={(this.state.selectedMenu === '/app/items') ? "menuAkunItem active" : 'menuAkunItem'}>Items*/} - {/*: ""*/} - {/*}*/} - - {/*{*/} - {/*userData.role == 'store' ?*/} - {/* }*/} - {/*className={(this.state.selectedMenu === '/app/billing') ? "menuAkunItem active" : 'menuAkunItem'}>Wallet : ""*/} - {/*}*/} - - - {/*{*/} - {/*userData.role == 'store' ?*/} - {/* }*/} - {/*className={(this.state.selectedMenu === '/app/orders') ? "menuAkunItem active" : 'menuAkunItem'}>Order*/} - {/*: ""*/} - {/*}*/} - {/* }*/} - {/*className={(this.state.selectedMenu === '/app/tasks') ? "menuAkunItem active" : 'menuAkunItem'}>Tasks*/} - - {/*{*/} - {/*userData.role == 'store' ?*/} - {/* }*/} - {/*className={(this.state.selectedMenu === '/app/stores') ? "menuAkunItem active" : 'menuAkunItem'}>Store : ''*/} - {/*}*/} - - {/* { - userData.role == 'store' ? - } - className={(this.state.selectedMenu === '/app/recipes') ? "menuAkunItem active" : 'menuAkunItem'}>Recipes : '' - } */} - - {/* { - userData.role == 'administrator' ? - } - className={(this.state.selectedMenu === '/app/surf_turf') ? "menuAkunItem active" : 'menuAkunItem'}>Surf & Turf : '' - } - - { - userData.role == 'administrator' ? - } - className={(this.state.selectedMenu === '/app/help') ? "menuAkunItem active" : 'menuAkunItem'}>Help : '' - } */} - - - {/* }*/} - {/*className={(this.state.selectedMenu === '/app/inbox') ? "menuAkunItem active" : 'menuAkunItem'}>Inbox*/} - {/*/!*{*!/*/} - {/*/!*userData.role == 'administrator' && *!/*/} - {/* }*/} - {/*className={(this.state.selectedMenu === '/app/setting') ? "menuAkunItem active" : 'menuAkunItem'}>Setting*/} - {/*}*/} - {/* - userData.role == 'administrator' ? - } - className={(this.state.selectedMenu === '/app/promotion') ? "menuAkunItem active" : 'menuAkunItem'}>Promotion : '' - */} - - {/* }*/} - {/*className={(this.state.selectedMenu === '/app/entities') ? "menuAkunItem active" : 'menuAkunItem'}>Entities*/} - - {/* }*/} - {/*className={(this.state.selectedMenu === '/app/agents') ? "menuAkunItem active" : 'menuAkunItem'}>Agents*/} - - {/* }*/} - {/*className={(this.state.selectedMenu === LINKS.EMPLOYEE) ? "menuAkunItem active" : 'menuAkunItem'}>Employees*/} - - {/* }*/} - {/*className={(this.state.selectedMenu === '/app/customers') ? "menuAkunItem active" : 'menuAkunItem'}>Customers*/} - -
-
diff --git a/src/common/pages/App/style.scss b/src/common/pages/App/style.scss index 3548977..994101e 100644 --- a/src/common/pages/App/style.scss +++ b/src/common/pages/App/style.scss @@ -1,6 +1,8 @@ .app-container { .mainContent { - width: calc(100vw - 275px); + width: calc(100vw - 5vw); + margin-left: 2.5vw; + margin-right: 2.5vw; position: relative; } @media screen and (max-width: 780px) { diff --git a/src/common/pages/Items/All/index.js b/src/common/pages/Items/All/index.js index 6bed54f..6f123d8 100644 --- a/src/common/pages/Items/All/index.js +++ b/src/common/pages/Items/All/index.js @@ -85,19 +85,19 @@ export default class All extends React.Component { componentDidMount() { // this.myStoreItem.isSearching = false; - if(this.userData.role == 'store') { - this.myStoreItem.getAll(); - } - if(this.userData.role == 'administrator') { - this.myStoreItem.setRequestQuery({user_store_id : this.props.id}); - console.log('ini id',this.props.id); - this.myStoreItem.getAll(); - } + // if(this.userData.role == 'store') { + // this.myStoreItem.getAll(); + // } + // if(this.userData.role == 'administrator') { + // this.myStoreItem.setRequestQuery({user_store_id : this.props.id}); + // console.log('ini id',this.props.id); + // this.myStoreItem.getAll(); + // } } componentWillUnmount(){ - this.myStoreItem.isSearching = false; - this.myStoreItem.reset(); + // this.myStoreItem.isSearching = false; + // this.myStoreItem.reset(); } deleteClicked = (id) => { @@ -145,7 +145,315 @@ export default class All extends React.Component { render() { - console.log(this.myStoreItem.data.length); + const data = [ + { + category_id: "1e444a5a-cf4d-48e5-bde4-0f984ebd557d", + created_at: "2019-01-02T04:00:08.803Z", + custom_fields: null, + deleted_at: null, + description: null, + height: "0.00", + id: "7e3072c1-9bfd-4b52-af38-9c6e30456c73", + images: {main: "https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png", gallery: ["https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png"]}, + item_status_id: "2b1a2598-8333-4b19-ae7b-c054bec87540", + length: "0.00", + name: "Silly Oregano Seasoning", + odoo_additional_data: {product_id: 205, product_uom: 21, product_tmpl_id: 291}, + product_id: 205, + product_tmpl_id: 291, + product_uom: 21, + odoo_stock_id: 123634, + order: 147291, + preorder: null, + regular_price: "10", + sale_date_from: null, + sale_date_to: null, + sale_price: null, + seen: 0, + sold: 0, + stock: "34.00", + uom: "pack", + updated_at: "2019-01-02T13:00:05.042Z", + use_weight_as_stock: false, + user_store_id: "959194a0-7067-400c-b354-2e8d03300660", + visible: true, + weight: "0.04", + width: "0.00", + wishlist: "0", + },{ + category_id: "1e444a5a-cf4d-48e5-bde4-0f984ebd557d", + created_at: "2019-01-02T04:00:08.803Z", + custom_fields: null, + deleted_at: null, + description: null, + height: "0.00", + id: "7e3072c1-9bfd-4b52-af38-9c6e30456c73", + images: {main: "https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png", gallery: ["https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png"]}, + item_status_id: "2b1a2598-8333-4b19-ae7b-c054bec87540", + length: "0.00", + name: "Silly Oregano Seasoning", + odoo_additional_data: {product_id: 205, product_uom: 21, product_tmpl_id: 291}, + product_id: 205, + product_tmpl_id: 291, + product_uom: 21, + odoo_stock_id: 123634, + order: 147291, + preorder: null, + regular_price: "10", + sale_date_from: null, + sale_date_to: null, + sale_price: null, + seen: 0, + sold: 0, + stock: "34.00", + uom: "pack", + updated_at: "2019-01-02T13:00:05.042Z", + use_weight_as_stock: false, + user_store_id: "959194a0-7067-400c-b354-2e8d03300660", + visible: true, + weight: "0.04", + width: "0.00", + wishlist: "0", + },{ + category_id: "1e444a5a-cf4d-48e5-bde4-0f984ebd557d", + created_at: "2019-01-02T04:00:08.803Z", + custom_fields: null, + deleted_at: null, + description: null, + height: "0.00", + id: "7e3072c1-9bfd-4b52-af38-9c6e30456c73", + images: {main: "https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png", gallery: ["https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png"]}, + item_status_id: "2b1a2598-8333-4b19-ae7b-c054bec87540", + length: "0.00", + name: "Silly Oregano Seasoning", + odoo_additional_data: {product_id: 205, product_uom: 21, product_tmpl_id: 291}, + product_id: 205, + product_tmpl_id: 291, + product_uom: 21, + odoo_stock_id: 123634, + order: 147291, + preorder: null, + regular_price: "10", + sale_date_from: null, + sale_date_to: null, + sale_price: null, + seen: 0, + sold: 0, + stock: "34.00", + uom: "pack", + updated_at: "2019-01-02T13:00:05.042Z", + use_weight_as_stock: false, + user_store_id: "959194a0-7067-400c-b354-2e8d03300660", + visible: true, + weight: "0.04", + width: "0.00", + wishlist: "0", + },{ + category_id: "1e444a5a-cf4d-48e5-bde4-0f984ebd557d", + created_at: "2019-01-02T04:00:08.803Z", + custom_fields: null, + deleted_at: null, + description: null, + height: "0.00", + id: "7e3072c1-9bfd-4b52-af38-9c6e30456c73", + images: {main: "https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png", gallery: ["https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png"]}, + item_status_id: "2b1a2598-8333-4b19-ae7b-c054bec87540", + length: "0.00", + name: "Silly Oregano Seasoning", + odoo_additional_data: {product_id: 205, product_uom: 21, product_tmpl_id: 291}, + product_id: 205, + product_tmpl_id: 291, + product_uom: 21, + odoo_stock_id: 123634, + order: 147291, + preorder: null, + regular_price: "10", + sale_date_from: null, + sale_date_to: null, + sale_price: null, + seen: 0, + sold: 0, + stock: "34.00", + uom: "pack", + updated_at: "2019-01-02T13:00:05.042Z", + use_weight_as_stock: false, + user_store_id: "959194a0-7067-400c-b354-2e8d03300660", + visible: true, + weight: "0.04", + width: "0.00", + wishlist: "0", + },{ + category_id: "1e444a5a-cf4d-48e5-bde4-0f984ebd557d", + created_at: "2019-01-02T04:00:08.803Z", + custom_fields: null, + deleted_at: null, + description: null, + height: "0.00", + id: "7e3072c1-9bfd-4b52-af38-9c6e30456c73", + images: {main: "https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png", gallery: ["https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png"]}, + item_status_id: "2b1a2598-8333-4b19-ae7b-c054bec87540", + length: "0.00", + name: "Silly Oregano Seasoning", + odoo_additional_data: {product_id: 205, product_uom: 21, product_tmpl_id: 291}, + product_id: 205, + product_tmpl_id: 291, + product_uom: 21, + odoo_stock_id: 123634, + order: 147291, + preorder: null, + regular_price: "10", + sale_date_from: null, + sale_date_to: null, + sale_price: null, + seen: 0, + sold: 0, + stock: "34.00", + uom: "pack", + updated_at: "2019-01-02T13:00:05.042Z", + use_weight_as_stock: false, + user_store_id: "959194a0-7067-400c-b354-2e8d03300660", + visible: true, + weight: "0.04", + width: "0.00", + wishlist: "0", + },{ + category_id: "1e444a5a-cf4d-48e5-bde4-0f984ebd557d", + created_at: "2019-01-02T04:00:08.803Z", + custom_fields: null, + deleted_at: null, + description: null, + height: "0.00", + id: "7e3072c1-9bfd-4b52-af38-9c6e30456c73", + images: {main: "https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png", gallery: ["https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png"]}, + item_status_id: "2b1a2598-8333-4b19-ae7b-c054bec87540", + length: "0.00", + name: "Silly Oregano Seasoning", + odoo_additional_data: {product_id: 205, product_uom: 21, product_tmpl_id: 291}, + product_id: 205, + product_tmpl_id: 291, + product_uom: 21, + odoo_stock_id: 123634, + order: 147291, + preorder: null, + regular_price: "10", + sale_date_from: null, + sale_date_to: null, + sale_price: null, + seen: 0, + sold: 0, + stock: "34.00", + uom: "pack", + updated_at: "2019-01-02T13:00:05.042Z", + use_weight_as_stock: false, + user_store_id: "959194a0-7067-400c-b354-2e8d03300660", + visible: true, + weight: "0.04", + width: "0.00", + wishlist: "0", + },{ + category_id: "1e444a5a-cf4d-48e5-bde4-0f984ebd557d", + created_at: "2019-01-02T04:00:08.803Z", + custom_fields: null, + deleted_at: null, + description: null, + height: "0.00", + id: "7e3072c1-9bfd-4b52-af38-9c6e30456c73", + images: {main: "https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png", gallery: ["https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png"]}, + item_status_id: "2b1a2598-8333-4b19-ae7b-c054bec87540", + length: "0.00", + name: "Silly Oregano Seasoning", + odoo_additional_data: {product_id: 205, product_uom: 21, product_tmpl_id: 291}, + product_id: 205, + product_tmpl_id: 291, + product_uom: 21, + odoo_stock_id: 123634, + order: 147291, + preorder: null, + regular_price: "10", + sale_date_from: null, + sale_date_to: null, + sale_price: null, + seen: 0, + sold: 0, + stock: "34.00", + uom: "pack", + updated_at: "2019-01-02T13:00:05.042Z", + use_weight_as_stock: false, + user_store_id: "959194a0-7067-400c-b354-2e8d03300660", + visible: true, + weight: "0.04", + width: "0.00", + wishlist: "0", + },{ + category_id: "1e444a5a-cf4d-48e5-bde4-0f984ebd557d", + created_at: "2019-01-02T04:00:08.803Z", + custom_fields: null, + deleted_at: null, + description: null, + height: "0.00", + id: "7e3072c1-9bfd-4b52-af38-9c6e30456c73", + images: {main: "https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png", gallery: ["https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png"]}, + item_status_id: "2b1a2598-8333-4b19-ae7b-c054bec87540", + length: "0.00", + name: "Silly Oregano Seasoning", + odoo_additional_data: {product_id: 205, product_uom: 21, product_tmpl_id: 291}, + product_id: 205, + product_tmpl_id: 291, + product_uom: 21, + odoo_stock_id: 123634, + order: 147291, + preorder: null, + regular_price: "10", + sale_date_from: null, + sale_date_to: null, + sale_price: null, + seen: 0, + sold: 0, + stock: "34.00", + uom: "pack", + updated_at: "2019-01-02T13:00:05.042Z", + use_weight_as_stock: false, + user_store_id: "959194a0-7067-400c-b354-2e8d03300660", + visible: true, + weight: "0.04", + width: "0.00", + wishlist: "0", + },{ + category_id: "1e444a5a-cf4d-48e5-bde4-0f984ebd557d", + created_at: "2019-01-02T04:00:08.803Z", + custom_fields: null, + deleted_at: null, + description: null, + height: "0.00", + id: "7e3072c1-9bfd-4b52-af38-9c6e30456c73", + images: {main: "https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png", gallery: ["https://marketplace-sillyfish-api.asacreative.com/uploads/item_123634.png"]}, + item_status_id: "2b1a2598-8333-4b19-ae7b-c054bec87540", + length: "0.00", + name: "Silly Oregano Seasoning", + odoo_additional_data: {product_id: 205, product_uom: 21, product_tmpl_id: 291}, + product_id: 205, + product_tmpl_id: 291, + product_uom: 21, + odoo_stock_id: 123634, + order: 147291, + preorder: null, + regular_price: "10", + sale_date_from: null, + sale_date_to: null, + sale_price: null, + seen: 0, + sold: 0, + stock: "34.00", + uom: "pack", + updated_at: "2019-01-02T13:00:05.042Z", + use_weight_as_stock: false, + user_store_id: "959194a0-7067-400c-b354-2e8d03300660", + visible: true, + weight: "0.04", + width: "0.00", + wishlist: "0", + } + ]; const actionsDelete = [ {/**/} @@ -244,7 +552,7 @@ export default class All extends React.Component { : "" } - {(this.myStoreItem.isSearching ? this.myStoreItem.dataFiltered : this.myStoreItem.data).map(item => { + {data.map(item => { return (
) diff --git a/src/common/pages/Items/ItemCard/index.js b/src/common/pages/Items/ItemCard/index.js index 60d3f65..44ce089 100644 --- a/src/common/pages/Items/ItemCard/index.js +++ b/src/common/pages/Items/ItemCard/index.js @@ -31,8 +31,9 @@ export class ItemCard extends React.Component { render() { const {data = {}} = this.props; - const main = get(data,'images.main',null) - const mainImage = this.http.appendImagePath(main); + const main = get(data,'images.main',null); + // const mainImage = this.http.appendImagePath(main); + const mainImage = main; return ( @@ -43,10 +44,12 @@ export class ItemCard extends React.Component { {/**/} {(data.name.length > 14) ? data.name.substring(0,13)+`...` : data.name}} titleStyle={{fontWeight: 'bold', fontSize: 18, lineHeight: '30px', whiteSpace: 'nowrap'}} - subtitle={}/> + subtitle={{data.regular_price} Points}/> + {/*{(data.name.length > 14) ? data.name.substring(0,13)+`...` : data.name}} titleStyle={{fontWeight: 'bold', fontSize: 18, lineHeight: '30px', whiteSpace: 'nowrap'}}*/} + {/*subtitle={}/>*/} {/**/} {/*

{data.name}

*/} diff --git a/src/common/pages/Items/index.js b/src/common/pages/Items/index.js index 56e91c6..3a442ca 100644 --- a/src/common/pages/Items/index.js +++ b/src/common/pages/Items/index.js @@ -1,22 +1,12 @@ import React from 'react'; import {inject, observer} from 'mobx-react'; import {Link} from 'react-router'; +import { Affix, Card, Slider, Select } from 'antd'; import {Tab, Tabs} from 'material-ui'; import './style.scss'; import All from "./All/index"; -import Active from "./Active/index"; -import Unactive from "./Unactive/index"; -import SoldOut from "./SoldOut/index"; -import Banned from "./Banned/index"; - -export const ITEM_TABS = { - ALL: 'all', - ACTIVE: 'active', - UNACTIVE : 'unactive', - SOLD_OUT: 'sold_out', - BANNED: 'banned', -}; +const Option = Select.Option; @inject('appstate') @observer export default class ItemsComponent extends React.Component { @@ -24,72 +14,70 @@ export default class ItemsComponent extends React.Component { super(props); this.props = props; this.state = { - tabSelected: 'all', + valueMinimal: 0, + valueMaximal: 0, }; - this.handleChange = this.handleChange.bind(this); this.defaultState = Object.assign({}, this.state); - this.http = props.appstate.http; - this.authStore = props.appstate.auth; - this.globalUI = props.appstate.globalUI; - this.appStore = props.appstate.app; - this.myStore = props.appstate.myStore; } componentDidMount() { } - handleChange = (tabSelected) => { - this.setState({tabSelected: tabSelected}); - this.globalUI.itemsTabSelected = tabSelected; + handleChangeMinimal = (valueMinimal) => { + this.setState({ valueMinimal }); }; - getContent() { - switch (this.globalUI.itemsTabSelected) { - case ITEM_TABS.ALL: - return ; - case ITEM_TABS.ACTIVE: - return ; - case ITEM_TABS.UNACTIVE: - return ; - case ITEM_TABS.SOLD_OUT: - return ; - case ITEM_TABS.BANNED: - return ; - default: - return - } + handleChangeMaximal = (valueMaximal) => { + this.setState({ valueMaximal }); + }; + + handleChange = (value) => { + console.log(`selected ${value}`); + } + + handleBlur = () => { + console.log('blur'); + } + + handleFocus = () => { + console.log('focus'); } render() { - - const {type:appType} = this.appStore; + const { valueMinimal, valueMaximal } = this.state; return ( -
+
-
- - - - - - - {/* - - */} - - - - {/**/} - {/**/} - {/**/} - - {this.getContent()} +
+ + +

Min. Points

+ + +

Max. Points

+ + +

Category

+ +
+
+
+
+