Commit 0baa6331 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

FIX Menu item yang category Unakaffe, hanya muncul 7 item saja. Sedangkan di…

FIX Menu item yang category Unakaffe, hanya muncul 7 item saja. Sedangkan di backend crm menu item dengan category unakaffe jumlahnya ada 8
parent d1d7b10b
......@@ -21,7 +21,6 @@ class MenuSelection extends React.Component {
super(props)
this.state = {
listCategory: [],
list_category: [],
listMenu: [],
list_orders: [],
outlet_id: '',
......@@ -38,6 +37,7 @@ class MenuSelection extends React.Component {
}
componentDidMount() {
if (this.props.outlet_id != '') {
this.getMenuList()
} else {
......@@ -139,7 +139,7 @@ class MenuSelection extends React.Component {
Axios.post(this.props.BASE_URL + 'crm/v2/menu/get_list', params).then(res => {
let data = res.data.data
// console.log("INI DATANYA" + JSON.stringify(data))
console.log("INI DATANYA" + JSON.stringify(data))
// let last_category = ''
......@@ -195,20 +195,27 @@ class MenuSelection extends React.Component {
let index_next_category = _.findIndex(this.state.listCategory, ['name', item.name]) + 1
let next_category = this.state.listCategory[index_next_category]
let index_end = _.findIndex(this.props.menu_item, ['name', next_category.name])
let filter_item = this.props.menu_item.slice(index_start, index_end);
if (index_end < 0) {
index_end = this.props.menu_item.length;
}
let filter_item = this.props.menu_item.slice(index_start, index_end);
this.setState({
data_before_search: filter_item
})
} catch (error) {
let index_start = _.findIndex(this.props.menu_item, ['name', item.name])
let index_end = item.length - 1
let index_end = parseInt(this.props.menu_item.length - 1)
let filter_item = this.props.menu_item.slice(index_start, index_end);
this.setState({
data_before_search: filter_item
})
}
}
renderTabBar = ({ item }) => {
......@@ -378,10 +385,7 @@ class MenuSelection extends React.Component {
renderItem={this.renderItem}
keyExtractor={item => item.id}
ref={(ref) => { this.flatListRef = ref; }}
initialNumToRender={5}
maxToRenderPerBatch={10}
windowSize={10}
/>
) : (
<Text style={{ flexWrap: 'wrap', fontFamily: 'Gotham-Light', color: '#b1b1b2', textAlign: 'center', top: 20 }}> {i18n.t('itemnotfound')}</Text>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment