selectFromDict(categoryIndex) { let tempData = this.state.dict; return (contentIndex) => { return () => { tempData[categoryIndex].shopContents[contentIndex].isSelected = !tempData[categoryIndex].shopContents[contentIndex].isSelected; this.setState({ dict: tempData }); } } }
deleteFromDict(categoryIndex) { let tempData = this.state.dict; return (contentIndex) => { return () => { tempData[categoryIndex].shopContents[contentIndex].isHided = true; this.setState({ dict: tempData }); } } }
var priceForCategory = 0; var numForCategory = 0; for (i = 0; i < this.state.dict[categoryNumber].shopContents.length; i++) { if (!this.state.dict[categoryNumber].shopContents[i].isHided) { numTotal++; numForCategory++; if (this.state.dict[categoryNumber].shopContents[i].isSelected) { numSelected++; priceForCategory += this.state.dict[categoryNumber].shopContents[i].price; }; listWithCategories( categoryName = this.state.dict[i].categoryName, shopContents = this.state.dict[i].shopContents, toggleFunction = this.selectFromDict(i), deleteFunction = this.deleteFromDict(i),