public void InitiateTransactionRows(List <TransactionSummaryData> transactionList, bool isOrderByDate, Dictionary <string, TransactionSummaryGameObjectList> transactionGameObjectDict)
    {
        this.isOrderByDate = isOrderByDate;
        firstSubPanel.SetActive(false);
        secondSubPanel.SetActive(false);
        thirdSubPanel.SetActive(false);
        transactionsPanel.SetActive(false);
        TransactionSummaryGameObjectList transactionGameObjects = null;

        foreach (TransactionSummaryData tsData in transactionList)
        {
            GameObject  tempTitlePanel = (GameObject)Instantiate(titlePanel, transform.position, transform.rotation);
            Transform[] ts             = tempTitlePanel.transform.GetComponentsInChildren <Transform>();
            tempTitlePanel.name = "TitlePanel_" + tsData.GetPrimaryKey();
            bool isExpanded = false;

            if (transactionGameObjectDict.ContainsKey(tsData.GetPrimaryKey()))
            {
                transactionGameObjects = transactionGameObjectDict[tsData.GetPrimaryKey()];
                isExpanded             = transactionGameObjects.IsExpanded();
                transactionGameObjectDict.Remove(tsData.GetPrimaryKey());
            }

            foreach (Transform t in ts)
            {
                switch (t.gameObject.name)
                {
                case "MainTitle":
                    t.gameObject.GetComponent <Text>().text = tsData.GetPrimaryKey();
                    break;

                case "ExpandCollapseButton":
                    if (isExpanded)
                    {
                        t.gameObject.GetComponent <Button>().GetComponentInChildren <Text>().text = "v";
                    }
                    else
                    {
                        t.gameObject.GetComponent <Button>().GetComponentInChildren <Text>().text = ">";
                    }
                    break;
                }
            }
            tempTitlePanel.transform.SetParent(mainPanel.transform, false);
            tempTitlePanel.SetActive(true);
            titlePanel.SetActive(false);

            transactionGameObjects = new TransactionSummaryGameObjectList(tsData.GetPrimaryKey(), tempTitlePanel);
            transactionGameObjects.SetExpandedFlag(isExpanded);
            transactionGameObjectDict.Add(tsData.GetPrimaryKey(), transactionGameObjects);
        }
    }
예제 #2
0
    public void displayTransactionDetails(bool isAlreadyExpanded, string selectedPanelKey)
    {
        transactionDetailsList.RemoveAllRows();
        TransactionDetailsRow            row = transactionDetailsList.AddRow();
        TransactionSummaryGameObjectList transactionGameObjects = null;

        row.InitiateTransactionDetailsRow(selectedMainPanelKey);
        transactionGameObjectDict = row.expandCollapseTransactionDetailsRows(selectedMainPanelSubDetailsData, selectedMainPanelKey,
                                                                             true, transactionGameObjectDict);
        transactionGameObjects = transactionGameObjectDict[selectedMainPanelKey];
        GameObject transactionDetailsParentPanel = transactionGameObjects.GetParentGameObject();

        foreach (TransactionSummaryDetailsData tsDetailsData in selectedMainPanelSubDetailsData.getTransactionSummaryDetailsData())
        {
            string currentTransactionDetailsPanelkey = selectedMainPanelKey + "_" + tsDetailsData.GetPrimaryKey();
            bool   curTransactionPanelExpandedFlag   = false;

            if ((currentTransactionDetailsPanelkey).Equals(selectedPanelKey))
            {
                curTransactionPanelExpandedFlag = !isAlreadyExpanded;
            }
            else
            {
                if (transactionGameObjectDict.ContainsKey(currentTransactionDetailsPanelkey))
                {
                    transactionGameObjects          = transactionGameObjectDict[currentTransactionDetailsPanelkey];
                    curTransactionPanelExpandedFlag = transactionGameObjects.IsExpanded();

                    if (curTransactionPanelExpandedFlag)
                    {
                        //transactionGameObjectDict = row.ExpandCollapseThirdPanel(curFinalPanelExpandedFlag, tsSubDetailsData, currentSecondSubPanelkey, transactionGameObjectDict);
                    }
                }
            }

            GameObject transactionDetailsPanel = transactionDetailsParentPanel.transform.Find("TransactionsPanel_" + currentTransactionDetailsPanelkey).gameObject;
            //transactionDetailsPanel.GetComponentsInChildren<Button>()[0].onClick.AddListener(() => displayTransactionDetails(curTransactionPanelExpandedFlag, currentTransactionDetailsPanelkey));
            transactionDetailsPanel.GetComponentsInChildren <Button>()[0].onClick.AddListener(() => openTransactionReceipt(tsDetailsData));
        }
    }
