Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
81 kB
3
Indexable
<apex:page standardcontroller="Fund__c" extensions="NewDistributionController" action="{!init}" lightningStyleSheets="true">
    <style type="text/css">
        .selectToggle {
            text-decoration: underline !important;
            color: blue !important;
        }

        .helpText {
            left: 16px;
        }

        .columnFormat {
            text-align: 16px;
        }

        .yellow {
            background: yellow;
        }

        .helpButtonOn .helpText {
            display: block;
            opacity: 1;
        }

        .distributionTable th {
            font-weight: bold;
            height: 15px;
            background-color: #dddddd;
            border: 1px solid black;
        }

        .dt-buttons {
            left: 50%;
        }
        .parentIDFont {
        font-size: 12px;
        margin-right: 5px;
        }
    .customPopup {
        background-color: white;
        border-style: solid;
        border-width: 2px;
        left: 35%;
        padding: 10px;
        position: absolute;
        z-index: 9999;
        top: 25%;
    }
        td.dataCol.first.last{
        white-space : nowrap;
        font-size : 12px;
        }

        td.dataCol.first{
        white-space : nowrap;
        }
        
        .custPopupForAllocSett{ background-color: #f2f3f3; border-width: 2px; border-style: solid; z-index: 9999; left: 60%; padding:10px; position: absolute ; width: 300px; margin-left: -250px; top:140px; } 
        .popupBackground{ background-color:black; opacity: 0.20; filter: alpha(opacity = 20); position: absolute; width: 100%; height: 100%; top: 0; left: 0; z-index: 9998; } 
        
        .rowsInAlternateColor tr:nth-child(even){
        background-color : #e9f2fa;
        }
        
        .errorConsole .x-grid3-row-over,body .pbBody table.list tr.dataRow.highlight td,body .pbBody table.list tr.dataRow.highlight:hover {
        background-color: #dddddd;
        }
        
        .linkRow:nth-child(even) {
        background-color: #FFFFFF; 
        }
        
        .linkRow:nth-child(odd) {
        background-color: #e9f2fa; 
        }
        
        .linkRow:hover {
        background-color: #dddddd;
        } 
        
    </style>
    <apex:form id="form">
        <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js" />
        <apex:includeScript value="{!URLFOR($Resource.DatatableResource, '/js/datatables.min.js')}" />
        <apex:stylesheet value="{!URLFOR($Resource.DatatableResource, '/css/datatables.css')}" />
        <apex:stylesheet value="{!URLFOR($Resource.DatatableResource, '/css/font-awesome.css')}" />
        <apex:includeScript Value="https://cdn.datatables.net/buttons/2.0.1/js/dataTables.buttons.min.js" />
        <apex:includeScript Value="https://cdn.datatables.net/buttons/2.0.1/js/buttons.html5.min.js" />
        <script type="text/javascript">
            $(document).ready(function () {
                if({!defaultProRataFlag} === true){               
                    //var picklist = $('[id$="fundAllocationPicklist"]');                
                    $('[id$="fundAllocationPicklist"]').attr('disabled', 'disabled');
                    $('[id$="distAmntFundAllocMap"]').attr('disabled', 'disabled');
                    $('[id$="costBasisFundAllocMap"]').attr('disabled', 'disabled');
                    $('[id$="unitsDistFundAllocMap"]').attr('disabled', 'disabled');
                    $('[id$="unitsDistFundAllocMap2"]').attr('disabled', 'disabled');
                }else{
                    $('[id$="fundAllocationPicklist"]').removeAttr('disabled');
                    $('[id$="distAmntFundAllocMap"]').removeAttr('disabled');
                    $('[id$="costBasisFundAllocMap"]').removeAttr('disabled');
                    $('[id$="unitsDistFundAllocMap"]').removeAttr('disabled');
                    $('[id$="unitsDistFundAllocMap2"]').removeAttr('disabled');
                }
                if ('{!isdataLoaded}' == 'false') {
                    loadData();
                }
                if ('{!currentStepName}' == 'INPUT') {
                    calcAmount();
                    calcPercent();
                }
                var columnsList = [];
                var fields = [
                    <apex:repeat var="f" value="{!$ObjectType.Distribution__c.FieldSets.Import_Wizard_Fields}">
                        '{!f.fieldPath}',
                </apex:repeat>
            ];
                var fields_array = fields.toString().split(',');
                var unitsDistributedFields = '{!unitsDistributedFields}'.toString().split(',');

                var columnSize = 0;
                if (unitsDistributedFields != '' && unitsDistributedFields != null && unitsDistributedFields != undefined) {
                    columnSize = fields_array.length + unitsDistributedFields.length + 4;
                } else {
                    columnSize = fields_array.length + 4;
                }

                for (var i = 0; i < columnSize; i++) {
                    columnsList[i] = null;
                }
                console.log('columnsList.length $$$ : ' + columnsList.length);
                var documentTable = $('[id$="distributionTable"]').DataTable({
                    "dom": 'Bfrtip',
                    "order": [[1, 'desc']],
                    "paging": true,
                    "pageLength": {!distributionPageSize},
                    "info": false,
                    "searching": true,
                    "columns": columnsList,
                    "buttons": [
                        {
                            extend: 'csv',
                            text: '<i class="fa fa-download"></i> Export Templete',
                            filename: 'Distributions ImportTemplate',
                            exportOptions: {
                                columns: 'th:not(:last-child)'
                            }
                        }
                    ],
                    "language":
                    {
                        "paginate":
                        {
                            "next": '<i class="fa fa-chevron-right" aria-hidden="true"></i>',
                            "previous": '<i class="fa fa-chevron-left" aria-hidden="true"></i>'
                        }
                    }
                });
                $("#documentTable_paginate").detach().appendTo('#tableFooter');
            });
            function selectInput() {
                var distPercent = $('[id$=distPercent]');
                var distAmount = $('[id$=distAmount]');
                var usePercent = $('[id$=usePercent]');
                if (distPercent.val() != '') {
                    usePercent.val('true');
                    distAmount.attr('disabled', 'disabled');
                } else if (distAmount.val() != '') {
                    usePercent.val('false');
                    distPercent.attr('disabled', 'disabled');
                }
                if (distPercent.val() == '' && distAmount.val() == '') {
                    distAmount.removeAttr('disabled');
                    distPercent.removeAttr('disabled');
                    usePercent.val('');
                }
            }
            function loadData() {
                loadContentFun();
            }
            //If distribution Amount is input, based on Units Distributed, valuePerUnit gets calculated
            function calcAmount() {
                var distPercent = $('[id$=distPercent]');
                var distAmount = $('[id$=distAmount]');
                var lpCommitments = $('[id$=lpCommitments]');
                var unitsDistributed = $('[id$=unitsDistributed]') != null ? $('[id$=unitsDistributed]') : 0;
                var valuePerUnit = $('[id$=valuePerUnit]') != null ? $('[id$=valuePerUnit]') : 0.0;

                if (distPercent.val() != "" && lpCommitments.val() != "" && lpCommitments.val() != 0.0) {
                    var unrounded = lpCommitments.val() * (distPercent.val() / 100);
                    var rounded = roundNumber(unrounded, 2);
                    var amountVal = !isNaN(rounded) ? rounded : "";
                    distAmount.val(amountVal);
                    if ('{!selectedDistributionRecordType}' == 'In-Kind Distribution') {
                        if (unitsDistributed.val() != "" && unitsDistributed.val() != 0) {
                            var unroundedvaluePerUnit = distAmount.val() / unitsDistributed.val().split(',').join('');
                            var roundedvaluePerUnit = roundNumber(unroundedvaluePerUnit, 11);
                            var valuePerUnitVal = !isNaN(roundedvaluePerUnit) ? roundedvaluePerUnit : "";
                            valuePerUnit.val(valuePerUnitVal);
                        }
                    }
                } else {
                    distAmount.val(0.0);
                    if ('{!selectedDistributionRecordType}' == 'In-Kind Distribution') {
                        valuePerUnit.val(0.0);
                    }
                }
            }
            //If distribution % is Input, based on Units Distributed, valuePerUnit gets calculated
            function calcPercent() {
                var distPercent = $('[id$=distPercent]');
                var distAmount = $('[id$=distAmount]');
                var lpCommitments = $('[id$=lpCommitments]');
                var unitsDistributed = $('[id$=unitsDistributed]') != null ? $('[id$=unitsDistributed]') : 0;
                var valuePerUnit = $('[id$=valuePerUnit]') != null ? $('[id$=valuePerUnit]') : 0.0;

                if (distAmount.val() != "" && lpCommitments.val() != "" && lpCommitments.val() != 0.0) {
                    var unrounded = (distAmount.val() / lpCommitments.val()) * 100;
                    var rounded = roundNumber(unrounded, 4);
                    var percentVal = !isNaN(rounded) ? rounded : "";
                    distPercent.val(percentVal);
                    if ('{!selectedDistributionRecordType}' == 'In-Kind Distribution') {
                        if (unitsDistributed.val() != "" && unitsDistributed.val() != 0) {
                            var unrounded = distAmount.val() / unitsDistributed.val().split(',').join('');
                            var rounded = roundNumber(unrounded, 11);
                            var amountVal = !isNaN(rounded) ? rounded : "";
                            valuePerUnit.val(amountVal);
                        }
                    }
                } else {
                    distAmount.val(0.0);
                    distPercent.val(0);
                }
            }
            //If Units Distributed is Input, costPerUnit gets calculated
            function calcCostPerUnitOnCosBasisInput() {
                var unitsDistributed = $('[id$=unitsDistributed]') != null ? $('[id$=unitsDistributed]') : 0;
                var costPerUnit = $('[id$=costPerUnit]') != null ? $('[id$=costPerUnit]') : 0.0;
                var costBasis = $('[id$=costBasisVal]') != null ? $('[id$=costBasisVal]') : 0.0;

                if ('{!selectedDistributionRecordType}' == 'In-Kind Distribution') {
                    if (unitsDistributed.val() != "" && unitsDistributed.val() != 0) {
                        //var unrounded = costBasis.val() / unitsDistributed.val();//costBasisVal.split(',').join('')
                        var unrounded = costBasis.val().split(',').join('') / unitsDistributed.val().split(',').join('');
                        var rounded = roundNumber(unrounded, 11);
                        var costPerUnitVal = !isNaN(rounded) ? rounded : "";
                        costPerUnit.val(costPerUnitVal);
                    }
                }
            }

            function calcPercentAndDistAmount() {
                var distPercent = $('[id$=distPercent]');
                var distAmount = $('[id$=distAmount]');
                var lpCommitments = $('[id$=lpCommitments]');
                var unitsDistributed = $('[id$=unitsDistributed]') != null ? $('[id$=unitsDistributed]') : 0;
                var valuePerUnit = $('[id$=valuePerUnit]') != null ? $('[id$=valuePerUnit]') : 0.0;

                if (distAmount.val() != "" && lpCommitments.val() != "" && lpCommitments.val() != 0.0) {

                    if ('{!selectedDistributionRecordType}' == 'In-Kind Distribution') {
                        if (unitsDistributed.val() != "" && unitsDistributed.val() != 0 && valuePerUnit.val() != "" && valuePerUnit.val() != 0) {
                            var unroundedDistAmount = unitsDistributed.val().split(',').join('') * valuePerUnit.val().split(',').join('');
                            var roundedDistAmount = roundNumber(unroundedDistAmount, 2);
                            var distAmountVal = !isNaN(roundedDistAmount) ? roundedDistAmount : "";
                            distAmount.val(distAmountVal);

                            var unroundedPercentVal = (distAmount.val() / lpCommitments.val()) * 100;
                            var roundedPercentVal = roundNumber(unroundedPercentVal, 4);
                            var percentVal = !isNaN(roundedPercentVal) ? roundedPercentVal : "";
                            distPercent.val(percentVal);
                        } else {
                            distAmount.val(0.0);
                            distPercent.val(0);
                        }
                    }
                } else {
                    distAmount.val(0.0);
                }
            }

            function calcCostBasis() {
                var unitsDistributed = $('[id$=unitsDistributed]') != null ? $('[id$=unitsDistributed]') : 0;
                var costPerUnit = $('[id$=costPerUnit]') != null ? $('[id$=costPerUnit]') : 0.0;
                var costBasis = $('[id$=costBasisVal]') != null ? $('[id$=costBasisVal]') : 0.0;

                if ('{!selectedDistributionRecordType}' == 'In-Kind Distribution') {
                    if (unitsDistributed.val() != "" && unitsDistributed.val() != 0 && costPerUnit.val() != "" && costPerUnit.val() != 0) {
                        var unroundedDistAmount = unitsDistributed.val().split(',').join('') * costPerUnit.val().split(',').join('');
                        var roundedDistAmount = roundNumber(unroundedDistAmount, 2);
                        var costBasisValue = !isNaN(roundedDistAmount) ? roundedDistAmount : "";
                        costBasis.val(costBasisValue);
                    } else {
                        costBasis.val(0.0);
                    }
                }
            }

            function calcValuesOnNumberOfUnitsInput() {
                var distPercent = $('[id$=distPercent]');
                var distAmount = $('[id$=distAmount]');
                var lpCommitments = $('[id$=lpCommitments]');
                var unitsDistributed = $('[id$=unitsDistributed]');// != null ? $('[id$=unitsDistributed]') : 0;
                var UnitDistVal = +unitsDistributed.val().split(',').join('');
                var valuePerUnit = $('[id$=valuePerUnit]');// != null ? $('[id$=valuePerUnit]') : 0.0;
                var distAmountVal = distAmount.val();
                console.log('distAmountVal before formatting new$$$ : ' + distAmountVal);
                distAmountVal = +distAmountVal.split(',').join('');
                console.log('distAmountVal after formatting new$$$ : ' + distAmountVal);
                var costPerUnit = $('[id$=costPerUnit]');
                var costBasis = $('[id$=costBasisVal]');
                var costBasisVal = costBasis.val();
                console.log('costBasisVal before formatting new$$$ : ' + costBasisVal);
                costBasisVal = +costBasisVal.split(',').join('');
                console.log('costBasisVal after formatting new$$$ : ' + costBasisVal);

                if (distAmount.val() != "" && lpCommitments.val() != "" && lpCommitments.val() != 0.0) {

                    if ('{!selectedDistributionRecordType}' == 'In-Kind Distribution') {
                        if (unitsDistributed.val() != "" && unitsDistributed.val() != 0) {
                            var unrounded = distAmount.val().split(',').join('') / unitsDistributed.val().split(',').join('');
                            var rounded = roundNumber(unrounded, 11);
                            var amountVal = !isNaN(rounded) ? rounded : "";
                            if (amountVal == 'Infinity') {
                                amountVal = 0.0;
                            }
                            valuePerUnit.val(amountVal);
                            var unroundedcostPerUnit = costBasisVal / UnitDistVal;
                            var roundedcostPerUnit = roundNumber(unroundedcostPerUnit, 11);
                            var costPerUnitVal = !isNaN(roundedcostPerUnit) ? roundedcostPerUnit : "";
                            if (costPerUnitVal == 'Infinity') { costPerUnitVal = 0.0; }
                            costPerUnit.val(costPerUnitVal);
                        } else {
                            valuePerUnit.val(0.0);
                            costPerUnit.val(0.0);
                        }
                    }
                } else {
                    distAmount.val(0.0)
                }
            }
            function InputUnitsInGrouping() {
                var UnitsInput = [
                <apex:repeat value="{!TraunchCount}" var="f">
                        '{!tempDist[fieldSetForTraunchUnitsDistributed[0].fieldPath]}',
                </apex:repeat>
            ];
                console.log('UnitsInput $$$ : ' + UnitsInput);
            }

            function toggleSelectAll() {
                var selectToggleEl = $(".selectToggle");
                if (selectToggleEl.html() == "Select All") {
                    $("input:checkbox").attr("checked", "checked");
                    selectToggleEl.html("Deselect All");
                } else if (selectToggleEl.html() == "Deselect All") {
                    $("input:checkbox").removeAttr("checked");
                    selectToggleEl.html("Select All");
                }
            }
            function onClickOfCommitementSelectionNext() {
                var commitSelNextBtn = document.querySelector("[id$='commitSelNextId']");
                var commitSelCancelBtn = document.querySelector("[id$='commitSelCancelId']");
                commitSelNextBtn.className = 'btn btnDisabled';
                commitSelNextBtn.disabled = 'disabled';
                commitSelCancelBtn.className = 'btn btnDisabled';
                commitSelCancelBtn.disabled = 'disabled';
            }
            function onClickCommitCheckNxt() {
                var commtChkNxtBtn = document.querySelector("[id$='commitChkPreviousId']");
                var commtChkPrevBtn = document.querySelector("[id$='commitChkNextId']");
                var commtChkCanBtn = document.querySelector("[id$='commitChkCancelId']");
                commtChkNxtBtn.className = 'btn btnDisabled';
                commtChkNxtBtn.disabled = 'disabled';
                commtChkPrevBtn.className = 'btn btnDisabled';
                commtChkPrevBtn.disabled = 'disabled';
                commtChkCanBtn.className = 'btn btnDisabled';
                commtChkCanBtn.disabled = 'disabled';
            }
            function onClickInputPrevAndNext() {
                var inputNxtBtn = document.querySelector("[id$='inputNextId']");
                var inputChkPrevBtn = document.querySelector("[id$='inputPreviousId']");
                var inputChkCanBtn = document.querySelector("[id$='inputCancelId']");
                inputNxtBtn.className = 'btn btnDisabled';
                inputNxtBtn.disabled = 'disabled';
                inputChkPrevBtn.className = 'btn btnDisabled';
                inputChkPrevBtn.disabled = 'disabled';
                inputChkCanBtn.className = 'btn btnDisabled';
                inputChkCanBtn.disabled = 'disabled';
            }
            function showSpinner(idOfBtn) {

                if (idOfBtn == 'processCSVId') {
                    document.querySelector("[id$='loading']").style.display = 'block';
                    var processCsvBtn = document.querySelector("[id$='processCSVId']");
                    processCsvBtn.className = 'btn btnDisabled';
                    processCsvBtn.disabled = 'disabled';
                    callProcessCSV();
                }
                else if (idOfBtn == 'confirmAndSaveId') {
                    document.querySelector("[id$='loading']").style.display = 'block';
                    var confirmSaveBtn = document.querySelector("[id$='confirmAndSaveId']");
                    confirmSaveBtn.className = 'btn btnDisabled';
                    confirmSaveBtn.disabled = 'disabled';
                    confirmAndSaveFun();
                }
                else if (idOfBtn == 'confirmAndSaveBottomId') {
                    document.querySelector("[id$='loading']").style.display = 'block';
                    var confirmSaveBtnBotm = document.querySelector("[id$='confirmAndSaveBottomId']");
                    confirmSaveBtnBotm.className = 'btn btnDisabled';
                    confirmSaveBtnBotm.disabled = 'disabled';
                    confirmAndSaveFun();
                }
                else if (idOfBtn == 'isCheckedZeroCapCommitmentTopId') {
                var checkboxTop = document.querySelector("[id$='isCheckedZeroCapCommitmentTopId']");
                var checkboxBottom = document.querySelector("[id$='isCheckedZeroCapCommitmentBottomId']");
                checkboxBottom.checked = checkboxTop.checked;
                }
                else if (idOfBtn == 'isCheckedZeroCapCommitmentBottomId') { 
                var checkboxTop = document.querySelector("[id$='isCheckedZeroCapCommitmentTopId']");
                var checkboxBottom = document.querySelector("[id$='isCheckedZeroCapCommitmentBottomId']");
                checkboxTop.checked = checkboxBottom.checked;
                }
            }
            function roundNumber(num, dec) {
                var result = Math.round(Math.round(num * Math.pow(10, dec + 1)) / Math.pow(10, 1)) / Math.pow(10, dec);
                return result;
            }
            function showPopUp() {
                document.querySelector("[id$='popup']").style.display = 'block';            
            }
            //Added for Allocations
            function disableOrEnableFundAllocationPicklist(obj) {
               // alert('in disableOrEnableFundAllocationPicklist');
                if(obj.checked){
              //      alert('in if');
                    /* var picklist = $('[id$="fundAllocationPicklist"]');
                    console.log( $('[id$="distAmntFundAllocMap"]'));
                    for(var i=0; i<picklist.length; i++){ 
                        console.log(picklist[i]);
                        picklist[i].selectedIndex = 0;
                        console.log(picklist[i].options[picklist[i].selectedIndex].value);
                        console.log(picklist[i].selectedIndex);
                    } */
                    $('[id$="fundAllocationPicklist"]').attr('disabled', 'disabled');

                    /* var picklist2 = $('[id$="distAmntFundAllocMap"]');
                    for(var i=0; i<picklist2.length; i++){ 
                        picklist2[i].selectedIndex = 0;
                    } */
                    $('[id$="distAmntFundAllocMap"]').attr('disabled', 'disabled');
                    
                    /* var picklist3 = $('[id$="costBasisFundAllocMap"]');
                    for(var i=0; i<picklist3.length; i++){ 
                        picklist3[i].selectedIndex = 0;
                    } */
                    $('[id$="costBasisFundAllocMap"]').attr('disabled', 'disabled');
                    /* var picklist4 = $('[id$="unitsDistFundAllocMap"]');
                    for(var i=0; i<picklist4.length; i++){ 
                        picklist4[i].selectedIndex = 0;
                    } */
                    $('[id$="unitsDistFundAllocMap"]').attr('disabled', 'disabled');
                    /* var picklist5 = $('[id$="unitsDistFundAllocMap2"]');
                    for(var i=0; i<picklist5.length; i++){ 
                        picklist5[i].selectedIndex = 0;
                    } */
                    $('[id$="unitsDistFundAllocMap2"]').attr('disabled', 'disabled');

                } else if(!obj.checked){
               //     alert('in else');
                    $('[id$="fundAllocationPicklist"]').removeAttr('disabled');
                    $('[id$="distAmntFundAllocMap"]').removeAttr('disabled');
                    $('[id$="costBasisFundAllocMap"]').removeAttr('disabled');
                    $('[id$="unitsDistFundAllocMap"]').removeAttr('disabled');
                    $('[id$="unitsDistFundAllocMap2"]').removeAttr('disabled');
                    }
            }
        </script>
        <apex:outputPanel rendered="{!Not(isdataLoaded)}">
            <apex:actionFunction name="loadContentFun" action="{!callToRetrieveCommitments}" status="searchStatus" reRender="form"></apex:actionFunction>
        </apex:outputPanel>
        <apex:actionStatus id="searchStatus">
            <apex:facet name="start">
                <div style="position: fixed; top: 0; left: 0; right: 0; bottom: 0; opacity: 0.25; z-index: 1000; background-color: black;">
                    &nbsp;
                </div>
                <div style="position: fixed; left: 0; top: 0; bottom: 0; right: 0; z-index: 1001; margin: 15% 50%">
                    <div style="display: inline-block; padding: 2px; background-color: #fff; width: 125px;">
                        <img src="/img/loading.gif" style="float: left; margin: 8px;" />
                        <span style="display: inline-block; padding: 10px 0px;">Please Wait...</span>
                    </div>
                </div>
            </apex:facet>
        </apex:actionStatus>
        <apex:outputPanel rendered="{!isBatchRunning}">
            <apex:pageBlock >
                <apex:pageMessages />
                <apex:pageBlockButtons location="both">
                    <apex:commandButton value="Return to Fund" id="cancelTransaction" action="{!returnToFund}" immediate="true"/>
                </apex:pageBlockButtons>
            </apex:pageBlock>
        </apex:outputPanel>
        <apex:outputPanel rendered="{! AND(isdataLoaded, NOT(isBatchRunning))}">
            <apex:inputHidden id="lpCommitments" value="{!totalCommitment}" />
            <!-- Step 1 - Commitment Selection -->
            <apex:pageBlock title="Select Distribution Type - (Step 1 of 5)" rendered="{!currentStepName == 'COMMITMENT_SELECTION'}">
                <apex:pageMessage summary="Please select a Distribution Type & Capital Commitments to be included." severity="info" strength="3"/>
                <apex:pageMessages />
                <apex:pageBlockSection collapsible="false" columns="1" rendered="{!NOT(isSuccess)}">
                    <apex:outputPanel >
                        <br/>
                    </apex:outputPanel>
                    <apex:pageBlockSectionItem >
                        <apex:outputLabel value="Distribution Type" />
                        <apex:outputPanel layout="block" styleClass="requiredInput">
                            <apex:outputpanel layout="block" styleClass="requiredBlock" />
                            <apex:selectList value="{!selectedDistributionRecordType}" size="1" label="Distribution Type">
                                <apex:selectOptions value="{!lstOfRectypes}" />
                                <apex:actionSupport event="onchange" action="{!resetFieldsToBeConsidered}" rerender="unitsDistTraunchCount,inKindTypeSelection" />
                            </apex:selectList>
                            <br/>
                        </apex:outputPanel>
                    </apex:pageBlockSectionItem>
                </apex:pageBlockSection>

                <apex:pageBlockSection collapsible="false" columns="2" rendered="{!NOT(isSuccess)}">
                    <apex:pageBlockSectionItem >
                        <apex:outputPanel id="inKindTypeSelection">
                            <apex:outputPanel layout="block" styleClass="requiredInput" rendered="{!selectedDistributionRecordType == 'In-Kind Distribution Traunches' || selectedDistributionRecordType == 'In-Kind Distribution'}">
                                <apex:outputLabel value="In-Kind Type" style="padding-left: 81px;padding-right: 40px;" />
                                <apex:inputField value="{!parent.In_Kind_Type__c}"  ></apex:inputField>
                            </apex:outputPanel>
                        </apex:outputPanel>
                    </apex:pageBlockSectionItem>
                </apex:pageBlockSection>

                <apex:pageBlockSection collapsible="false" columns="2" rendered="{!NOT(isSuccess)}">
                    <apex:pageBlockSectionItem >
                        <apex:outputPanel id="unitsDistTraunchCount">
                            <apex:outputPanel layout="block" rendered="{!selectedDistributionRecordType == 'In-Kind Distribution Traunches'}">
                                <apex:pageBlockSection collapsible="true">
                                    <apex:outputLabel value="Number of Traunches" style="padding-left: 70px;" />
                                    <apex:outputPanel layout="block">
                                        <apex:selectList value="{!selectedTraunchesCount}" label="Number of Traunches" multiselect="false" size="1">
                                            <apex:selectOption itemValue="2" itemLabel="2" />
                                            <apex:selectOption itemValue="3" itemLabel="3" />
                                            <apex:selectOption itemValue="4" itemLabel="4" />
                                            <apex:selectOption itemValue="5" itemLabel="5" />
                                            <apex:selectOption itemValue="6" itemLabel="6" />
                                        </apex:selectList>
                                    </apex:outputPanel>
                                </apex:pageBlockSection>
                            </apex:outputPanel>
                        </apex:outputPanel>
                    </apex:pageBlockSectionItem>
                    <apex:outputPanel >
                        <br/>
                    </apex:outputPanel>
                </apex:pageBlockSection>

            </apex:pageBlock>
            <apex:pageBlock title="Select Commitments to be Included - (Step 2 of 5)" rendered="{!currentStepName == 'COMMITMENT_SELECTION'}"
                id="capitalCommitementSection">
                <apex:pageMessage summary="There are no Commitments on this fund to select. Please add the commitments and retry." severity="error" strength="3" rendered="{!sizeOfCapitalCommitmentsMap == 0}"/>
                <apex:pageBlockSection collapsible="false" columns="1" rendered="{!NOT(isSuccess)}">
                    <apex:outputPanel >
                        <br/>
                    </apex:outputPanel>
                    <apex:pageBlockTable value="{!mapOfCapitalCommitments[capitalCommitmentCurrentPageNumber]}" var="commitment" id="commitmentsRepeat"  rendered="{!sizeOfCapitalCommitmentsMap != 0}" styleClass="rowsInAlternateColor">
                        <apex:column style="width: 100px">
                            <apex:facet name="header">
                                <a class="selectToggle" href="javascript:void(0);" onclick="toggleSelectAll();">Deselect All</a>
                            </apex:facet>
                            <apex:inputCheckbox value="{!commitment.checked}" />
                        </apex:column>

                        <apex:column style="width: 200px">
                            <apex:facet name="header">Investment Vehicle</apex:facet>
                            <apex:outputField value="{!commitment.record.LP_Entity__r.Name}" />
                        </apex:column>

                        <apex:column style="width: 200px">
                            <apex:facet name="header">Capital Commitment</apex:facet>
                            <apex:outputField value="{!commitment.record.Capital_Commitment__c}" />
                        </apex:column>
                    </apex:pageBlockTable>
                </apex:pageBlockSection>
                <apex:commandButton value="<" rendered="{!NOT(isSuccess)}" rerender="capitalCommitementSection" action="{!previousCapitalCommitmenttList}"
                    disabled="{!prev}" />
                <apex:commandButton value=">" rendered="{!NOT(isSuccess)}" rerender="capitalCommitementSection" action="{!nextCapitalCommitmentList}"
                    disabled="{!nxt}" />
                <apex:outputText value="Showing page {!capitalCommitmentCurrentPageNumber} of {!sizeOfCapitalCommitmentsMap}" />
                <apex:pageBlockButtons location="both">
                    <apex:commandButton action="{!next}" rerender="form" status="searchStatus" onclick="onClickOfCommitementSelectionNext();"
                        id="commitSelNextId" value="Next" rendered="{!NOT(isSuccess) && sizeOfCapitalCommitmentsMap != 0}" />
                    <apex:commandButton value="Cancel" id="commitSelCancelId" action="{!returnToFund}" immediate="true" />
                </apex:pageBlockButtons>
            </apex:pageBlock>

            <!-- Step 2 - Check for $0 Capital Commitments -->
            <apex:pageBlock title="Select Commitments" rendered="{!currentStepName == 'COMMITMENT_CHECK'}" id="capitalCommitmentChkSection">
                <apex:pageMessage summary="Please confirm that the following $0 Capital Commitments should be included." severity="info"
                    strength="3" />
                <apex:pageMessages />
                <apex:pageBlockSection collapsible="false" columns="1">
                    <apex:pageBlockTable rendered="{!If(sizeOfzeroCapitalCommitments!=0,true,false)}" value="{!mapOfCapitalCommitments[listOfPageNumbers[zerocapitalCommitmentCurrentPageNumber]]}"
                        var="commitment" id="commitmentsRepeat" styleClass="rowsInAlternateColor">
                        <apex:column style="width: 100px; display:{!IF(commitment.isZero, 'table-cell','none')};">
                            <apex:facet name="header">
                                <a class="selectToggle" href="javascript:void(0);" onclick="toggleSelectAll();">Deselect All</a>
                            </apex:facet>
                            <apex:inputCheckbox value="{!commitment.checked}" rendered="{!commitment.isZero}" />
                        </apex:column>
                        <apex:column style="width: 300px; display:{!IF(commitment.isZero, 'table-cell','none')};">
                            <apex:facet name="header">Investment Vehicle</apex:facet>
                            <apex:outputField value="{!commitment.record.LP_Entity__r.Name}" rendered="{!commitment.isZero}" />
                        </apex:column>
                        <apex:column style="width: 200px; display:{!IF(commitment.isZero, 'table-cell','none')};">
                            <apex:facet name="header">Capital Commitment</apex:facet>
                            <apex:outputField value="{!commitment.record.Capital_Commitment__c}" rendered="{!commitment.isZero}" />
                        </apex:column>
                    </apex:pageBlockTable>
                </apex:pageBlockSection>
                <apex:commandButton value="<" rendered="{!NOT(isSuccess)}" rerender="capitalCommitmentChkSection" action="{!previousZeroCapitalCommitmenttList}"
                    disabled="{!zeroprev}" />
                <apex:commandButton value=">" rendered="{!NOT(isSuccess)}" rerender="capitalCommitmentChkSection" action="{!nextzeroCapitalCommitmentList}"
                    disabled="{!zeronxt}" />
               <apex:outputText value="Showing page {!listOfPageNumbers[zerocapitalCommitmentCurrentPageNumber]} of {!sizeOfCapitalCommitmentsMap}"
                />
                <apex:pageBlockButtons location="both">
                    <apex:commandButton value="Previous" id="commitChkPreviousId" action="{!previous}" rendered="{!NOT(isSuccess)}" immediate="true"
                    />
                    <apex:commandButton value="Next" id="commitChkNextId" onclick="onClickCommitCheckNxt();" rerender="form" status="searchStatus"
                        action="{!next}" rendered="{!NOT(isSuccess)}" />
                    <apex:commandButton value="Cancel" id="commitChkCancelId" action="{!returnToFund}" immediate="true" />
                </apex:pageBlockButtons>
            </apex:pageBlock>

            <!-- Step 3 - Input -->
            <apex:pageBlock title="{!titleName} - (Step 3 of 5)" id="inputSectionPageBlock" rendered="{!currentStepName == 'INPUT'}">
                <apex:outputPanel id="saveallocsettpopup" > 
                    <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!changedAnyOfTheAllocationsAssigned}"/> 
                    <apex:outputPanel styleClass="custPopupForAllocSett" layout="block" rendered="{!changedAnyOfTheAllocationsAssigned}">
                        <apex:outputText value="Would you like to save these Allocation settings for future Distributions?">
                        </apex:outputText><br/><br/>
                        <apex:actionRegion >
                            <apex:commandButton value="Save Settings" action="{!saveSettings}" rerender="saveallocsettpopup,form"/>  
                            <apex:commandButton value="Continue" action="{!closeAllocSettPopup}" rerender="saveallocsettpopup,form"/> 
                        </apex:actionRegion>
                    </apex:outputPanel>   
                </apex:outputPanel>
                <apex:pageBlockButtons location="top">
                    <apex:commandButton value="Previous" rerender="form" status="searchStatus" id="inputPreviousId" onclick="onClickInputPrevAndNext();"
                        action="{!previous}" rendered="{!NOT(isSuccess)}" immediate="true" />
                    <apex:commandButton value="Next" rerender="form" status="searchStatus" id="inputNextId" onclick="onClickInputPrevAndNext();"
                        action="{!next}" rendered="{!NOT(isSuccess)}" />
                    <apex:commandButton value="Cancel" id="inputCancelId" action="{!returnToFund}" immediate="true" />
                </apex:pageBlockButtons>
                <apex:pageMessages />
                <apex:actionRegion >
                    <apex:actionPoller action="{!setFieldsOnMultipicklist}"  interval="5" reRender="picklistsec,popup,selectedMetaSection" enabled="{!updateFieldset}" ></apex:actionPoller>
                    <apex:pageBlockSection collapsible="false" columns="{!columnSize}" rendered="{!NOT(isSuccess)}" id="picklistsec">
                        <apex:commandButton value="Manage Available Fields" action="{!showPopup}" rerender="picklistsec,popup" status="searchStatus" />
                        <apex:outputText >Note: Click "Manage available fields" to select the fields to be managed in the fieldset.</apex:outputText>
                        <apex:outputPanel rendered="{!updateFieldset}">
                            <div style="position: fixed; top: 0; left: 0; right: 0; bottom: 0; opacity: 0.25; z-index: 1000; background-color: black;">
                                &nbsp;
                            </div>
                            <div style="position: fixed; left: 0; top: 0; bottom: 0; right: 0; z-index: 1001; margin: 15% 50%">
                                <div style="display: inline-block; padding: 2px; background-color: #fff; width: 125px;">
                                    <img src="/img/loading.gif" style="float: left; margin: 8px;" />
                                    <span style="display: inline-block; padding: 10px 0px;">Please Wait...</span>
                                </div>
                            </div>
                        </apex:outputPanel>
                        <apex:outputPanel id="popup" rendered="{!displayPopup}">
                            <apex:outputPanel id="popInnerOutputPnl" styleClass="customPopup" layout="block">
                                <c:MultiselectPicklist leftLabel="Available Metrics" leftOption="{!leftOptions}" rightLabel="Selected Metrics" rightOption="{!rightOptions}" size="10" width="150px" />
                                <div align="center" draggable="false" >
                                    <apex:commandButton value="Update" action="{!updateFieldsOfFieldset}" rerender="inputSectionPageBlock,picklistsec,popup,selectedMetaSection">
                                    </apex:commandButton>
                                    <apex:commandButton value="Close" title="Close the popup" action="{!closePopup}" rerender="picklistsec,popup" >
                                    </apex:commandButton>
                                </div>
                            </apex:outputPanel>
                        </apex:outputPanel>
                    </apex:pageBlockSection>
                </apex:actionRegion>
                    <apex:pageBlockSection columns="{!columnSize}" id="selectedMetaSection">
                    <apex:pageBlockSectionItem rendered="{!selectedDistributionRecordType == 'In-Kind Distribution' || selectedDistributionRecordType =='In-Kind Distribution Traunches'}">
                        <apex:outputText value="In-Kind Type" />
                        <apex:outputText value="{!parent.In_Kind_Type__c}" style="color:blue;font-weight: bold;" />
                    </apex:pageBlockSectionItem>
                    <apex:outputText value="Allocation Type" style="margin-left:20px" rendered="{!enableAllocationFeature && (selectedDistributionRecordType == 'In-Kind Distribution' || selectedDistributionRecordType =='In-Kind Distribution Traunches')}"/>
                    <apex:outputText value="Rounding Type" style="margin-right:20px" rendered="{!enableAllocationFeature && (selectedDistributionRecordType == 'In-Kind Distribution' || selectedDistributionRecordType =='In-Kind Distribution Traunches')}"/>
                    
                    <!-- <apex:pageBlockSection rendered="{!enableAllocationFeature && (selectedDistributionRecordType == 'In-Kind Distribution' || selectedDistributionRecordType =='In-Kind Distribution Traunches')}"></apex:pageBlockSection>-->
                    <apex:pageBlockSectionItem >
                        <apex:outputText value="Commitments" />
                        <apex:outputText value="{0,number,###,##0.00}">
                            <apex:param value="{!TotalCommitment}" />
                        </apex:outputText>
                    </apex:pageBlockSectionItem>
                    <apex:pageBlockSection rendered="{!enableAllocationFeature && (selectedDistributionRecordType == 'In-Kind Distribution' || selectedDistributionRecordType =='In-Kind Distribution Traunches')}"></apex:pageBlockSection>
                    <apex:pageBlockSection rendered="{!enableAllocationFeature && (selectedDistributionRecordType == 'In-Kind Distribution' || selectedDistributionRecordType =='In-Kind Distribution Traunches')}"></apex:pageBlockSection>
                    <apex:outputText value="Allocation Type" style="margin-left:20px" rendered="{!enableAllocationFeature && selectedDistributionRecordType != 'In-Kind Distribution' && selectedDistributionRecordType !='In-Kind Distribution Traunches'}"/>
                    <apex:outputText value="Rounding Type" style="margin-right:50px" rendered="{!enableAllocationFeature && selectedDistributionRecordType != 'In-Kind Distribution' && selectedDistributionRecordType !='In-Kind Distribution Traunches'}"/>
                    <apex:pageBlockSectionItem >
                        <apex:outputText value="Distribution %" />
                        <apex:inputText id="distPercent" value="{!distPercent}" onkeyup="calcAmount()" />
                    </apex:pageBlockSectionItem>
                    <apex:pageBlockSection ></apex:pageBlockSection>
                    <apex:pageBlockSection ></apex:pageBlockSection>  
                    <apex:pageBlockSectionItem >
                        <apex:outputText value="Distribution Amount" />
                        <apex:inputField id="distAmount" value="{!tempDist.Distribution_Amount__c}" onkeyup="calcPercent()" required="{!selectedDistributionRecordType != 'In-Kind Distribution Traunches' && selectedDistributionRecordType != 'In-Kind Distribution'}" />
                    </apex:pageBlockSectionItem>
                    <apex:actionRegion rendered="{!enableAllocationFeature && selectedDistributionRecordType == 'Cash Distribution'}">
                        <apex:selectList id="distAmntFundAllocMap" size="1" value="{!metricToFundAllocMap['Distribution Amount']}" style="margin-left:20px" rendered="{!enableAllocationFeature && selectedDistributionRecordType == 'Cash Distribution'}">
                            <apex:selectOptions value="{!metricToMetricOptionsMap['Distribution Amount']}"/>
                            <apex:actionSupport event="onchange" action="{!assignRoundingTypeToFundAllocationParent}" rerender="roundingTypeForDistributionAmt" />
                        </apex:selectList>
                    </apex:actionRegion>
                    <apex:outputText value="{!roundingTypeToAllocMap['Distribution Amount']}" style="margin-left: 2px" rendered="{!enableAllocationFeature && selectedDistributionRecordType == 'Cash Distribution'}"  id="roundingTypeForDistributionAmt"></apex:outputText>
                    <apex:pageBlockSection rendered="{!enableAllocationFeature && (selectedDistributionRecordType == 'In-Kind Distribution' || selectedDistributionRecordType =='In-Kind Distribution Traunches')}"></apex:pageBlockSection>
                    <apex:pageBlockSection rendered="{!enableAllocationFeature && (selectedDistributionRecordType == 'In-Kind Distribution' || selectedDistributionRecordType =='In-Kind Distribution Traunches')}"></apex:pageBlockSection>
                    <apex:pageBlockSectionItem >
                        <apex:outputText value="Cost Basis" />
                        <apex:inputField id="costBasisVal" value="{!tempDist.Cost_Basis__c}" onkeyup="calcCostPerUnitOnCosBasisInput()" />
                    </apex:pageBlockSectionItem>
                    <apex:pageBlockSection rendered="{!enableAllocationFeature && (selectedDistributionRecordType == 'In-Kind Distribution' || selectedDistributionRecordType =='In-Kind Distribution Traunches')}"></apex:pageBlockSection>
                    <apex:pageBlockSection rendered="{!enableAllocationFeature && (selectedDistributionRecordType == 'In-Kind Distribution' || selectedDistributionRecordType =='In-Kind Distribution Traunches')}"></apex:pageBlockSection>
                    <apex:actionRegion rendered="{!enableAllocationFeature && selectedDistributionRecordType == 'Cash Distribution'}">
                    <apex:selectList id="costBasisFundAllocMap" size="1" value="{!metricToFundAllocMap['Cost Basis']}" style="margin-left:20px" rendered="{!enableAllocationFeature && selectedDistributionRecordType == 'Cash Distribution'}">
                        <apex:selectOptions value="{!metricToMetricOptionsMap['Cost Basis']}"/>
                        <apex:actionSupport event="onchange" action="{!assignRoundingTypeToFundAllocationParent}" rerender="roundingTypeForCostBasis" />
                    </apex:selectList>
                    </apex:actionRegion>
                    <apex:outputText value="{!roundingTypeToAllocMap['Cost Basis']}" style="margin-left: 2px" rendered="{!enableAllocationFeature && selectedDistributionRecordType == 'Cash Distribution'}"  id="roundingTypeForCostBasis"></apex:outputText>

                    <apex:repeat value="{!distFieldSetColumns}" var="f">
                        <apex:pageBlockSectionItem >
                            <apex:outputText value="{!f.label}" />
                            <apex:inputField value="{!tempDist[f.fieldPath]}" required="{!f.required || f.dbrequired}" />
                        </apex:pageBlockSectionItem>
                        <apex:actionRegion rendered="{!enableAllocationFeature}">
                            <apex:selectList id="fundAllocationPicklist" size="1" value="{!metricToFundAllocMap[f.label]}" style="margin-left:20px" rendered="{!enableAllocationFeature}">
                                <apex:selectOptions value="{!metricToMetricOptionsMap[f.label]}"/>
                                <apex:actionSupport event="onchange" action="{!assignRoundingTypeToFundAllocationParent}" rerender="roundingTypeForFieldSets" />
                            </apex:selectList>
                        </apex:actionRegion>
                        <apex:outputText value="{!roundingTypeToAllocMap[f.label]}" style="margin-left: 2px"  rendered="{!enableAllocationFeature}" id="roundingTypeForFieldSets"></apex:outputText>
                    </apex:repeat>
                    <apex:pageBlockSectionItem rendered="{!selectedDistributionRecordType == 'In-Kind Distribution'}">
                        <apex:outputText value="Units Distributed" />
                        <apex:inputField id="unitsDistributed" value="{!tempDist.Units_Distributed__c}" required="true" onkeyup="calcValuesOnNumberOfUnitsInput()"
                        />
                    </apex:pageBlockSectionItem>
                    <apex:actionRegion rendered="{!enableAllocationFeature && selectedDistributionRecordType == 'In-Kind Distribution'}">
                    <apex:selectList id="unitsDistFundAllocMap" size="1" value="{!metricToFundAllocMap['Units Distributed']}" style="margin-left:20px" rendered="{!enableAllocationFeature && selectedDistributionRecordType == 'In-Kind Distribution'}">
                            <apex:selectOptions value="{!metricToMetricOptionsMap['Units Distributed']}"/>
                            <apex:actionSupport event="onchange" action="{!assignRoundingTypeToFundAllocationParent}" rerender="roundingTypeForUnitsDistributions" />
                    </apex:selectList>
                    </apex:actionRegion>
                    <apex:outputText value="{!roundingTypeToAllocMap['Units Distributed']}" style="margin-left: 2px" rendered="{!enableAllocationFeature && selectedDistributionRecordType == 'In-Kind Distribution'}" id="roundingTypeForUnitsDistributions"></apex:outputText>

                    <apex:pageBlockSectionItem rendered="{!selectedDistributionRecordType == 'In-Kind Distribution'}">
                        <apex:outputText value="Cost Per Unit" />
                        <apex:inputField id="costPerUnit" value="{!parent.Cost_Per_Unit__c}" onkeyup="calcCostBasis()" />
                    </apex:pageBlockSectionItem>
                    <apex:pageBlockSection rendered="{!selectedDistributionRecordType == 'In-Kind Distribution'}"></apex:pageBlockSection>
                    <apex:pageBlockSection rendered="{!selectedDistributionRecordType == 'In-Kind Distribution'}"></apex:pageBlockSection>
                    <apex:pageBlockSectionItem rendered="{!selectedDistributionRecordType == 'In-Kind Distribution'}">
                        <apex:outputText value="Purchase Date" />
                        <apex:inputField value="{!parent.Purchase_Date__c}" />
                    </apex:pageBlockSectionItem>
                    <apex:pageBlockSection rendered="{!selectedDistributionRecordType == 'In-Kind Distribution'}"></apex:pageBlockSection>
                    <apex:pageBlockSection rendered="{!selectedDistributionRecordType == 'In-Kind Distribution'}"></apex:pageBlockSection>
                    <apex:pageBlockSectionItem rendered="{!selectedDistributionRecordType == 'In-Kind Distribution' || selectedDistributionRecordType =='In-Kind Distribution Traunches'}">
                        <apex:outputText value="Value Per Unit" />
                        <apex:inputField id="valuePerUnit" value="{!parent.Value_Per_Unit__c}" onkeyup="calcPercentAndDistAmount()" />
                    </apex:pageBlockSectionItem>
                    <apex:pageBlockSection rendered="{!selectedDistributionRecordType == 'In-Kind Distribution' || selectedDistributionRecordType =='In-Kind Distribution Traunches'}"></apex:pageBlockSection>
                    <apex:pageBlockSection rendered="{!selectedDistributionRecordType == 'In-Kind Distribution' || selectedDistributionRecordType =='In-Kind Distribution Traunches'}"></apex:pageBlockSection>
                    <apex:pageBlockSectionItem rendered="{!selectedDistributionRecordType == 'In-Kind Distribution' || selectedDistributionRecordType =='In-Kind Distribution Traunches'}">
                        <apex:outputText value="Value Per Unit as of Date" />
                        <apex:inputField value="{!parent.Value_Per_Unit_as_of_Date__c}" />
                    </apex:pageBlockSectionItem>
                    <apex:pageBlockSection rendered="{!selectedDistributionRecordType == 'In-Kind Distribution' || selectedDistributionRecordType =='In-Kind Distribution Traunches'}"></apex:pageBlockSection>
                    <apex:pageBlockSection rendered="{!selectedDistributionRecordType == 'In-Kind Distribution' || selectedDistributionRecordType =='In-Kind Distribution Traunches'}"></apex:pageBlockSection>
                    <apex:pageBlockSectionItem >
                        <apex:outputText value="Distribution Date" />
                        <apex:inputField value="{!tempDist.Distribution_Date__c}" required="true" />
                    </apex:pageBlockSectionItem>
                    <apex:pageBlockSection ></apex:pageBlockSection>
                    <apex:pageBlockSection ></apex:pageBlockSection>
                    <apex:pageBlockSectionItem >
                        <apex:outputText value="Save As Draft (Hide from Portal)"/>
                        <apex:inputCheckbox value="{!parent.Hide_From_Portal__c}"/>																		 
                	</apex:pageBlockSectionItem>
                    <apex:pageBlockSection ></apex:pageBlockSection>
                    <apex:pageBlockSection ></apex:pageBlockSection>
                    <apex:pageBlockSectionItem rendered="{!enableAllocationFeature}">
                        <apex:outputLabel value="Calculate using default ProRata Calculation" />
                      <!--   <apex:actionRegion> -->
                        <apex:inputCheckbox value="{!defaultProRataFlag}">
                            <apex:actionSupport event="onchange" action="{!setDefaultCalculationToMap}" rerender="inputSectionPageBlock" oncomplete="disableOrEnableFundAllocationPicklist(this)" ></apex:actionSupport>
                        </apex:inputCheckbox>
                       <!--  </apex:actionRegion> -->
                    </apex:pageBlockSectionItem>
                </apex:pageBlockSection>
            </apex:pageBlock>

            <apex:pageBlock title="Traunches - (Step 4 of 5)" rendered="{!currentStepName == 'INPUT' &&  selectedDistributionRecordType == 'In-Kind Distribution Traunches'}">
                <apex:pageBlockSection collapsible="false" columns="3" rendered="{!NOT(isSuccess)}">
                    <apex:pageBlockSectionItem rendered="{!enableAllocationFeature && selectedDistributionRecordType =='In-Kind Distribution Traunches'}">
                        <apex:outputText style="font-weight:bold;font-size:110%;padding-left:1%" value="Allocation for Traunch Units Distributed" />
                        <!--apex:outputText value="{!parent.In_Kind_Type__c}" style="color:blue;font-weight: bold;" /-->
                    </apex:pageBlockSectionItem>
                    <apex:actionRegion rendered="{!enableAllocationFeature && selectedDistributionRecordType == 'In-Kind Distribution Traunches'}">
                    <apex:selectList id="unitsDistFundAllocMap2" size="1" value="{!metricToFundAllocMap['Units Distributed']}"  style="margin-left: 240px;"  rendered="{!enableAllocationFeature && selectedDistributionRecordType == 'In-Kind Distribution Traunches'}">
                            <apex:selectOptions value="{!metricToMetricOptionsMap['Units Distributed']}"/>
                            <apex:actionSupport event="onchange" action="{!assignRoundingTypeToFundAllocationParent}" rerender="roundingTypeForUnitsDistributionsTraunches" />
                    </apex:selectList>
                    </apex:actionRegion>
                    <apex:outputText value="{!roundingTypeToAllocMap['Units Distributed']}" style="margin-left:216px;" rendered="{!enableAllocationFeature && selectedDistributionRecordType == 'In-Kind Distribution Traunches'}" id="roundingTypeForUnitsDistributionsTraunches"></apex:outputText>
                    <apex:outputPanel rendered="{!enableAllocationFeature && selectedDistributionRecordType == 'In-Kind Distribution Traunches'}">
                            <apex:pageBlockSectionItem >
                                <div style="width:120%; height:1px; background:black;"></div>
                            </apex:pageBlockSectionItem>
                            <!--apex:pageBlockSectionItem >
                                <div style="width:120%; height:1px; background:black;"></div>
                            </apex:pageBlockSectionItem-->
                    </apex:outputPanel>
                    <apex:outputPanel rendered="{!enableAllocationFeature && selectedDistributionRecordType == 'In-Kind Distribution Traunches'}">
                            <apex:pageBlockSectionItem >
                                <div style="width:120%; height:1px; background:black;"></div>
                            </apex:pageBlockSectionItem>
                    </apex:outputPanel>
                    <apex:outputPanel rendered="{!enableAllocationFeature && selectedDistributionRecordType == 'In-Kind Distribution Traunches'}">
                            <apex:pageBlockSectionItem >
                                <div style="width:100%; height:1px; background:black;"></div>
                            </apex:pageBlockSectionItem>
                            <!--apex:pageBlockSectionItem >
                                <div style="width:100%; height:1px; background:black;"></div>
                            </apex:pageBlockSectionItem-->
                    </apex:outputPanel>
                </apex:pageBlockSection>
                <apex:pageBlockSection collapsible="false" columns="4" rendered="{!IF(selectedDistributionRecordType == 'In-Kind Distribution Traunches',true,false)}">
                    <apex:repeat value="{!TraunchCount}" var="f">
                        <apex:pageBlockSectionItem dataStyle="width: 6%;" labelStyle="width: 6%;font-size: 115%;text-decoration:underline;">
                            <apex:outputText value="Traunch {!f+1}" />
                            <apex:outputText value=" " rendered="false" />
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem dataStyle="width: 6%;" labelStyle="width: 6%;">
                            <apex:outputText value="{!fieldSetForTraunchUnitsDistributed[f].label}" />
                            <apex:inputField value="{!tempDist[fieldSetForTraunchUnitsDistributed[f].fieldPath]}" required="true" onkeyup="InputUnitsInGrouping()"
                            />
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem dataStyle="width: 6%;" labelStyle="width: 6%;">
                            <apex:outputText value="{!fieldSetForTraunchCostPerUnit[f].label}" />
                            <apex:inputField value="{!parent[fieldSetForTraunchCostPerUnit[f].fieldPath]}" required="true" />
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem dataStyle="width: 6%;" labelStyle="width: 6%;">
                            <apex:outputText value="{!fieldSetForTraunchPurchaseDate[f].label}" />
                            <apex:inputField value="{!parent[fieldSetForTraunchPurchaseDate[f].fieldPath]}" required="true" />
                        </apex:pageBlockSectionItem>
                        <apex:outputPanel rendered="{!f != TraunchCount.size - 1}">
                            <apex:pageBlockSectionItem >
                                <div style="width:120%; height:1px; background:black;"></div>
                            </apex:pageBlockSectionItem>
                        </apex:outputPanel>
                        <apex:outputPanel rendered="{!f != TraunchCount.size - 1}">
                            <apex:pageBlockSectionItem >
                                <div style="width:120%; height:1px; background:black;"></div>
                            </apex:pageBlockSectionItem>
                        </apex:outputPanel>
                        <apex:outputPanel rendered="{!f != TraunchCount.size - 1}">
                            <apex:pageBlockSectionItem >
                                <div style="width:120%; height:1px; background:black;"></div>
                            </apex:pageBlockSectionItem>
                        </apex:outputPanel>
                        <apex:outputPanel rendered="{!f != TraunchCount.size - 1}">
                            <apex:pageBlockSectionItem >
                                <div style="width:100%; height:1px; background:black;"></div>
                            </apex:pageBlockSectionItem>
                        </apex:outputPanel>
                    </apex:repeat>
                </apex:pageBlockSection>
            </apex:pageBlock>
            <apex:pageBlock rendered="{!currentStepName == 'INPUT'}">
                <apex:pageBlockButtons location="bottom">
                    <apex:commandButton value="Previous" rerender="form" status="searchStatus" id="inputPreviousId" onclick="onClickInputPrevAndNext();"
                        action="{!previous}" rendered="{!NOT(isSuccess)}" immediate="true" />
                    <apex:commandButton value="Next" rerender="form" status="searchStatus" id="inputNextId" onclick="onClickInputPrevAndNext();"
                        action="{!next}" rendered="{!NOT(isSuccess)}" />
                    <apex:commandButton value="Cancel" id="inputCancelId" action="{!returnToFund}" immediate="true" />
                </apex:pageBlockButtons>
            </apex:pageBlock>

            <!-- Step 4 - Review -->
            <apex:pageBlock title="{!titleName}" rendered="{!currentStepName == 'REVIEW'}">
                <apex:pageBlockButtons location="top">
                    <div style="width:50%; float: right;">
                        <apex:outputText value="Do Not Create Blank Records" rendered="{!NOT(isSuccess)}"/>
                        <apex:inputCheckbox id="isCheckedZeroCapCommitmentTopId" value="{!isNullOrZeroCapCommitmentCheckbox}" onclick="showSpinner('isCheckedZeroCapCommitmentTopId');" rendered="{!NOT(isSuccess)}" immediate="true">
                        </apex:inputCheckbox>
                    </div>
                    <apex:commandButton value="Previous" action="{!previous}" rendered="{!NOT(isSuccess)}" immediate="true" />
                    <apex:commandButton value="Confirm & Save" id="confirmAndSaveId" onclick="showSpinner('confirmAndSaveId');" rendered="{!NOT(isSuccess)}"
                    />
                    <apex:actionFunction name="confirmAndSaveFun" action="{!confirmAndSave}" />
                    <apex:commandButton value="Cancel" action="{!returnToFund}" rendered="{!NOT(isSuccess)}" immediate="true" />
                    <apex:commandButton value="Return To Fund" action="{!returnToFund}" rendered="{!isSuccess}" immediate="true" />
                </apex:pageBlockButtons>                
                <apex:outputPanel id="progress">
                    <apex:actionPoller action="{!executionStatusOfBatch}" interval="5" reRender="progress,message,status,showBatchDetails,spinner,abortedpanel"
                        enabled="{!OR(batchProcessingRequest== 'Holding',batchProcessingRequest == 'Preparing',batchProcessingRequest=='Queued',batchProcessingRequest== 'Processing Started',batchProcessingRequest== 'Processing')}"></apex:actionPoller>
                </apex:outputPanel>
                <apex:outputPanel rendered="{!OR(batchProcessingRequest== 'Holding',batchProcessingRequest == 'Preparing',batchProcessingRequest=='Queued',batchProcessingRequest== 'Processing Started',batchProcessingRequest== 'Processing',batchProcessingRequest == 'Completed',batchProcessingRequest== 'Aborted',batchProcessingRequest== 'Failed')}"
                    id="message">
                    <apex:pageMessages ></apex:pageMessages>
                    <apex:outputPanel rendered="{!batchProcessingRequest== 'Failed'}">
                        <apex:pageBlockSection >
                            <apex:outputText label="Number of errors" value="{!BatchNumberOfErrors}"></apex:outputText>
                            <apex:outputText label="Failure Message" value="{!BatchFailureMessage}"></apex:outputText>
                        </apex:pageBlockSection>
                    </apex:outputPanel>
                </apex:outputPanel>
                <apex:outputPanel rendered="{!OR(batchProcessingRequest== 'Holding',batchProcessingRequest == 'Preparing',batchProcessingRequest=='Queued',batchProcessingRequest== 'Processing Started',batchProcessingRequest== 'Processing',batchProcessingRequest == 'Completed',batchProcessingRequest== 'Aborted',batchProcessingRequest== 'Failed')}"
                    id="status">
                    <apex:pageBlockSection columns="2">
                        <apex:outputField label="Distribution Insertion Status" value="{!parent.Distributions_Update_Status__c}" />
                        <apex:image value="/img/loading.gif" id="spinner" style="float: left; margin: -2px;margin-left: -250px;" rendered="{!OR(batchProcessingRequest== 'Holding',batchProcessingRequest == 'Preparing',batchProcessingRequest=='Queued',batchProcessingRequest== 'Processing Started',batchProcessingRequest== 'Processing')}"
                        />
                    </apex:pageBlockSection>
                    <apex:pageBlockSection columns="1">
                        <apex:outputText label="Total Success" value="{!TotalNumberOfDistributionsProccessed}"></apex:outputText>
                        <apex:outputText label="Total Errors" value="{!TotalNumberOfDistributionsFailed}"></apex:outputText>
                    </apex:pageBlockSection>
                </apex:outputPanel>
                <apex:outputPanel rendered="{!OR(batchProcessingRequest== 'Holding',batchProcessingRequest == 'Preparing',batchProcessingRequest=='Queued',batchProcessingRequest== 'Processing Started',batchProcessingRequest== 'Processing',batchProcessingRequest == 'Completed',batchProcessingRequest== 'Aborted',batchProcessingRequest== 'Failed')}"
                    id="showBatchDetails">
                    <apex:outputPanel rendered="{! AND(OR(batchProcessingRequest == 'Processing',batchProcessingRequest == 'Completed',batchProcessingRequest== 'Aborted',batchProcessingRequest== 'Failed'),OR(failedCapitalCommId.size > 0,distributionsSuccess.size > 0))}">
                        <apex:pageBlock title="Distribution Summary" id="distributionSummarySection">
                            <apex:pageBlockSection >
                                <apex:outputPanel rendered="{!batchProcessingRequest=='Completed'}">
                                    <apex:outputText value="Distribution Parent :" styleClass="parentIDFont"></apex:outputText>
                                    <apex:outputLink value="/{!parent.Id}">{!parent.Name}</apex:outputLink>
                                </apex:outputPanel>
                            </apex:pageBlockSection>
                            <apex:pageBlockSection rendered="{!failedCapitalCommId.size > 0}" title="Distributions Failed For The Following Commitments ({!failedCapitalCommId.size})"
                                columns="1" collapsible="true">
                                <apex:pageBlockTable value="{!mapOfFailureCapitalCommitments[failureCapitalCommitCurrentPageNumber]}" var="failedCommId" styleClass="rowsInAlternateColor">
                                    <apex:column headerValue="">
                                        <apex:image value="/img/msg_icons/error16.png" style="vertical-align:middle" />
                                    </apex:column>
                                    <apex:column headerValue="Capital Commitment Id">
                                        <apex:outputLink value="/{!failedCommId.Id}">{!failedCommId.Name}</apex:outputLink>
                                    </apex:column>
                                </apex:pageBlockTable>
                            </apex:pageBlockSection>
                            <apex:commandButton value="<" rendered="{!failedCapitalCommId.size > 0}" rerender="distributionSummarySection" action="{!previoustDistributionFailureList}"
                                disabled="{!distributionsfailureprev}" immediate="true" />
                            <apex:commandButton value=">" rendered="{!failedCapitalCommId.size > 0}" rerender="distributionSummarySection" action="{!nexttDistributionFailureList}"
                                disabled="{!distributionsfailurenxt}" immediate="true" />
                            <apex:outputText value="Showing page {!failureCapitalCommitCurrentPageNumber} of {!sizeOfFailureCapitalCommitMap}" rendered="{!failedCapitalCommId.size > 0}"
                            />
                            <apex:pageBlockSection rendered="{!distributionsSuccess.size > 0}" title="Distributions Success ({!TotalNumberOfDistributionsProccessed})"
                                columns="1" collapsible="true">
                                <apex:pageBlockTable value="{!mapofdistributionSuccess[distributionsSuccessCurrentPageNumber]}" var="dist" styleClass="rowsInAlternateColor">
                                    <apex:column headerValue="">
                                        <apex:image value="/img/msg_icons/confirm16.png" style="vertical-align:middle" />
                                    </apex:column>
                                    <apex:column headerValue="Distribution">
                                        <apex:outputLink value="/{!dist.Id}">{!dist.Name}</apex:outputLink>
                                    </apex:column>
                                    <apex:column headerValue="Investment Vehicle">
                                        <apex:outputLink value="/{!dist.LP_Entity__c}">{!dist.LP_Entity__r.Name}</apex:outputLink>
                                    </apex:column>
                                </apex:pageBlockTable>
                            </apex:pageBlockSection>
                            <apex:commandButton value="<" rendered="{!sizeOfdistributionSuccesssMap > 0}" rerender="distributionSummarySection" action="{!previousDistributionSuccessList}"
                                disabled="{!distributionssuccessprev}" immediate="true" />
                            <apex:commandButton value=">" rendered="{!sizeOfdistributionSuccesssMap > 0}" rerender="distributionSummarySection" action="{!nextDistributionSuccessList}"
                                disabled="{!distributionssuccessnxt}" immediate="true" />
                            <apex:outputText value="Showing page {!distributionsSuccessCurrentPageNumber} of {!sizeOfdistributionSuccesssMap}" rendered="{!sizeOfdistributionSuccesssMap > 0}"
                            />
                        </apex:pageBlock>
                    </apex:outputPanel>
                </apex:outputPanel>
                <apex:outputPanel rendered="{!NOT(isSuccess)}">
                    <center>
                        <div id="loading" style="display:none">
                            <div style="position: fixed; top: 0; left: 0; right: 0; bottom: 0; opacity: 0.25; z-index: 1000; background-color: black;">
                                &nbsp;
                            </div>
                            <div style="position: fixed; left: 0; top: 0; bottom: 0; right: 0; z-index: 1001; margin: 15% 50%">
                                <div style="display: inline-block; padding: 2px; background-color: #fff; width: 125px;">
                                    <img src="/img/loading.gif" style="float: left; margin: 8px;" />
                                    <span style="display: inline-block; padding: 10px 0px;">Please Wait...</span>
                                </div>
                            </div>
                        </div>
                        <div style="width:50%;">
                            <apex:outputLink value="{!templateUrl}" target="_blank" rel="noopener" styleClass="btn" style="text-decoration: none; padding: 4px;"
                                type="text/csv" rendered="{!NOT(highCapComtmntsFlag)}">
                                <i class="fa fa-download"></i> Export Template</apex:outputLink>
                            <apex:inputFile id="chooseFileId" value="{!fileBody}" />
                            <apex:commandButton onclick="showSpinner('processCSVId');" id="processCSVId" value="Process CSV" />
                            <apex:actionFunction name="callProcessCSV" action="{!processCSV}"></apex:actionFunction>
                        </div>
                    </center>
                </apex:outputPanel>
                <apex:pageBlockSection collapsible="false" columns="1" rendered="{!NOT(isSuccess)}">
                    <apex:outputPanel rendered="{!highCapComtmntsFlag}">
                        <table id="distributionTable" class="distributionTable" style="margin-left:0px;width:95%;">
                            <thead>
                                <tr class="headerRow">
                                    <th style="width:35%">Investment Vehicle</th>
                                    <th style="width:25%">Distribution Amount</th>
                                    <th>Cost Basis</th>
                                    <apex:repeat value="{!distReviewFieldSetColumnsString}" var="drf">
                                        <th>
                                            <apex:outputText value="{!fieldAPItoLabelMap[drf]}" />
                                        </th>
                                    </apex:repeat>
                                    <th style="width:50%">Distribution Date</th>
                                </tr>
                            </thead>
                            <tbody>
                                <apex:repeat value="{!mapOfDistributions}" var="mapvar">
                                    <apex:repeat value="{!mapOfDistributions[mapvar]}" var="distribution">
                                        <tr class="linkRow">
                                            <td style="width:35%">
                                                <apex:outputText value="{!distribution.entityName}" />
                                            </td>
                                            <td style="width:25%">
                                                <apex:outputText value="{!distribution.record.Distribution_Amount__c}" />
                                            </td>
                                            <td>
                                                <apex:outputText value="{!distribution.record.Cost_Basis__c}" />
                                            </td>
                                            <apex:repeat value="{!distReviewFieldSetColumnsString}" var="drf">
                                                <td>
                                                    <apex:outputText value="{!distribution.record[drf]}" />
                                                </td>
                                            </apex:repeat>
                                            <td>
                                                <apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
                                                    <apex:param value="{!distribution.record.Distribution_Date__c}" />
                                                </apex:outputText>
                                            </td>
                                        </tr>
                                    </apex:repeat>
                                </apex:repeat>
                            </tbody>
                        </table>
                    </apex:outputPanel>
                    <apex:pageBlockTable value="{!newDistributions}" var="d" rendered="{!NOT(highCapComtmntsFlag)}" styleClass="rowsInAlternateColor">
                        <apex:column styleClass="{!mapOfStyles[d.entityName]}">
                            <apex:facet name="header">Investment Vehicle</apex:facet>
                            {!d.entityName}
                        </apex:column>
                        <apex:column styleClass="{!mapOfStyles[d.entityName]}">
                            <apex:facet name="header">Distribution Amount</apex:facet>
                            <apex:inputField value="{!d.record.Distribution_Amount__c}" />
                        </apex:column>
                        <apex:column styleClass="{!mapOfStyles[d.entityName]}">
                            <apex:facet name="header">Cost Basis</apex:facet>
                            <apex:inputField value="{!d.record.Cost_Basis__c}" />
                        </apex:column>
                        <apex:repeat value="{!distReviewFieldSetColumnsString}" var="drf">
                            <apex:column styleClass="{!mapOfStyles[d.entityName]}">
                                <apex:facet name="header">{!fieldAPItoLabelMap[drf]}</apex:facet>
                                <apex:inputField value="{!d.record[drf]}" />
                            </apex:column>
                        </apex:repeat>
                        <apex:column styleClass="{!mapOfStyles[d.entityName]}" value="{!d.record.Distribution_Date__c}" />
                    </apex:pageBlockTable>
                </apex:pageBlockSection>
                <apex:pageBlockButtons location="bottom">
                    <div style="width:50%; float: right;">
                        <apex:outputText value="Do Not Create Blank Records" rendered="{!NOT(isSuccess)}"/>
                        <apex:inputCheckbox id="isCheckedZeroCapCommitmentBottomId" value="{!isNullOrZeroCapCommitmentCheckbox}" onclick="showSpinner('isCheckedZeroCapCommitmentBottomId');" rendered="{!NOT(isSuccess)}">
                        </apex:inputCheckbox>
                    </div>
                    <apex:commandButton value="Previous" action="{!previous}" rendered="{!NOT(isSuccess)}" immediate="true" />
                    <apex:commandButton value="Confirm & Save" id="confirmAndSaveBottomId" onclick="showSpinner('confirmAndSaveBottomId');" rendered="{!NOT(isSuccess)}"
                    />
                    <apex:actionFunction name="confirmAndSaveFun" action="{!confirmAndSave}" />
                    <apex:commandButton value="Cancel" action="{!returnToFund}" rendered="{!NOT(isSuccess)}" immediate="true" />
                    <apex:commandButton value="Return To Fund" action="{!returnToFund}" rendered="{!isSuccess}" immediate="true" />
                </apex:pageBlockButtons>
            </apex:pageBlock>
        </apex:outputPanel>
    </apex:form>
</apex:page>