예제 #3
0
    public void onClickRow(bool isAlreadyExpanded, string selectedPanel)
    {
        transactionByDateList.RemoveAllRows();

        if (transactionSummaryDataList != null && transactionSummaryDataList.Count > 0)
        {
            TransactionByDateRow row = transactionByDateList.AddRow();
            row.InitiateTransactionRows(transactionSummaryDataList, dateToggle.isOn, transactionGameObjectDict);

            foreach (TransactionSummaryData tsData in transactionSummaryDataList)
            {
                string currentMainPanelkey = tsData.GetPrimaryKey();
                TransactionSummaryGameObjectList transactionGameObjects = null;
                bool tempBaseRowExpandedFlag = false;

                if (selectedPanel.Equals(currentMainPanelkey))
                {
                    tempBaseRowExpandedFlag   = !isAlreadyExpanded;
                    transactionGameObjectDict = row.ExpandCollapseBasePanel(tempBaseRowExpandedFlag, tsData, transactionGameObjectDict);
                    transactionGameObjects    = transactionGameObjectDict[currentMainPanelkey];
                }
                else
                {
                    if (transactionGameObjectDict.ContainsKey(currentMainPanelkey))
                    {
                        transactionGameObjects  = transactionGameObjectDict[currentMainPanelkey];
                        tempBaseRowExpandedFlag = transactionGameObjects.IsExpanded();
                    }

                    if (tempBaseRowExpandedFlag)
                    {
                        transactionGameObjectDict = row.ExpandCollapseBasePanel(tempBaseRowExpandedFlag, tsData, transactionGameObjectDict);
                    }
                }

                GameObject tempCurrentRow = transactionGameObjects.GetParentGameObject();
                tempCurrentRow.transform.GetComponentsInChildren <Button>()[1].onClick.AddListener(() => onClickRow(tempBaseRowExpandedFlag, tsData.GetPrimaryKey()));

                row.expandCollapseButton.onClick.AddListener(() => onClickRow(tempBaseRowExpandedFlag, currentMainPanelkey));

                if (tempBaseRowExpandedFlag)
                {
                    foreach (TransactionSummaryFirstSubData tsFirstSubData in tsData.GetTransactionSummaryFirstSubDataList())
                    {
                        string currentFirstSubPanelkey  = currentMainPanelkey + "_" + tsFirstSubData.GetPrimaryKey();
                        bool   tempFirstRowExpandedFlag = false;

                        if ((currentFirstSubPanelkey).Equals(selectedPanel))
                        {
                            tempFirstRowExpandedFlag  = !isAlreadyExpanded;
                            transactionGameObjectDict = row.ExpandCollapseFirstPanel(tempFirstRowExpandedFlag, tsFirstSubData, currentMainPanelkey, transactionGameObjectDict);
                        }
                        else
                        {
                            if (transactionGameObjectDict.ContainsKey(currentFirstSubPanelkey))
                            {
                                transactionGameObjects   = transactionGameObjectDict[currentFirstSubPanelkey];
                                tempFirstRowExpandedFlag = transactionGameObjects.IsExpanded();

                                if (tempFirstRowExpandedFlag)
                                {
                                    transactionGameObjectDict = row.ExpandCollapseFirstPanel(tempFirstRowExpandedFlag, tsFirstSubData, currentMainPanelkey, transactionGameObjectDict);
                                }
                            }
                        }

                        transactionGameObjects = transactionGameObjectDict[currentMainPanelkey];
                        GameObject currentFirstPanel = transactionGameObjects.GetParentGameObject().transform.Find("FirstSubPanel_" + currentFirstSubPanelkey).gameObject;
                        currentFirstPanel.GetComponentsInChildren <Button>()[0].onClick.AddListener(() => onClickRow(tempFirstRowExpandedFlag, currentFirstSubPanelkey));

                        if (tempFirstRowExpandedFlag)
                        {
                            foreach (TransactionSummarySecondSubData tsSecondSubData in tsFirstSubData.GetTransactionSummarySecondSubDataList())
                            {
                                string currentSecondSubPanelkey   = currentFirstSubPanelkey + "_" + tsSecondSubData.GetPrimaryKey();
                                bool   curSecondPanelExpandedFlag = false;

                                if ((currentSecondSubPanelkey).Equals(selectedPanel))
                                {
                                    curSecondPanelExpandedFlag = !isAlreadyExpanded;
                                    transactionGameObjectDict  = row.ExpandCollapseSecondPanel(curSecondPanelExpandedFlag, tsSecondSubData, currentFirstSubPanelkey, transactionGameObjectDict);
                                }
                                else
                                {
                                    if (transactionGameObjectDict.ContainsKey(currentSecondSubPanelkey))
                                    {
                                        transactionGameObjects     = transactionGameObjectDict[currentSecondSubPanelkey];
                                        curSecondPanelExpandedFlag = transactionGameObjects.IsExpanded();

                                        if (curSecondPanelExpandedFlag)
                                        {
                                            transactionGameObjectDict = row.ExpandCollapseSecondPanel(curSecondPanelExpandedFlag, tsSecondSubData, currentFirstSubPanelkey, transactionGameObjectDict);
                                        }
                                    }
                                }

                                transactionGameObjects = transactionGameObjectDict[currentFirstSubPanelkey];
                                GameObject currentSecondPanel = transactionGameObjects.GetParentGameObject().transform.Find("SecondSubPanel_" + currentSecondSubPanelkey).gameObject;
                                currentSecondPanel.GetComponentsInChildren <Button>()[1].onClick.AddListener(() => onClickRow(curSecondPanelExpandedFlag, currentSecondSubPanelkey));

                                if (curSecondPanelExpandedFlag)
                                {
                                    foreach (TransactionSummarySubDetailsData tsSubDetailsData in tsSecondSubData.GetTransactionSummarySubDetailsData())
                                    {
                                        string currentFinalSubPanelkey   = currentSecondSubPanelkey + "_" + tsSubDetailsData.GetPrimaryKey();
                                        bool   curFinalPanelExpandedFlag = false;

                                        if ((currentFinalSubPanelkey).Equals(selectedPanel))
                                        {
                                            curFinalPanelExpandedFlag = !isAlreadyExpanded;
                                            transactionGameObjectDict = row.ExpandCollapseThirdPanel(curFinalPanelExpandedFlag, tsSubDetailsData, currentSecondSubPanelkey, transactionGameObjectDict);
                                        }
                                        else
                                        {
                                            if (transactionGameObjectDict.ContainsKey(currentFinalSubPanelkey))
                                            {
                                                transactionGameObjects    = transactionGameObjectDict[currentFinalSubPanelkey];
                                                curFinalPanelExpandedFlag = transactionGameObjects.IsExpanded();

                                                if (curFinalPanelExpandedFlag)
                                                {
                                                    transactionGameObjectDict = row.ExpandCollapseThirdPanel(curFinalPanelExpandedFlag, tsSubDetailsData, currentSecondSubPanelkey, transactionGameObjectDict);
                                                }
                                            }
                                        }

                                        transactionGameObjects = transactionGameObjectDict[currentSecondSubPanelkey];
                                        GameObject currentThirdPanel = transactionGameObjects.GetParentGameObject().transform.Find("ThirdSubPanel_" + currentFinalSubPanelkey).gameObject;
                                        currentThirdPanel.GetComponentsInChildren <Button>()[1].onClick.AddListener(() => openTransactionDetailsView(currentFinalSubPanelkey, tsSubDetailsData));
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }