403Webshell
Server IP : 103.234.187.230  /  Your IP : 216.73.216.216
Web Server : Apache
System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/b2bzend/application/views/scripts/leaddetail/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/b2bzend/application/views/scripts/leaddetail/proposal.phtml
<?php //1: Flight , 2:Hotel , 3: Flight + Hotel,4:Insurance,5:Package,6:Visa,7:Forex,8:Activity,9:SightSeeing,10:Miscellanious
echo $this->partial('leaddetail/leaddetailpartial.phtml', array('pageName' => 'Proposal List', 'customerDetail' => $this->customerDetail, 'leadId' => $this->leadId, 'leadDetail' => $this->leadDetail[0], 'sourceCity' => $this->sourceCity, 'customerId' => $this->customerId, 'proposalCount' => $this->proposalCount, 'packageThemeList' => $this->packageThemeList, 'packageFoodPreferenceList' => $this->packageFoodPreferenceList, 'packageInclList' => $this->packageInclList));
$flightproposal  = $this->flightproposal;
$hotelproposal  = $this->hotelproposal;
$record = $this->paginator;
$totalrec = $this->proposalCount;
$customhelper = Zend_Controller_Action_HelperBroker::getStaticHelper('Custom');
$travelPlanStatusName = $customhelper->GetTravelPlanStatusArray(2, '');
//$helperInstance =  $this->getHelper("proposals");
//echo '<pre>';print_r($record);die;
?>
<!-- end of common data ---->
<div class="col-md-12">
    <div class="query_listing_bg query_listing_bg_padding_20">
        <div class="panel-body table-responsive no-padding no-border">
            <!--        <h1 class="no-margin" style="margin-bottom:15px;">Proposals </h1>-->
            <div class="panel-heading title_padding">
                <h3 class="panel-title">Proposals</h3>
            </div>
            <div class="panel-body whbg col-md-12 table-responsive no-padding">

                <table class="table tablestyle sortable-theme-bootstrap" data-sortable>
                    <thead>
                        <tr class="alert alert-graylight">
                            <th data-sortable="true" data-sorted="true" data-sorted-direction="descending" class="small smallbold" style="vertical-align:top;">Proposal ID </th>
                            <th data-sortable="true" data-sorted="true" data-sorted-direction="descending" class="small smallbold" style="vertical-align:top;">Sent On</th>
                            <th data-sortable="true" data-sorted="true" data-sorted-direction="descending" class="small smallbold" style="vertical-align:top;">Travel Date</th>
                            <th data-sortable="true" data-sorted="true" data-sorted-direction="descending" class="small smallbold" style="vertical-align:top;">Type/ Source</th>
                            <th data-sortable="true" data-sorted="true" data-sorted-direction="descending" class="small smallbold" style="vertical-align:top;">Destination</th>
                             
                            <th data-sortable="true" data-sorted="true" data-sorted-direction="descending" class="small smallbold" style="vertical-align:top;">My Cost</th>
                            <th data-sortable="true" data-sorted="true" data-sorted-direction="descending" class="small smallbold" style="vertical-align:top;">Offer Price</th>
                            <th data-sortable="true" data-sorted="true" data-sorted-direction="descending" class="small smallbold" style="vertical-align:top;">Sent To</th>
                            <th data-sortable="true" data-sorted="true" data-sorted-direction="descending" class="small smallbold" style="vertical-align:top;">Stage</th>
                            <th data-sortable="true" data-sorted="true" data-sorted-direction="descending" class="small smallbold" style="vertical-align:top;">Last updated</th>
                            <th data-sortable="false" class="small smallbold" style="vertical-align:top;">Response</th>
                            <th data-sortable="false" class="small smallbold" style="vertical-align:top;">Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td colspan="10" class="small">&nbsp;</td>
                            <td class="small" style="white-space:nowrap; text-align:center;" align="center">M</td>
                            <td class="small" style="white-space:nowrap; text-align:center;display:none;" align="center">C</td>
                            <td class="small" style="white-space:nowrap;">&nbsp;</td>
                        </tr>
                        <?php
                        $objTravelModel = new Travel_Model_CRM_CustomerTravelPlan();
                        if ($this->leadDetail[0]['PlanType'] == 1) { // for flight 
                            $h = 0;
                            foreach ($record as $flightproposal) {
                                $proposalID = 'D/' . date('y') . '/' . $flightproposal['TPSysId'];
                                //$suppliercount = $helperInstance->suppliers($flightproposal['TPSysId']);
                                $suppliercount = array();
                                $totalsupplier = $suppliercount ? count($suppliercount) : 0;
                                $suppIds = array();
                                if (!empty($suppliercount)) {
                                    foreach ($suppliercount as $k => $v) {
                                        $suppIds[] = $v['SupplierSysId'];
                                    }
                                }
                                $allSuppIds = implode(",", $suppIds);
                                $chatDetails = $objTravelModel->GetCustomerChatHistoryDetailsById($flightproposal['TPSysId']);
                                $returndate = '';
                                $departuredate = '';
                                $paxTOtalArr = json_decode($flightproposal['RoomInfoJson']);

                                if (!empty($paxTOtalArr)) {
                                    foreach ($paxTOtalArr as $PaxTotal) {
                                        $departuredate = @$PaxTotal->departuredate;
                                        $returndate = trim(@$PaxTotal->returndate);
                                    }
                                }
                                //echo '<pre>';print_r($flightproposal);
                                $currencySymbol = $customhelper->GetCurrencyByCurrencyType($flightproposal['CurrencyType']);
                                $LocalToTime = ($flightproposal['returnDate']->format('Y') != '1900') ? " - " . $flightproposal['returnDate']->format('d-M-y H:i:s') : '';
                                $uid = $hotelproposal['CustomerSysId'] . ':' . $hotelproposal['TPSysId'] . ':' . $hotelproposal['MasterTPSysId'];
                                $secureCode =  Zend_Controller_Action_HelperBroker::getStaticHelper('SecureCode')->secureCode(base64_encode($hotelproposal['TPSysId']), 1);
                                $display = 'unique:yes';
                                $uid = $this->controller->getEnc($uid);
                                $display = $this->controller->getEnc($display);
                        ?>
                                <tr>
                                    <td class="small"><?php echo $proposalID; ?></td>
                                    <td class="small"><?php echo $flightproposal['CreateDate'] ? $flightproposal['CreateDate']->format('d-M-y') : ''; ?></td>
                                    <td class="small"><?php echo $flightproposal['Departuredate']->format('d-M-y H:i:s') . $LocalToTime; ?> </td>
                                    <td class="small">Flight</td>
                                    <td class="small"><?php echo $flightproposal['Cities'] ? $flightproposal['Cities'] : 'NA'; ?></td>
                                     
                                    <td class="small" style="white-space:nowrap; text-align:center;"><?php echo $currencySymbol['Symbol']; ?> <?php echo $flightproposal['TotalCost'] ? $flightproposal['TotalCost'] - ($flightproposal['MarkUp'] + $flightproposal['AgentsCustomServiceTaxAmount'] + $flightproposal['AgencyMarkUp'] + $flightproposal['AgentServiceTaxAmount'] + $flightproposal['AgencyCommission']) : 0; ?></td>
                                    <td class="small" style="white-space:nowrap; text-align:center;"><?php echo $currencySymbol['Symbol']; ?> <?php echo $flightproposal['TotalCost'] ? $flightproposal['TotalCost'] : 0; ?> </td>
                                    <td class="small"><?php echo $flightproposal['ProposalEmailTo'] ? $flightproposal['ProposalEmailTo'] : 'NA'; ?><br />
                                        <a href="<?php echo $this->baseUrl('/leaddetail/view-sent-proposal-email/proposalId/' . base64_encode($flightproposal['TPSysId'])); ?>" data-target="#viewsentproposalemail" data-toggle="modal">View Email</a>
                                    </td>
                                    <td class="small"><span id="status_<?php echo $h; ?>" class="proposalStatus">
                                            <?php echo $travelPlanStatusName[$flightproposal['StatusType']]['TPStatus']; ?>
                                            <?php
                                            $LocalToTime = strtotime($flightproposal['returnDate']->format('Y-m-d'));
                                            $curdate = strtotime(date('Y-m-d'));
                                            // echo $curdate."/".$hotelFromDate;
                                            if ($curdate > $LocalToTime) {
                                                $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($flightproposal['StatusType'], 1, 'flight', 2, 21);
                                            } else {
                                                $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($flightproposal['StatusType'], '', 'flight', 2, 21);
                                            }
                                            /*
                                                    $key_iteration_status = array_search( 8 , array_column( $allStatusDisplayArrayById , 'ComponentType')); // search if iteration exists in array
                                                    if( $key_iteration_status ) {
                                                        ?>
                                                    <br/><a click-src="itinerary" href="javascript:void(0);" title="Add Iteration/Follow Up" class="" style="color: #9EDA9E"
                                                       onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($flightproposal['TPSysId']); ?>',<?php echo $h; ?>,'flight_<?php echo $flightproposal['TPSysId']; ?>',<?php echo $flightproposal['MasterTPSysId']; ?>,<?php echo $flightproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
                    '<?php echo $proposalID ?>', '<?php echo trim($flightproposal['CustomerSysId']); ?>', '<?php echo trim($flightproposal['ownerName']); ?>' , '<?php echo $flightproposal['AgentSysId']; ?>',this);" >Add Iteration/Follow Up
                                                    </a>
                                                    <?php
                                                    }
                                                    */

                                            $openAddModalToDo = "actionChangeProposalStatusAddIteration('" . base64_encode($flightproposal['TPSysId']) . "',$h,'flight_" . $flightproposal['TPSysId'] . "'," . $flightproposal['MasterTPSysId'] . "," . $flightproposal['CustomerSysId'] . ",'" . base64_encode(27) . "','$proposalID', '" . trim($flightproposal['CustomerSysId']) . "','" . trim($flightproposal['ownerName']) . "','" . $flightproposal['AgentSysId'] . "',this)";

                                            if ($flightproposal['hasIteration']) {
                                            ?>
                                                <br /><a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getItineraryRequired('<?php echo $flightproposal['CustomerSysId']; ?>','<?php echo $flightproposal['TPSysId']; ?>', $(this).attr('func') );" title="View changes required list" style="color:#0e931d;" CustomerMasterTPSysId="<?php echo $leadlist['CustomerSysId']; ?>_<?php echo $leadlist['TPSysId']; ?>">
                                                    Changes
                                                </a>
                                            <?php
                                            } else {
                                            ?>
                                                <br /> <a click-src="itinerary" href="javascript:void(0);" title="Add Changes" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($flightproposal['TPSysId']); ?>',<?php echo $h; ?>,'flight_<?php echo $flightproposal['TPSysId']; ?>',<?php echo $flightproposal['MasterTPSysId']; ?>,<?php echo $flightproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
                                                                               '<?php echo $proposalID ?>', '<?php echo trim($flightproposal['CustomerSysId']); ?>', '<?php echo trim($flightproposal['ownerName']); ?>' , '<?php echo $flightproposal['AgentSysId']; ?>',this);" CustomerMasterTPSysId="<?php echo $leadlist['CustomerSysId']; ?>_<?php echo $leadlist['TPSysId']; ?>"><i class="fa fa-plus"></i> Changes
                                                </a>
                                            <?php
                                            }
                                            echo ' | ';
                                            if ($flightproposal['hasFollowUp']) {
                                            ?>
                                                <a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getFollowUp('<?php echo $flightproposal['CustomerSysId']; ?>','<?php echo $flightproposal['MasterTPSysId']; ?>',$(this).attr('func'));" title="View follow up list" style="color:#0e931d;">
                                                    Follow Ups</a>
                                            <?php } else {
                                            ?>
                                                <a click-src="addtodo" href="javascript:void(0);" title="Add Follow Up" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($flightproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $flightproposal['TPSysId']; ?>',<?php echo $flightproposal['MasterTPSysId']; ?>,<?php echo $flightproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
                                                                                                                                            '<?php echo $proposalID ?>', '<?php echo trim($flightproposal['CustomerSysId']); ?>', '<?php echo trim($flightproposal['ownerName']); ?>' , '<?php echo $flightproposal['AgentSysId']; ?>',this);"><i class="fa fa-plus"></i Up> Follow
                                                </a>
                                            <?php
                                            }
                                            ?>
                                        </span>

                                    </td>
                                    <td class="small"><?php echo $flightproposal['UpdateDate']->format('d-M-y'); ?></td>
                                    <td class="small" style="white-space:nowrap; text-align:center;" align="center">

                                        <?php if (!empty($chatDetails)) { ?>
                                            <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($flightproposal['TPSysId']) . '/cid/' . base64_encode($flightproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                        <?php } else { ?>
                                            <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($flightproposal['TPSysId']) . '/cid/' . base64_encode($flightproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a> <?php } ?>
                                    </td>
                                    <td class="small" style="white-space:nowrap; text-align:center;display:none;" align="center">
                                        <?php if ($chatDetails['IsAgent'] == 0) { ?>
                                            <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($flightproposal['TPSysId']) . '/cid/' . base64_encode($flightproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                        <?php } else { ?>
                                            <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($flightproposal['TPSysId']) . '/cid/' . base64_encode($flightproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                        <?php } ?>
                                    </td>
                                    <td class="small" style="white-space:nowrap;">

                                        <?php
                                                                    
                                        echo $this->partial('leaddetail/leadstatusdropdownpartial.phtml', array('proposalDetails' => $flightproposal, 'allStatusDisplayArrayById' => $allStatusDisplayArrayById, 'loopId' => $h, 'uid' => $uid, 'display' => $display, 'IsAdmin' => $this->IsAdmin, 'intLoggedinUserId'=>$this->intLoggedinUserId));
                                        ?>
                                    </td>
                                </tr>
                                <?php $h++;
                            }
                        }
                        if ($this->leadDetail[0]['PlanType'] == 2) { //for hotel
                            if ($totalrec > 0) {
                                $h = 1;
                                foreach ($record as $hotelproposal) {
                                    //ECHO "<pre>";print_r($hotelproposal);DIE;
                                    $proposalID = 'D/' . date('y') . '/' . $hotelproposal['TPSysId'] . "/V" . $hotelproposal['VersionId'];
                                    //$helperInstance =  $this->getHelper("proposals"); // Helper proposal Not Found
                                    //$suppliercount = $helperInstance->suppliers($hotelproposal['TPSysId']);
                                    $suppliercount = array();
                                    $totalsupplier = $suppliercount ? count($suppliercount) : 0;
                                    $suppIds = array();
                                    if (!empty($suppliercount)) {
                                        foreach ($suppliercount as $k => $v) {
                                            $suppIds[] = $v['SupplierSysId'];
                                        }
                                    }
                                    $allSuppIds = implode(",", $suppIds);
                                    $chatDetails = $objTravelModel->GetCustomerChatHistoryDetailsById($hotelproposal['TPSysId']);
                                    $uid = $hotelproposal['CustomerSysId'] . ':' . $hotelproposal['TPSysId'] . ':' . $hotelproposal['MasterTPSysId'];
                                    $display = 'unique:yes';
                                    $uid = $this->controller->getEnc($uid);
                                    $display = $this->controller->getEnc($display);
                                    $display = '';
                                    $returndate = '';
                                    $departuredate = '';
                                    $paxTOtalArr = json_decode($hotelproposal['RoomInfoJson']);

                                    if (!empty($paxTOtalArr) > 0) {
                                        foreach ($paxTOtalArr as $PaxTotal) {
                                            $departuredate = @$PaxTotal->departuredate;
                                            $returndate = trim(@$PaxTotal->returndate);
                                        }
                                    }
                                    //echo $hotelproposal['IsHotelOnlyPackage'];die;
                                    if ($hotelproposal['IsHotelOnlyPackage'] == 1) {
                                        $returndate = (trim($PaxTotal->returndate) != '') ? DateTime::createFromFormat('d/m/Y', @$PaxTotal->returndate) : '';
                                        $returndate1 = (isset($PaxTotal->returndate)) ? ' - ' . trim(@$returndate->format('d-M-y')) : '';
                                    } else {
                                        $returndate1 = ($hotelproposal['hotelToDate']->format('Y') != '1900') ? " - " . $hotelproposal['hotelToDate']->format('d-M-y') : '';
                                    }
                                    $currencySymbol = $customhelper->GetCurrencyByCurrencyType($hotelproposal['CurrencyType']);


                                    //echo "<pre>";print_r($returndate);die;
                                ?>
                                    <tr>
                                        <td class="small"><?php echo $proposalID; ?> </td>
                                        <td class="small"><?php echo $hotelproposal['CreateDate'] ? $hotelproposal['CreateDate']->format('d-M-y') : ''; ?></td>
                                        <td class="small"><?php echo $hotelproposal['hotelFromDate']->format('d-M-y');
                                                            echo trim($returndate1); ?></td>
                                        <td class="small">Hotel</td>
                                        <td class="small"><?php echo $hotelproposal['hotelCityTitle'] ? stripslashes($hotelproposal['hotelCityTitle']) : ''; ?></td>
                                        
                                        <td class="small" style="white-space:nowrap; text-align:center;"><?php echo $currencySymbol['Symbol']; ?> <?php echo (isset($hotelproposal['NetCost']) && !empty((int)$hotelproposal['NetCost'])) ? $hotelproposal['NetCost'] + $hotelproposal['GTXMarkup'] + $hotelproposal['XServiceTaxAmount'] + $hotelproposal['GTXServiceTaxAmount'] : $hotelproposal['Price']; ?></td>
                                        <td class="small" style="white-space:nowrap; text-align:center;"><?php echo $currencySymbol['Symbol']; ?> <?php echo (isset($hotelproposal['TotalCost']) && !empty((int)$hotelproposal['TotalCost'])) ? ($hotelproposal['TotalCost']) : $hotelproposal['NetPrice']; ?></td>
                                        <td class="small">
                                            <?php echo $hotelproposal['EmailId'] ? $hotelproposal['EmailId'] : ''; ?><br />
                                            <?php if ($hotelproposal['IsHotelOnlyPackage'] == 1) { ?>
                                                <a href="<?php echo $this->baseUrl('/leaddetail/view-sent-package-email/proposalId/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-target="#viewsentemail" data-toggle="modal">View Email</a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/leaddetail/view-sent-proposal-email/proposalId/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-target="#viewsentproposalemail" data-toggle="modal">View Email</a>
                                            <?php } ?>
                                        </td>
                                        <td class="small"><span id="status_<?php echo $h; ?>" class="proposalStatus">
                                                <?php
                                                $hotelFromDate = strtotime($hotelproposal['hotelFromDate']->format('Y-m-d'));
                                                $curdate = strtotime(date('Y-m-d'));
                                                // echo $curdate."/".$hotelFromDate;
                                                if ($curdate > $hotelFromDate) {
                                                    $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($hotelproposal['StatusType'], 1, 'hotel', 2, 18);
                                                } else {
                                                    $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($hotelproposal['StatusType'], '', 'hotel', 2, 18);
                                                }
                                                /*
            $key_iteration_status = array_search( 8 , array_column( $allStatusDisplayArrayById , 'ComponentType')); // search if iteration exists in array
            if( $key_iteration_status ) {
                ?>
            <br/><a click-src="itinerary" href="javascript:void(0);" title="Add Iteration/Follow Up" class="" style="color: #9EDA9E"
               onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'hotel_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
'<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"  >Add Iteration/Follow Up
            </a>
            <?php
            }
            */
                                                echo $travelPlanStatusName[$hotelproposal['StatusType']]['TPStatus'];
                                                $openAddModalToDo = "actionChangeProposalStatusAddIteration('" . base64_encode($hotelproposal['TPSysId']) . "',$h,'hotel_" . $hotelproposal['TPSysId'] . "'," . $hotelproposal['MasterTPSysId'] . "," . $hotelproposal['CustomerSysId'] . ",'" . base64_encode(27) . "','$proposalID', '" . trim($hotelproposal['CustomerSysId']) . "','" . trim($hotelproposal['ownerName']) . "','" . $hotelproposal['AgentSysId'] . "',this)";

                                                if ($hotelproposal['hasIteration']) {
                                                ?>
                                                    <br /><a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getItineraryRequired('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['TPSysId']; ?>', $(this).attr('func') );" title="View changes required list" style="color:#0e931d;">
                                                        Changes
                                                    </a>
                                                <?php
                                                } else {
                                                ?>
                                                    <br /> <a click-src="itinerary" href="javascript:void(0);" title="Add Changes" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'hotel_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
                   '<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"><i class="fa fa-plus"></i> Changes
                                                    </a>
                                                <?php
                                                }
                                                echo ' | ';
                                                if ($hotelproposal['hasFollowUp']) {
                                                ?>
                                                    <span id="putGetFollowupListDataUrl_<?php echo $hotelproposal['TPSysId']; ?>"><a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getFollowUp('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['MasterTPSysId']; ?>',$(this).attr('func'));" title="View follow up list" style="color:#0e931d;" CustomerMasterTPSysId="">
                                                            Follow Ups</a></span>
                                                <?php } else {
                                                ?>
                                                    <span id="putGetFollowupListDataUrl_<?php echo $hotelproposal['TPSysId']; ?>"><a click-src="addtodo" href="javascript:void(0);" title="Add Follow Up" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>','<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);" CustomerMasterTPSysId="<?php echo $hotelproposal['CustomerSysId']; ?>_<?php echo $hotelproposal['TPSysId']; ?>"><i class="fa fa-plus"></i> Follow Up
                                                        </a></span>
                                                <?php
                                                }
                                                ?>
                                            </span>
                                        </td>
                                        <td class="small"><?php echo $hotelproposal['UpdateDate'] ? $hotelproposal['UpdateDate']->format('d-M-y') : ''; ?></td>
                                        <td class="small" style="white-space:nowrap; text-align:center;" align="center">

                                            <?php if (is_array($chatDetails) && !empty($chatDetails)) {
                                                if (!empty($chatDetails)) { ?>
                                                    <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments red"></i></a>
                                                <?php } else { ?>
                                                    <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                                <?php }
                                            } else { ?>
                                                <a href="javascript:void(0);" onclick="alert('No chat history found.')" title="Chat Details"><i class="fa fa-comments gray"></i></a>
                                            <?php } ?>

                                            <!--<a href="javascript:void(0);" onclick="alert('Under construction.Please try after some time.');return false;" data-toggle="modal" data-target="#myModa1Reply"><i class="fa fa-comments view_text1"></i></a>-->
                                        </td>
                                        <td class="small" style="white-space:nowrap; text-align:center;display:none;" align="center">
                                            <?php if (!empty($chatDetails)) {
                                                if ($chatDetails['IsAgent'] == 0) { ?>
                                                    <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments red"></i></a>
                                                <?php } else { ?>
                                                    <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                                <?php }
                                            } else { ?>
                                                <a href="javascript:void(0);" onclick="alert('No chat history found.')" title="Chat Details"><i class="fa fa-comments gray"></i></a>
                                            <?php
                                            } ?>
                                        </td>
                                        <td class="small" style="white-space:nowrap;">
                                            <?php if ($hotelproposal['IsHotelOnlyPackage'] != 1) {  ?>
                                                <div class="btn-group" id="hotel_<?php echo $hotelproposal['TPSysId']; ?>">

                                                    <button type="button" class="btn btn-danger btn-sm dropdown-toggle" data-toggle="dropdown">
                                                        Select <span class="caret"></span>
                                                    </button>

                                                    <ul class="dropdown-menu pull-right" role="menu">
                                                        <?php //"proposalModuleComp";
                                                        if (!empty($allStatusDisplayArrayById)) {
                                                            foreach ($allStatusDisplayArrayById as $keyid => $keyval) {
                                                                switch ($keyval['ComponentType']) {
                                                                    case 1: #for view proposal
                                                        ?>
                                                                        <li><a href="<?php echo $this->baseUrl('/proposal/preview-hotel-result/mid/' . base64_encode($hotelproposal['MasterTPSysId']) . '/pid/' . base64_encode($hotelproposal['TPSysId']) . '/uid/' . base64_encode($uid) . '/type/' . base64_encode($display)); ?>" target="_blank"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                        break;
                                                                    case 2: #for Modify Proposal
                                                                    ?>
                                                                        <li><a href="javascript:void(0);" onclick="actionModifyHotelQuery('hotelshow','searchformdisplay','modifyQuery')"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                        break;
                                                                    case 3: #for Resend Proposal                                   
                                                                    ?>
                                                                        <li><a href="javascript:void(0);" onclick="actionSendProposal('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>)"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                        break;
                                                                    case 4: #for Book Proposal
                                                                    ?>
                                                                        <li><a href="<?php echo $this->baseUrl('/proposal/preview-hotel-result/mid/' . base64_encode($hotelproposal['MasterTPSysId']) . '/pid/' . base64_encode($hotelproposal['TPSysId']) . '/uid/' . base64_encode($uid) . '/type/' . base64_encode($display)); ?>" target="_blank"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                        break;
                                                                    case 5: #for Discard Proposal
                                                                    ?>
                                                                        <li><a href="javascript:void(0);" onclick="actionDiscardQuery('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'hotel_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(15); ?>')"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                        break;
                                                                    case 6: #for Cancel Proposal
                                                                        $bookingCancelURL = '#';
                                                                        if (($hotelproposal['ICSourceSysId'] == 4 || $hotelproposal['ICSourceSysId'] == 3) && $hotelproposal['StatusType'] == 17) {
                                                                            $XrefBookingIdArray = $hotelproposal['XrefBookingId'];
                                                                            if (isset($XrefBookingIdArray) && !empty($XrefBookingIdArray)) {
                                                                                $XrefBookingIdArray = explode("/", $hotelproposal['XrefBookingId']);
                                                                                $XrefBookingId = $XrefBookingIdArray[1];
                                                                                $bookingCancelURL = $this->baseUrl('/bookinghotel/view-and-cancel-hotel-booking/cid/' . base64_encode($hotelproposal['CustomerSysId']) . '/tid/' . base64_encode($hotelproposal['TPSysId']));
                                                                            }
                                                                        }
                                                                    ?>
                                                                        <li><a target="_blank" href="<?php echo $bookingCancelURL; ?>"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                        break;
                                                                    case 7: #for Refund proposal
                                                                    ?>
                                                                        <li><a href="javascript:void(0);" onclick="actionSendProposal('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>)"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                        <?php
                                                                        break;
                                                                        //case 8: #for Iteration Required proposal
                                                                        ?>
                                                                        <!--<li><a href="javascript:void(0);" onclick="actionChangeProposalStatus('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'hotel_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>')"><?php echo stripslashes($keyval['Title']); ?></a></li>-->
                                                                    <?php
                                                                        //																	break;
                                                                    case 8:
                                                                        // iteration require case : onclick function change here by Ranvir singh on 27 Sep
                                                                    ?>
                                                                        <li><a href="javascript:void(0);" title="Add changes Required" click-src="itinerary" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'hotel_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
										'<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                        break;
                                                                    case 9: #for Update Payment proposal
                                                                    ?>
                                                                        <li><a onclick="alert('Work in progress');"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                        break;
                                                                    case 10: #for Voucher proposal
                                                                        $link = $this->baseUrl('/proposal/hotel-voucher/mid/' . base64_encode($hotelproposal['MasterTPSysId']) . '/pid/' . base64_encode($hotelproposal['TPSysId']) . '/uid/' . base64_encode($uid));
                                                                    ?>
                                                                        <li><a href="<?php echo $link; ?>" target="_blank"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                        break;
                                                                    case 11: #for Invoice proposal
                                                                        $link = $this->baseUrl('/proposal/hotel-invoice/mid/' . base64_encode($hotelproposal['MasterTPSysId']) . '/pid/' . base64_encode($hotelproposal['TPSysId']) . '/uid/' . base64_encode($uid));
                                                                    ?>
                                                                        <li><a href="<?php echo $link; ?>" target="_blank"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                <?php
                                                                        break;
                                                                }
                                                                ?>
                                                        <?php
                                                            }
                                                        }
                                                        ?>
                                                    </ul>

                                                </div>
                                            <?php } else {
                                                $hotelproposal['PlanType'] = 5;
                                                echo $this->partial('leaddetail/leadstatusdropdownpartial.phtml', array('proposalDetails' => $hotelproposal, 'allStatusDisplayArrayById' => $allStatusDisplayArrayById, 'loopId' => $h, 'IsAdmin' => $this->IsAdmin, 'intLoggedinUserId'=>$this->intLoggedinUserId));
                                            } ?>
                                        </td>
                                    </tr>
                                <?php $h++;
                                }
                            } else { ?>
                                <tr>
                                    <td colspan="14" align="center"><strong>No Proposal Found, <a href="javascript:void(0);" class="createleadsnorecord">Click Here</a> to create new proposal</strong></td>
                                </tr>
                                <?php }
                        }
                        if ($this->leadDetail[0]['PlanType'] == 4) { //for insurance
                            //echo "<pre>";print_r($record);
                            if ($totalrec > 0) {
                                $h = 0;
                                $objPkgBooking = new Travel_Model_TblPackageBooking();
                                foreach ($record as $hotelproposal) {

                                    $arrAmountPaid = $objPkgBooking->getAmountPaidForProposalByTPSysId($hotelproposal['TPSysId']);
                                    $TotalAmountPaid = !empty($arrAmountPaid['TotalAmountPaid']) ? $arrAmountPaid['TotalAmountPaid'] : 0;
                                    $proposalID = 'D/' . date('y') . '/' . $hotelproposal['TPSysId'] . "/" . 'V' . $hotelproposal['VersionId'];
                                    $chatDetails = $objTravelModel->GetCustomerChatHistoryDetailsById($hotelproposal['TPSysId']);
                                    //echo "<pre>";print_r($$hotelproposal);
                                    $CurrencyType = $hotelproposal['CurrencyType'] > 0 ? $hotelproposal['CurrencyType'] : 1;
                                    $currencySymbol = $customhelper->GetCurrencyByCurrencyType($CurrencyType);
                                    $returndate = '';
                                    $departuredate = '';
                                    $paxTOtalArr = json_decode($hotelproposal['RoomInfoJson']);
                                    if (!empty($paxTOtalArr)) {
                                        foreach ($paxTOtalArr as $PaxTotal) {
                                            $departuredate = (trim($PaxTotal->departuredate) != '') ? DateTime::createFromFormat('d/m/Y', @$PaxTotal->departuredate) : '';
                                            $returndate = (trim($PaxTotal->returndate) != '') ? DateTime::createFromFormat('d/m/Y', @$PaxTotal->returndate) : '';

                                            $departuredate = (isset($PaxTotal->departuredate) && trim($PaxTotal->departuredate) != '') ? @$departuredate->format('d-M-y') : '';
                                            $returndate = (isset($PaxTotal->returndate) && trim($PaxTotal->returndate) != '') ? trim(@$returndate->format('d-M-y')) : '';
                                        }
                                    }
                                ?>
                                    <tr>
                                        <td class="small"><?php echo $proposalID; ?> (PId-<?php echo trim($hotelproposal['TPId']); ?>)
                                            <?php if (!empty($hotelproposal['EmailText'])) { ?>
                                                <a style="display:none;" href="javascript:void(0);" title="<?php echo !empty($hotelproposal['EmailText']) ? stripslashes(trim($hotelproposal['EmailText'])) : 'NA'; ?>">Email Text</a>
                                            <?php } ?>
                                        </td>
                                        <td class="small"><?php echo $hotelproposal['CreateDate'] ? $hotelproposal['CreateDate']->format('d-M-y') : ''; ?></td>
                                        <td class="small"><?php echo $departuredate;
                                                            echo trim($returndate) != '' ? " - " . $returndate : ''; ?></td>
                                        <td class="small"><?php echo $customhelper->getPlanTypeName($hotelproposal['PlanType']); ?></td>
                                        <td class="small"><?php echo $hotelproposal['EmailDestination'] ? stripslashes($hotelproposal['EmailDestination']) : stripslashes(trim($hotelproposal['DestinationPlaces'])); ?></td>
                                         
                                        <td class="small" style="white-space:nowrap; text-align:center;">
                                            <?php echo $currencySymbol['Symbol']; ?> <?php echo $hotelproposal['Price'] ? ($hotelproposal['Price']) : 0; ?>
                                            <?php //echo $currencySymbol['Symbol'];
                                            ?> <?php //echo $hotelproposal['Price'] ? ($hotelproposal['Price']+$hotelproposal['GTXMarkUp']+$hotelproposal['XServiceTaxAmount']+$hotelproposal['GTXServiceTaxAmount'])-($hotelproposal['CustomDiscount']+$hotelproposal['ServiceTaxOnCustomDiscount']) : 0;
                                                ?></td>
                                        <td class="small" style="white-space:nowrap; text-align:center;">
                                            <?php if ($hotelproposal['IsPriceShared'] == 1) {
                                                echo $currencySymbol['Symbol']; ?> <?php echo $hotelproposal['NetPrice'] ? ($hotelproposal['NetPrice']) : 0;
                                                                                } else {
                                                                                    echo $hotelproposal['PriceRange'];
                                                                                }
                                                                                    ?>
                                        </td>
                                        <td class="small"><?php echo !empty($hotelproposal['ProposalEmailTo']) ? $hotelproposal['ProposalEmailTo'] : $hotelproposal['EmailId']; ?>
                                            <?php if ($hotelproposal['PackSpecType'] == 4 && $hotelproposal['StatusType'] == 16) { ?>
                                                <a href="<?php echo $this->baseUrl('/packagesearch/buildquickpackage/id/' . ($hotelproposal['TPSysId'])); ?>" target="_blank">Open Proposal</a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/leaddetail/view-sent-package-email/proposalId/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-target="#viewsentemail" data-toggle="modal">View Email</a>
                                            <?Php } ?>
                                        </td>
                                        <td class="small">
                                            <span id="status_<?php echo $h; ?>" class="proposalStatus">
                                                <?php echo $travelPlanStatusName[$hotelproposal['StatusType']]['TPStatus']; ?>
                                                <?php
                                                $hotelToDate = strtotime($hotelproposal['PkgSellValidTill']->format('Y-m-d'));
                                                $curdate = strtotime(date('Y-m-d'));
                                                //echo $curdate."/".$hotelFromDate;

                                                if ($curdate > $hotelToDate) {
                                                    $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($hotelproposal['StatusType'], 1, 'package', 2, 15);
                                                } else {
                                                    $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($hotelproposal['StatusType'], '', 'package', 2, 15);
                                                }
                                                /*
                                                $key_iteration_status = array_search( 8 , array_column( $allStatusDisplayArrayById , 'ComponentType')); // search if iteration exists in array
                                                if( $key_iteration_status ) {
                                                    ?>
                                                <br/><a click-src="itinerary" href="javascript:void(0);" title="Add Iteration/Follow Up" class="" style="color: #9EDA9E"
                                                   onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
        '<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);" >Add Iteration/Follow Up
                                                </a>
                                                <?php
                                                }
 * 
 */
                                                $openAddModalToDo = "actionChangeProposalStatusAddIteration('" . base64_encode($hotelproposal['TPSysId']) . "',$h,'package_" . $hotelproposal['TPSysId'] . "'," . $hotelproposal['MasterTPSysId'] . "," . $hotelproposal['CustomerSysId'] . ",'" . base64_encode(27) . "','$proposalID', '" . trim($hotelproposal['CustomerSysId']) . "','" . trim($hotelproposal['ownerName']) . "','" . $hotelproposal['AgentSysId'] . "',this)";
                                                if ($hotelproposal['hasIteration']) {
                                                ?>
                                                    <br /><a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getItineraryRequired('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['TPSysId']; ?>', $(this).attr('func') );" title="View changes required list" style="color:#0e931d;">
                                                        Changes
                                                    </a>
                                                <?php
                                                } else {
                                                ?>
                                                    <br /> <a click-src="itinerary" href="javascript:void(0);" title="Add Changes" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
                   '<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"><i class="fa fa-plus"></i> Changes
                                                    </a>
                                                <?php
                                                }
                                                echo ' | ';
                                                if ($hotelproposal['hasFollowUp']) {
                                                ?>
                                                    <a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getFollowUp('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['MasterTPSysId']; ?>',$(this).attr('func'));" title="View follow up list" style="color:#0e931d;">
                                                        Follow Ups</a>
                                                <?php } else {
                                                ?>
                                                    <a click-src="addtodo" href="javascript:void(0);" title="Add Follow Up" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
                                                '<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"><i class="fa fa-plus"></i> Follow Up
                                                    </a>
                                                <?php
                                                }
                                                ?>
                                            </span>

                                        </td>
                                        <td class="small"><?php echo $hotelproposal['UpdateDate'] ? $hotelproposal['UpdateDate']->format('d-M-y') : ''; ?></td>
                                        <td class="small" style="white-space:nowrap; text-align:center;" align="center">

                                            <?php //if(count($chatDetails)>0){ 
                                            if (!empty($chatDetails)) { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments orange"></i></a>
                                            <?php } //} else { 
                                            ?> <a style="display:none;" href="javascript:void(0);" onclick="alert('No chat history found!')"><i class="fa fa-comments gray"></i></a><?php //} 
                                                                                                                                                                                    ?>

                                            <!--<a href="javascript:void(0);" onclick="alert('Under construction.Please try after some time.');return false;" data-toggle="modal" data-target="#myModa1Reply"><i class="fa fa-comments view_text1"></i></a>-->
                                        </td>
                                        <td class="small" style="white-space:nowrap; text-align:center;display:none;" align="center">
                                            <?php //if(count($chatDetails)>0){
                                            if ($chatDetails['IsAgent'] == 0) { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments orange"></i></a>
                                            <?php } //} else { 
                                            ?> <a style="display:none;" href="javascript:void(0);" onclick="alert('No chat history found!')"><i class="fa fa-comments gray"></i></a><?php //} 
                                                                                                                                                                                    ?>
                                            <!--<a href="javascript:void(0);" onclick="alert('Under construction.Please try after some time.');return false;" data-toggle="modal" data-target="#myModa1Reply"><i class="fa fa-comments orange"></i></a>-->
                                        </td>
                                        <td class="small" style="white-space:nowrap;">
                                            <?php

                                            $isPkgReadymade = $hotelproposal['Readymade'];
                                            $pkgId = $hotelproposal['TPSysId'];
                                            //echo $hotelproposal['PackSpecType']
                                            $modifyPackageLink = '';
                                            if ($hotelproposal['PackSpecType'] == 4) {
                                                $modifyPackageLink = '#';
                                                $viewPackageLink = $this->baseUrl('/publicpackage/view-customer-final-package/id/' . base64_encode($hotelproposal['TPSysId']));
                                                $modifyPkgOnclick = "editReadymadeQuickPackageProposal('$pkgId')";
                                            } else if ($isPkgReadymade == 0) {
                                                //link for BYO package
                                                $viewPackageLink = $this->baseUrl('/package/view-byo-pkg/id/' . base64_encode($hotelproposal['TPSysId']));
                                                $modifyPackageLink = $this->baseUrl('/package/add-customer-package/id/' . $hotelproposal['TPSysId']);
                                                $modifyPkgOnclick = "modifyByoPackageProposal('$pkgId')";
                                            } else {
                                                $modifyPackageLink = '#';
                                                $modifyPkgOnclick = "modifyReadymadePackageProposal('$pkgId')";
                                                //													if(empty($hotelproposal['IsPriceShared'])){
                                                //link for itenary based
                                                //														$viewPackageLink=$this->baseUrl('/publicpackage/view-customer-proposal/id/'.base64_encode($hotelproposal['TPSysId']));
                                                //$modifyPackageLink=$this->baseUrl('/package/add-flexi-package/id/'.$hotelproposal['TPSysId']);
                                                //													}else {
                                                //link for onlyhotel based

                                                $viewPackageLink = $this->baseUrl('/publicpackage/view-customer-final-package/id/' . base64_encode($hotelproposal['TPSysId']) . '/code/' . $secureCode);
                                                //$modifyPackageLink=$this->baseUrl('/package/add-flexi-package/id/'.$hotelproposal['TPSysId']);
                                                //													}
                                            }
                                            $bookNowLink = $viewPackageLink;
                                            $cancelLink = '#';
                                            ?>
                                            <div class="btn-group" id="package_<?php echo $hotelproposal['TPSysId']; ?>">
                                                <button type="button" class="btn btn-danger btn-sm dropdown-toggle" data-toggle="dropdown">
                                                    Select <span class="caret"></span>
                                                </button>
                                                <ul class="dropdown-menu pull-right" role="menu">
                                                    <?php //"proposalModuleComp";
                                                    if (!empty($allStatusDisplayArrayById)) {
                                                        foreach ($allStatusDisplayArrayById as $keyid => $keyval) {
                                                            switch ($keyval['ComponentType']) {
                                                                case 1:
                                                    ?>
                                                                    <li><a href="<?php echo $viewPackageLink; ?>" target="_blank"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                    break;
                                                                case 2:
                                                                    if ($hotelproposal['PackSpecType'] != 3) {
                                                                    ?>
                                                                        <li><a onclick="return <?php echo $modifyPkgOnclick; ?>" href="javascript:void(0);<?php //echo $modifyPackageLink; 
                                                                                                                                                            ?>"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                    }
                                                                    break;
                                                                case 3:
                                                                    if ($isPkgReadymade == 0) { ?>
                                                                        <li><a href="javascript:void(0);" onclick="actionPackageSendProposal('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'url')"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php } else { ?>
                                                                        <li><a href="javascript:void(0);" onclick="actionReadymadePackageSendProposal('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'url')"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php }
                                                                    break;
                                                                case 4:
                                                                    ?>
                                                                    <li><a href="<?php echo $viewPackageLink; ?>" target="_blank"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                <?php
                                                                    break;
                                                                case 5:
                                                                ?>
                                                                    <li><a href="javascript:void(0);" onclick="actionChangeProposalStatus('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(15); ?>')"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                <?php
                                                                    break;
                                                                case 6:
                                                                ?>
                                                                    <li><a href="<?php echo $cancelLink; ?>" target="_blank"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                <?php
                                                                    break;
                                                                case 7:
                                                                ?>
                                                                    <li><a onclick="alert('Work in progress');"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                    break;
                                                                    //																	case 8:
                                                                    ?>
                                                                    <!--<li><a href="javascript:void(0);" onclick="actionChangeProposalStatus('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>')"><?php echo stripslashes($keyval['Title']); ?></a></li>-->
                                                                <?php
                                                                    //																	break;
                                                                case 8:
                                                                    // iteration require case : onclick function change here by Ranvir singh on 27 Sep
                                                                ?>
                                                                    <li><a href="javascript:void(0);" title="Add changes Required" click-src="itinerary" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
        '<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                    break;
                                                                case 9:
                                                                    if ($hotelproposal['StatusType'] != 17) {
                                                                    ?>
                                                                        <li><a onclick="updatePayment('<?php echo $hotelproposal['TPSysId']; ?>','<?php echo round($hotelproposal['NetPrice']); ?>','<?php echo round($TotalAmountPaid); ?>');"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                    }
                                                                    break;
                                                                case 10:
                                                                    ?>
                                                                    <li><a target="_blank" href="<?php echo $this->baseUrl('/package-booking/package-booking-voucher/pid/' . base64_encode($hotelproposal['TPSysId']) . '/pid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                <?php
                                                                    break;
                                                                case 11:
                                                                ?>
                                                                    <li><a target="_blank" href="<?php echo $this->baseUrl('/package-booking/package-booking-invoice/pid/' . base64_encode($hotelproposal['TPSysId']) . '/pid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                            <?php
                                                                    break;
                                                            }
                                                            ?>
                                                    <?php
                                                        }
                                                    }
                                                    ?>
                                                </ul>
                                            </div>
                                            <a data-target="#myModalSendSMSToDoCustomer" class="btn btn-xs tooltipLink" title='Send Sms' href="<?php echo $this->baseUrl('/leaddetail/view-sms-template-to-customer/cid/' . base64_encode($hotelproposal['CustomerSysId']) . '/tpid/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-toggle="modal"><i class="tooltipLink fa fa-comment-o view_text1"></i></a>
                                        </td>
                                    </tr>
                                <?php $h++;
                                }
                            } else { ?>
                                <tr>
                                    <td colspan="14" align="center"><strong>No Proposal Found, <a href="javascript:void(0);" class="createleadsnorecord">Click Here</a> to create new proposal</strong></td>
                                </tr>
                                <?php }
                        }
                        if ($this->leadDetail[0]['PlanType'] == 5 || $this->leadDetail[0]['PlanType'] == 10) { // for package
                            //echo "<pre>";print_r($record);
                            if ($totalrec > 0) {
                                $h = 0;
                                $objPkgBooking = new Travel_Model_TblPackageBooking();
                                foreach ($record as $hotelproposal) {
                                    $hotelproposal['NetPrice'] = $hotelproposal['NetPrice'] + $hotelproposal['TotalCostGen'] + $hotelproposal['TotalTcs'];
                                    $arrAmountPaid = $objPkgBooking->getAmountPaidForProposalByTPSysId($hotelproposal['TPSysId']);

                                    $TotalAmountPaid = !empty($arrAmountPaid['TotalAmountPaid']) ? $arrAmountPaid['TotalAmountPaid'] : 0;
                                    $TotalTCSAmount = (float)$arrAmountPaid['TcsTwentyPercentage'] + (float) $arrAmountPaid['TcsFivePercentage'];
                                    $proposalID = 'D/' . date('y') . '/' . $hotelproposal['TPSysId'] . "/" . 'V' . $hotelproposal['VersionId'];
                                    $chatDetails = $objTravelModel->GetCustomerChatHistoryDetailsById($hotelproposal['TPSysId']);
                                    //echo "<pre>";print_r($$hotelproposal);
                                    $CurrencyType = $hotelproposal['CurrencyType'] > 0 ? $hotelproposal['CurrencyType'] : 1;
                                    $currencySymbol = $customhelper->GetCurrencyByCurrencyType($CurrencyType);
                                    $returndate = '';
                                    $departuredate = '';
                                    $paxTOtalArr = isset($hotelproposal['RoomInfoJson']) && $hotelproposal['RoomInfoJson'] != '' ? json_decode($hotelproposal['RoomInfoJson']) : '';
                                    if (is_object($paxTOtalArr)) {
                                        foreach ($paxTOtalArr as $PaxTotal) {
                                            $departuredate = (trim($PaxTotal->departuredate) != '') ? DateTime::createFromFormat('d/m/Y', @$PaxTotal->departuredate) : '';
                                            $returndate = (trim($PaxTotal->returndate) != '') ? DateTime::createFromFormat('d/m/Y', @$PaxTotal->returndate) : '';
                                            //echo $departuredate; exit;
                                            $departuredate = (isset($PaxTotal->departuredate) && ($departuredate != '') && trim($PaxTotal->departuredate) != '') ? @$departuredate->format('d-M-y') : '';
                                            $returndate = (isset($PaxTotal->returndate) && ($returndate != '') && trim($PaxTotal->returndate) != '') ? trim(@$returndate->format('d-M-y')) : '';
                                        }
                                    }
                                ?>
                                    <tr>
                                        <td class="small"><?php echo $proposalID; ?> (PId-<?php echo trim($hotelproposal['TPId']); ?>)</td>
                                        <td class="small"><?php echo $hotelproposal['CreateDate'] ? $hotelproposal['CreateDate']->format('d-M-y') : ''; ?></td>
                                        <td class="small"><?php echo $departuredate;
                                                            echo trim($returndate) != '' ? " - " . $returndate : ''; ?></td>
                                        <td class="small"><?php
                                                            if ($hotelproposal['Readymade'] == 1 && $hotelproposal['IsPriceShared'] == 1 && $hotelproposal['PackSpecType'] != 4) {
                                                                echo 'Readymade Package (WP)';
                                                            } else if ($hotelproposal['Readymade'] == 1 && $hotelproposal['IsPriceShared'] == 0) {
                                                                echo 'Readymade Package (WOP)';
                                                            } else if ($hotelproposal['Readymade'] == 1 && $hotelproposal['PackSpecType'] == 4) {
                                                                echo ($this->leadDetail[0]['PlanType'] == 10) ? 'Miscellaneous Quick' : 'Readymade Quick Package';
                                                            } else {
                                                                echo 'Dynamic Package';
                                                            }
                                                            echo "<br>".$hotelproposal['LeadSource'];
                                                            ?></td>
                                        <td class="small"><?php $destination = (!empty($hotelproposal['Cities']) && trim($hotelproposal['Cities']) != '') ? stripslashes($hotelproposal['Cities']) : '';
                                                            echo str_replace(',', ', ', $destination); ?></td>
                                        <?php  
                                        if (isset($hotelproposal['IsGTXNetwork']) && $hotelproposal['IsGTXNetwork'] == 1) { ?>
                                            <td class="small" style="white-space:nowrap; text-align:center;">
                                                <?php echo $currencySymbol['Symbol']; ?> <?php echo $hotelproposal['Price'] ? ((float) $hotelproposal['Price'] + (float) $hotelproposal['AgencyMarkUp'] + (float)$hotelproposal['XServiceTaxAmount']) : 0; ?>
                                                <?php //echo $currencySymbol['Symbol'];
                                                ?> <?php //echo $hotelproposal['Price'] ? ($hotelproposal['Price']+$hotelproposal['GTXMarkUp']+$hotelproposal['XServiceTaxAmount']+$hotelproposal['GTXServiceTaxAmount'])-($hotelproposal['CustomDiscount']+$hotelproposal['ServiceTaxOnCustomDiscount']) : 0;
                                                    ?></td>
                                            <td class="small" style="white-space:nowrap; text-align:center;">
                                                <?php if ($hotelproposal['IsPriceShared'] == 1) {
                                                    echo $currencySymbol['Symbol']; ?> <?php echo $hotelproposal['NetPrice'] ? ($hotelproposal['NetPrice']) : 0;
                                                                                    } else {
                                                                                        echo $hotelproposal['PriceRange'];
                                                                                    }
                                                                                        ?>
                                            </td>
                                        <?php } else { ?>
                                            <td class="small" style="white-space:nowrap; text-align:center;">
                                                <?php echo $currencySymbol['Symbol']; ?> <?php echo $hotelproposal['Price'] ? ($hotelproposal['Price']) : 0; ?>
                                                <?php //echo $currencySymbol['Symbol'];
                                                ?> <?php //echo $hotelproposal['Price'] ? ($hotelproposal['Price']+$hotelproposal['GTXMarkUp']+$hotelproposal['XServiceTaxAmount']+$hotelproposal['GTXServiceTaxAmount'])-($hotelproposal['CustomDiscount']+$hotelproposal['ServiceTaxOnCustomDiscount']) : 0;
                                                    ?></td>
                                            <td class="small" style="white-space:nowrap; text-align:center;">
                                                <?php if ($hotelproposal['IsPriceShared'] == 1) {
                                                    echo $currencySymbol['Symbol']; ?> <?php echo $hotelproposal['NetPrice'] ? ($hotelproposal['NetPrice']) : 0;
                                                                                    } else {
                                                                                        echo $hotelproposal['PriceRange'];
                                                                                    }
                                                                                        ?>
                                                <br>
                                                <a class="viewtext_red " href="<?php echo $this->baseUrl('crm/query/get-addon-data/id/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-toggle="modal" data-target="#viewsentemail"><span class="blueview_text">(View)</span> </a>
                                            </td>

                                        <?php } ?>



                                        <td class="small"><?php echo !empty($hotelproposal['ProposalEmailTo']) ? $hotelproposal['ProposalEmailTo'] : $hotelproposal['EmailId']; ?>
                                            <?php if ($hotelproposal['PackSpecType'] == 4 && $hotelproposal['StatusType'] == 16) { ?>
                                                <a href="<?php echo $this->baseUrl('/packagesearch/buildquickpackage/id/' . ($hotelproposal['TPSysId'])); ?>" target="_blank">Open Proposal</a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/leaddetail/view-sent-package-email/proposalId/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-target="#viewsentemail" data-toggle="modal">View Email</a>
                                            <?php } ?>
                                        </td>
                                        <td class="small"><span id="status_<?php echo $h; ?>" class="proposalStatus">
                                                <?php
                                                $hotelToDate = strtotime($hotelproposal['PkgSellValidTill']->format('Y-m-d'));
                                                $curdate = strtotime(date('Y-m-d'));

                                                if ($curdate > $hotelToDate) {
                                                    $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($hotelproposal['StatusType'], 1, 'package', 2, 15);
                                                } else {
                                                    $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($hotelproposal['StatusType'], '', 'package', 2, 15);
                                                }


                                                $openAddModalToDo = "actionChangeProposalStatusAddIteration('" . base64_encode($hotelproposal['TPSysId']) . "',$h,'package_" . $hotelproposal['TPSysId'] . "'," . $hotelproposal['MasterTPSysId'] . "," . $hotelproposal['CustomerSysId'] . ",'" . base64_encode(27) . "','$proposalID', '" . trim($hotelproposal['CustomerSysId']) . "','" . trim($hotelproposal['ownerName']) . "','" . $hotelproposal['AgentSysId'] . "',this)";
                                                /*
                                                        if($travelPlanStatusName[$hotelproposal['StatusType']]['TPStatus'] === 'Iteration Required') {
                                                            if( $hotelproposal['hasIteration'] ) {
                                                        ?>
                                                        <a func="<?php echo $openAddModalToDo?>" href="javascript:void(0);" onclick="getItineraryRequired('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['TPSysId']; ?>', $(this).attr('func'));" title="View iteration required list" >
                                                        <?php echo $travelPlanStatusName[$hotelproposal['StatusType']]['TPStatus'];?>
                                                        </a>
                                                        <?php
                                                            }
                                                            else {
                                                                echo $travelPlanStatusName[$hotelproposal['StatusType']]['TPStatus'];
                                                            }
                                                        }
                                                        else {
                                                            echo $travelPlanStatusName[$hotelproposal['StatusType']]['TPStatus'];
                                                        }
                                                    */

                                                echo $travelPlanStatusName[$hotelproposal['StatusType']]['TPStatus'];
                                                if ($hotelproposal['hasIteration']) {
                                                ?>
                                                    <br /><a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getItineraryRequired('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['TPSysId']; ?>', $(this).attr('func') );" title="View changes required list" style="color:#0e931d;">
                                                        Changes
                                                    </a>
                                                <?php
                                                } else {
                                                ?>
                                                    <br /> <a click-src="itinerary" href="javascript:void(0);" title="Add Changes" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
														   '<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);" CustomerMasterTPSysId="<?php echo $hotelproposal['CustomerSysId']; ?>_<?php echo $hotelproposal['TPSysId']; ?>"><i class="fa fa-plus"></i> Changes
                                                    </a>
                                                <?php
                                                }
                                                echo ' | ';
                                                if ($hotelproposal['hasFollowUp']) {
                                                ?>
                                                    <span id="putGetFollowupListDataUrl_<?php echo $hotelproposal['TPSysId']; ?>"><a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getFollowUp('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['MasterTPSysId']; ?>',$(this).attr('func'));" title="View follow up list" style="color:#0e931d;" CustomerMasterTPSysId="">
                                                            Follow Ups</a><span>
                                                        <?php } else {
                                                        ?>
                                                            <span id="putGetFollowupListDataUrl_<?php echo $hotelproposal['TPSysId']; ?>"><a click-src="addtodo" href="javascript:void(0);" title="Add Follow Up" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
																						'<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);" CustomerMasterTPSysId="<?php echo $hotelproposal['CustomerSysId']; ?>_<?php echo $hotelproposal['TPSysId']; ?>"><i class="fa fa-plus"></i> Follow Up
                                                                </a><span>
                                                                <?php
                                                            }
                                                                ?>

                                                                </span>

                                                                <input type="hidden" id="mLeadStatusType_<?php echo ($hotelproposal['TPSysId']); ?>" value="<?php echo $hotelproposal['StatusType']; ?>">
                                                                <input type="hidden" id="mLeadQuality_<?php echo ($hotelproposal['TPSysId']); ?>" value="<?php echo (int)$hotelproposal['LeadQuality']; ?>">
                                                                <input type="hidden" id="mType_<?php echo ($hotelproposal['TPSysId']); ?>" value="2">
                                        </td>
                                        <td class="small"><?php echo $hotelproposal['UpdateDate'] ? $hotelproposal['UpdateDate']->format('d-M-y') : ''; ?></td>
                                        <td class="small" style="white-space:nowrap; text-align:center;" align="center">

                                            <?php //echo "<pre>";print_r($chatDetails);//if(count($chatDetails)>0){
                                            if (is_array($chatDetails) && !empty($chatDetails)) { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments orange"></i></a>
                                            <?php } //} else { 
                                            ?> <a style="display:none;" href="javascript:void(0);" onclick="alert('No chat history found!')"><i class="fa fa-comments gray"></i></a><?php //} 
                                                                                                                                                                                    ?>

                                            <!--<a href="javascript:void(0);" onclick="alert('Under construction.Please try after some time.');return false;" data-toggle="modal" data-target="#myModa1Reply"><i class="fa fa-comments view_text1"></i></a>-->
                                        </td>
                                        <td class="small" style="white-space:nowrap; text-align:center;display:none;" align="center">
                                            <?php //if(count($chatDetails)>0){
                                            if ($chatDetails['IsAgent'] == 0) { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments orange"></i></a>
                                            <?php } //} else { 
                                            ?> <a style="display:none;" href="javascript:void(0);" onclick="alert('No chat history found!')"><i class="fa fa-comments gray"></i></a><?php //} 
                                                                                                                                                                                    ?>
                                            <!--<a href="javascript:void(0);" onclick="alert('Under construction.Please try after some time.');return false;" data-toggle="modal" data-target="#myModa1Reply"><i class="fa fa-comments orange"></i></a>-->
                                        </td>
                                        <td class="small" style="white-space:nowrap;">
                                            <input type="hidden" id="packageCurrency_<?php echo $hotelproposal['TPSysId']; ?>" value="<?php echo $_SESSION['sessionLogin_user']['agencyDetails']['Symbol']; ?>">
                                            <input type="hidden" id="packagePlanType_<?php echo $hotelproposal['TPSysId']; ?>" value="<?php echo $hotelproposal['PlanType']; ?>">
                                            <?php
                                            echo $this->partial('leaddetail/leadstatusdropdownpartial.phtml', array('proposalDetails' => $hotelproposal, 'allStatusDisplayArrayById' => $allStatusDisplayArrayById, 'loopId' => $h, 'TotalAmountPaid' => $TotalAmountPaid, 'TotalTCSAmount' => $TotalTCSAmount ,'IsAdmin' => $this->IsAdmin, 'intLoggedinUserId'=>$this->intLoggedinUserId));
                                            ?>
                                            <a data-target="#myModalSendSMSToDoCustomer" class="view_text1 tooltipLink" title='Send Sms' href="<?php echo $this->baseUrl('/leaddetail/view-sms-template-to-customer/cid/' . base64_encode($hotelproposal['CustomerSysId']) . '/tpid/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-toggle="modal"><i class="tooltipLink fa fa-comment"></i></a>
                                        </td>
                                    </tr>
                                <?php $h++;
                                }
                            } else { ?>
                                <tr>
                                    <td colspan="14" align="center"><strong>No Proposal Found, <a href="javascript:void(0);" class="createleadsnorecord">Click Here</a> to create new proposal</strong></td>
                                </tr>
                                <?php }
                        }
                        if ($this->leadDetail[0]['PlanType'] == 6) { //for Visa
                            //echo "<pre>";print_r($record);
                            if ($totalrec > 0) {
                                $h = 0;
                                $objPkgBooking = new Travel_Model_TblPackageBooking();
                                foreach ($record as $hotelproposal) {

                                    $arrAmountPaid = $objPkgBooking->getAmountPaidForProposalByTPSysId($hotelproposal['TPSysId']);
                                    $TotalAmountPaid = !empty($arrAmountPaid['TotalAmountPaid']) ? $arrAmountPaid['TotalAmountPaid'] : 0;
                                    $proposalID = 'D/' . date('y') . '/' . $hotelproposal['TPSysId'] . "/" . 'V' . $hotelproposal['VersionId'];
                                    $chatDetails = $objTravelModel->GetCustomerChatHistoryDetailsById($hotelproposal['TPSysId']);
                                    //echo "<pre>";print_r($$hotelproposal);
                                    $CurrencyType = $hotelproposal['CurrencyType'] > 0 ? $hotelproposal['CurrencyType'] : 1;
                                    $currencySymbol = $customhelper->GetCurrencyByCurrencyType($CurrencyType);
                                    $returndate = '';
                                    $departuredate = '';
                                    $paxTOtalArr = json_decode($hotelproposal['RoomInfoJson']);
                                    if (!empty($paxTOtalArr)) {
                                        foreach ($paxTOtalArr as $PaxTotal) {
                                            $departuredate = (trim($PaxTotal->departuredate) != '') ? DateTime::createFromFormat('d/m/Y', @$PaxTotal->departuredate) : '';
                                            $returndate = (trim($PaxTotal->returndate) != '') ? DateTime::createFromFormat('d/m/Y', @$PaxTotal->returndate) : '';

                                            $departuredate = (isset($PaxTotal->departuredate) && trim($PaxTotal->departuredate) != '') ? @$departuredate->format('d-M-y') : '';
                                            $returndate = (isset($PaxTotal->returndate) && trim($PaxTotal->returndate) != '' && $returndate->format('y') != '70') ? trim(@$returndate->format('d-M-y')) : '';
                                        }
                                    }
                                ?>
                                    <tr>
                                        <td class="small"><?php echo $proposalID; ?> (PId-<?php echo trim($hotelproposal['TPId']); ?>)
                                            <?php if (!empty($hotelproposal['EmailText'])) { ?>
                                                <a style="display:none;" href="javascript:void(0);" title="<?php echo !empty($hotelproposal['EmailText']) ? stripslashes(trim($hotelproposal['EmailText'])) : 'NA'; ?>">Email Text</a>
                                            <?php } ?>
                                        </td>
                                        <td class="small"><?php echo $hotelproposal['CreateDate'] ? $hotelproposal['CreateDate']->format('d-M-y') : ''; ?></td>
                                        <td class="small"><?php echo $departuredate;
                                                            echo (trim($returndate) != '') ? " - " . $returndate : ''; ?></td>
                                        <td class="small"><?php echo $customhelper->getPlanTypeName($hotelproposal['PlanType']); ?></td>
                                        <td class="small"><?php echo $hotelproposal['EmailDestination'] ? stripslashes($hotelproposal['EmailDestination']) : stripslashes(trim($hotelproposal['DestinationPlaces'])); ?></td>
                                        <td class="small">
                                            <a href="<?php echo $this->baseUrl('/leaddetail/lead-supplier-detail/id/' . base64_encode($hotelproposal['TPSysId']) . '/sid/' . base64_encode($hotelproposal['SupplierSysId'])); ?>" data-target="#viewquotesupplier" data-toggle="modal">View</a>
                                        </td>
                                        <td class="small" style="white-space:nowrap; text-align:center;">
                                            <?php echo $currencySymbol['Symbol']; ?> <?php echo $hotelproposal['Price'] ? ($hotelproposal['Price']) : 0; ?>
                                        <td class="small" style="white-space:nowrap; text-align:center;">
                                            <?php echo $currencySymbol['Symbol']; ?> <?php echo $hotelproposal['NetPrice'] ? ($hotelproposal['NetPrice']) : 0; ?>
                                        </td>
                                        <td class="small"><?php echo !empty($hotelproposal['ProposalEmailTo']) ? $hotelproposal['ProposalEmailTo'] : $hotelproposal['EmailId']; ?>
                                            <?php if ($hotelproposal['PackSpecType'] == 4 && $hotelproposal['StatusType'] == 16) { ?>
                                                <a href="<?php echo $this->baseUrl('/packagesearch/buildquickpackage/id/' . ($hotelproposal['TPSysId'])); ?>" target="_blank">Open Proposal</a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/leaddetail/view-sent-proposal-email/proposalId/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-target="#viewsentproposalemail" data-toggle="modal">View Email</a>
                                            <?php } ?>
                                        </td>
                                        <td class="small">
                                            <span id="status_<?php echo $h; ?>" class="proposalStatus"><?php echo $travelPlanStatusName[$hotelproposal['StatusType']]['TPStatus']; ?>
                                                <?php $departuredate_exp = explode("/", $departuredate);
                                                $newStartDate = isset($departuredate_exp[2]) ? $departuredate_exp[2] . "-" . $departuredate_exp[1] . "-" . $departuredate_exp[0] : date('Y-m-d');
                                                $hotelToDate = strtotime($newStartDate);
                                                $curdate = strtotime(date('Y-m-d'));

                                                if ($curdate > $hotelToDate) {
                                                    $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($hotelproposal['StatusType'], 1, 'visa', 2, 15);
                                                } else {
                                                    $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($hotelproposal['StatusType'], '', 'visa', 2, 15);
                                                }
                                                $openAddModalToDo = "actionChangeProposalStatusAddIteration('" . base64_encode($hotelproposal['TPSysId']) . "',$h,'visa_" . $hotelproposal['TPSysId'] . "'," . $hotelproposal['MasterTPSysId'] . "," . $hotelproposal['CustomerSysId'] . ",'" . base64_encode(27) . "','$proposalID', '" . trim($hotelproposal['CustomerSysId']) . "','" . trim($hotelproposal['ownerName']) . "','" . $hotelproposal['AgentSysId'] . "',this)";
                                                if ($hotelproposal['hasIteration']) {
                                                ?>
                                                    <br /><a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getItineraryRequired('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['TPSysId']; ?>', $(this).attr('func') );" title="View changes required list" style="color:#0e931d;">
                                                        Changes
                                                    </a>
                                                <?php
                                                } else {
                                                ?>
                                                    <br /> <a click-src="itinerary" href="javascript:void(0);" title="Add Changes" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
																   '<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"><i class="fa fa-plus"></i> Changes
                                                    </a>
                                                <?php
                                                }
                                                echo ' | ';
                                                if ($hotelproposal['hasFollowUp']) {
                                                ?>
                                                    <a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getFollowUp('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['MasterTPSysId']; ?>',$(this).attr('func'));" title="View follow up list" style="color:#0e931d;">
                                                        Follow Ups</a>
                                                <?php } else {
                                                ?>
                                                    <a click-src="addtodo" href="javascript:void(0);" title="Add Follow Up" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
																								'<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"><i class="fa fa-plus"></i> Follow Up
                                                    </a>
                                                <?php
                                                }
                                                ?>
                                            </span>
                                        </td>
                                        <td class="small"><?php echo $hotelproposal['UpdateDate'] ? $hotelproposal['UpdateDate']->format('d-M-y') : ''; ?></td>
                                        <td class="small" style="white-space:nowrap; text-align:center;" align="center">

                                            <?php //if(count($chatDetails)>0){
                                            if (!empty($chatDetails)) { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments orange"></i></a>
                                            <?php } //} else { 
                                            ?> <a style="display:none;" href="javascript:void(0);" onclick="alert('No chat history found!')"><i class="fa fa-comments gray"></i></a><?php //} 
                                                                                                                                                                                    ?>

                                            <!--<a href="javascript:void(0);" onclick="alert('Under construction.Please try after some time.');return false;" data-toggle="modal" data-target="#myModa1Reply"><i class="fa fa-comments view_text1"></i></a>-->
                                        </td>
                                        <td class="small" style="white-space:nowrap; text-align:center;display:none" align="center">
                                            <?php //if(count($chatDetails)>0){
                                            if ($chatDetails['IsAgent'] == 0) { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments orange"></i></a>
                                            <?php } //} else { 
                                            ?> <a style="display:none;" href="javascript:void(0);" onclick="alert('No chat history found!')"><i class="fa fa-comments gray"></i></a><?php //} 
                                                                                                                                                                                    ?>
                                            <!--<a href="javascript:void(0);" onclick="alert('Under construction.Please try after some time.');return false;" data-toggle="modal" data-target="#myModa1Reply"><i class="fa fa-comments orange"></i></a>-->
                                        </td>
                                        <td class="small" style="white-space:nowrap;">
                                            <?php
                                            echo $this->partial('leaddetail/leadstatusdropdownpartial.phtml', array('proposalDetails' => $hotelproposal, 'allStatusDisplayArrayById' => $allStatusDisplayArrayById, 'loopId' => $h, 'IsAdmin' => $this->IsAdmin, 'intLoggedinUserId'=>$this->intLoggedinUserId));
                                            ?>
                                            <a data-target="#myModalSendSMSToDoCustomer" class="btn btn-xs tooltipLink" title='Send Sms' href="<?php echo $this->baseUrl('/leaddetail/view-sms-template-to-customer/cid/' . base64_encode($hotelproposal['CustomerSysId']) . '/tpid/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-toggle="modal"><i class="tooltipLink fa fa-comment-o btn btn-primary btn-xs"></i></a>
                                        </td>
                                    </tr>
                                <?php $h++;
                                }
                            } else { ?>
                                <tr>
                                    <td colspan="14" align="center"><strong>No Proposal Found, <a href="javascript:void(0);" class="createleadsnorecord">Click Here</a> to create new proposal</strong></td>
                                </tr>
                                <?php }
                        }
                        if ($this->leadDetail[0]['PlanType'] == 7) { // for forex
                            //echo "<pre>";print_r($record);
                            if ($totalrec > 0) {
                                $h = 0;
                                $objPkgBooking = new Travel_Model_TblPackageBooking();
                                foreach ($record as $hotelproposal) {

                                    $arrAmountPaid = $objPkgBooking->getAmountPaidForProposalByTPSysId($hotelproposal['TPSysId']);

                                    $TotalAmountPaid = !empty($arrAmountPaid['TotalAmountPaid']) ? $arrAmountPaid['TotalAmountPaid'] : 0;
                                    $proposalID = 'D/' . date('y') . '/' . $hotelproposal['TPSysId'] . "/" . 'V' . $hotelproposal['VersionId'];
                                    $chatDetails = $objTravelModel->GetCustomerChatHistoryDetailsById($hotelproposal['TPSysId']);
                                    //echo "<pre>";print_r($$hotelproposal);
                                    $CurrencyType = $hotelproposal['CurrencyType'] > 0 ? $hotelproposal['CurrencyType'] : 1;
                                    $currencySymbol = $customhelper->GetCurrencyByCurrencyType($CurrencyType);
                                    $returndate = '';
                                    $departuredate = '';
                                    $paxTOtalArr = json_decode($hotelproposal['RoomInfoJson']);
                                    if (!empty($paxTOtalArr)) {
                                        foreach ($paxTOtalArr as $PaxTotal) {
                                            $departuredate = (trim($PaxTotal->departuredate) != '') ? DateTime::createFromFormat('d/m/Y', @$PaxTotal->departuredate) : '';
                                            $returndate = (trim($PaxTotal->returndate) != '') ? DateTime::createFromFormat('d/m/Y', @$PaxTotal->returndate) : '';

                                            $departuredate = (isset($PaxTotal->departuredate) && trim($PaxTotal->departuredate) != '') ? @$departuredate->format('d-M-y') : '';
                                            $returndate = (isset($PaxTotal->returndate) && trim($PaxTotal->returndate) != '') ? trim(@$returndate->format('d-M-y')) : '';
                                        }
                                    }
                                ?>
                                    <tr>
                                        <td class="small"><?php echo $proposalID; ?> (PId-<?php echo trim($hotelproposal['TPId']); ?>)
                                            <?php if (!empty($hotelproposal['EmailText'])) { ?>
                                                <a style="display:none;" href="javascript:void(0);" title="<?php echo !empty($hotelproposal['EmailText']) ? stripslashes(trim($hotelproposal['EmailText'])) : 'NA'; ?>">Email Text</a>
                                            <?php } ?>
                                        </td>
                                        <td class="small"><?php echo $hotelproposal['CreateDate'] ? $hotelproposal['CreateDate']->format('d-M-y') : ''; ?></td>
                                        <td class="small"><?php echo $departuredate;
                                                            echo trim($returndate) != '' ? " - " . $returndate : ''; ?></td>
                                        <td class="small"><?php echo $customhelper->getPlanTypeName($hotelproposal['PlanType']); ?></td>
                                        <td class="small"><?php echo $hotelproposal['EmailDestination'] ? stripslashes($hotelproposal['EmailDestination']) : stripslashes(trim($hotelproposal['DestinationPlaces'])); ?></td>
                                        <td class="small">
                                            <?php
                                            if ($hotelproposal['Readymade'] == 1) {
                                                //$helperInstance =  $this->getHelper("proposals");
                                                //$suppliercount = $helperInstance->suppliers($hotelproposal['TPSysId']);
                                                $suppliercount = array();
                                                $totalsupplier = $suppliercount ? count($suppliercount) : 0;
                                                $suppIds = array();
                                                if (!empty($suppliercount)) {
                                                    foreach ($suppliercount as $k => $v) {
                                                        $suppIds[] = $v['SupplierSysId'];
                                                    }
                                                }
                                                $allSuppIds = implode(",", $suppIds);

                                                if (isset($allSuppIds) && !empty($allSuppIds)) { ?>
                                                    <a href="<?php echo $allSuppIds ? $this->baseUrl('/leaddetail/lead-supplier-detail/id/' . base64_encode($hotelproposal['TPSysId']) . '/sid/' . base64_encode($allSuppIds)) : ''; ?>" data-target="#viewquotesupplier" data-toggle="modal"><?php echo $totalsupplier; ?></a>
                                                    <input type="hidden" name="supplierhiddenids" value="<?php echo implode(",", $suppIds); ?>" />
                                                <?php }
                                            } else {
                                                ?>
                                                <a href="<?php echo $this->baseUrl('/leaddetail/lead-supplier-detail-dynamic/id/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-target="#viewquotesupplier" data-toggle="modal">View</a>
                                            <?php } ?>
                                        </td>
                                        <td class="small" style="white-space:nowrap; text-align:center;">
                                            <?php echo $currencySymbol['Symbol']; ?> <?php echo $hotelproposal['Price'] ? ($hotelproposal['Price']) : 0; ?>
                                            <?php //echo $currencySymbol['Symbol'];
                                            ?> <?php //echo $hotelproposal['Price'] ? ($hotelproposal['Price']+$hotelproposal['GTXMarkUp']+$hotelproposal['XServiceTaxAmount']+$hotelproposal['GTXServiceTaxAmount'])-($hotelproposal['CustomDiscount']+$hotelproposal['ServiceTaxOnCustomDiscount']) : 0;
                                                ?></td>
                                        <td class="small" style="white-space:nowrap; text-align:center;">
                                            <?php if ($hotelproposal['IsPriceShared'] == 1) {
                                                echo $currencySymbol['Symbol']; ?> <?php echo $hotelproposal['NetPrice'] ? ($hotelproposal['NetPrice']) : 0;
                                                                                } else {
                                                                                    echo $hotelproposal['PriceRange'];
                                                                                }
                                                                                    ?>
                                        </td>
                                        <td class="small"><?php echo !empty($hotelproposal['ProposalEmailTo']) ? $hotelproposal['ProposalEmailTo'] : $hotelproposal['EmailId']; ?>
                                            <?php if ($hotelproposal['PackSpecType'] == 4 && $hotelproposal['StatusType'] == 16) { ?>
                                                <a href="<?php echo $this->baseUrl('/packagesearch/buildquickpackage/id/' . ($hotelproposal['TPSysId'])); ?>" target="_blank">Open Proposal</a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/leaddetail/view-sent-package-email/proposalId/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-target="#viewsentemail" data-toggle="modal">View Email</a>
                                            <?Php } ?>
                                        </td>
                                        <td class="small">
                                            <span id="status_<?php echo $h; ?>" class="proposalStatus"><?php echo $travelPlanStatusName[$hotelproposal['StatusType']]['TPStatus']; ?>
                                                <?php
                                                $hotelToDate = strtotime($hotelproposal['PkgSellValidTill']->format('Y-m-d'));
                                                $curdate = strtotime(date('Y-m-d'));

                                                if ($curdate > $hotelToDate) {
                                                    $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($hotelproposal['StatusType'], 1, 'package', 2, 15);
                                                } else {
                                                    $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($hotelproposal['StatusType'], '', 'package', 2, 15);
                                                }

                                                /*
                                                $key_iteration_status = array_search( 8 , array_column( $allStatusDisplayArrayById , 'ComponentType')); // search if iteration exists in array
                                                if( $key_iteration_status ) {
                                                    ?>
                                                <br/><a click-src="itinerary" href="javascript:void(0);" title="Add Iteration/Follow Up" class="" style="color: #9EDA9E"
                                                   onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
                                                                                            '<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);" >Add Iteration/Follow Up
                                                </a>
                                                <?php
                                                }
                                                 *
                                                 */
                                                $openAddModalToDo = "actionChangeProposalStatusAddIteration('" . base64_encode($hotelproposal['TPSysId']) . "',$h,'package_" . $hotelproposal['TPSysId'] . "'," . $hotelproposal['MasterTPSysId'] . "," . $hotelproposal['CustomerSysId'] . ",'" . base64_encode(27) . "','$proposalID', '" . trim($hotelproposal['CustomerSysId']) . "','" . trim($hotelproposal['ownerName']) . "','" . $hotelproposal['AgentSysId'] . "',this)";
                                                if ($hotelproposal['hasIteration']) {
                                                ?>
                                                    <br /><a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getItineraryRequired('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['TPSysId']; ?>', $(this).attr('func') );" title="View changes required list" style="color:#0e931d;">
                                                        Changes
                                                    </a>
                                                <?php
                                                } else {
                                                ?>
                                                    <br /> <a click-src="itinerary" href="javascript:void(0);" title="Add Changes" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
                   '<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"><i class="fa fa-plus"></i> Changes
                                                    </a>
                                                <?php
                                                }
                                                echo ' | ';
                                                if ($hotelproposal['hasFollowUp']) {
                                                ?>
                                                    <a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getFollowUp('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['MasterTPSysId']; ?>',$(this).attr('func'));" title="View follow up list" style="color:#0e931d;">
                                                        Follow Ups</a>
                                                <?php } else {
                                                ?>
                                                    <a click-src="addtodo" href="javascript:void(0);" title="Add Follow Up" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
                                                '<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"><i class="fa fa-plus"></i> Follow Up
                                                    </a>
                                                <?php
                                                }                                                ?>

                                            </span>
                                        </td>
                                        <td class="small"><?php echo $hotelproposal['UpdateDate'] ? $hotelproposal['UpdateDate']->format('d-M-y') : ''; ?></td>
                                        <td class="small" style="white-space:nowrap; text-align:center;" align="center">

                                            <?php //if(count($chatDetails)>0){
                                            if (!empty($chatDetails)) { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments orange"></i></a>
                                            <?php } //} else { 
                                            ?> <a style="display:none;" href="javascript:void(0);" onclick="alert('No chat history found!')"><i class="fa fa-comments gray"></i></a><?php //} 
                                                                                                                                                                                    ?>

                                            <!--<a href="javascript:void(0);" onclick="alert('Under construction.Please try after some time.');return false;" data-toggle="modal" data-target="#myModa1Reply"><i class="fa fa-comments view_text1"></i></a>-->
                                        </td>
                                        <td class="small" style="white-space:nowrap; text-align:center;display:none;" align="center">
                                            <?php //if(count($chatDetails)>0){
                                            if ($chatDetails['IsAgent'] == 0) { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments orange"></i></a>
                                            <?php } //} else { 
                                            ?> <a style="display:none;" href="javascript:void(0);" onclick="alert('No chat history found!')"><i class="fa fa-comments gray"></i></a><?php //} 
                                                                                                                                                                                    ?>
                                            <!--<a href="javascript:void(0);" onclick="alert('Under construction.Please try after some time.');return false;" data-toggle="modal" data-target="#myModa1Reply"><i class="fa fa-comments orange"></i></a>-->
                                        </td>
                                        <td class="small" style="white-space:nowrap;">
                                            <?php

                                            $isPkgReadymade = $hotelproposal['Readymade'];
                                            $pkgId = $hotelproposal['TPSysId'];
                                            //echo $hotelproposal['PackSpecType']
                                            $modifyPackageLink = '';
                                            if ($hotelproposal['PackSpecType'] == 4) {
                                                $modifyPackageLink = '#';
                                                $viewPackageLink = $this->baseUrl('/publicpackage/view-customer-final-package/id/' . base64_encode($hotelproposal['TPSysId']));
                                                $modifyPkgOnclick = "editReadymadeQuickPackageProposal('$pkgId')";
                                            } else if ($isPkgReadymade == 0) {
                                                //link for BYO package
                                                $secureCode = Zend_Controller_Action_HelperBroker::getStaticHelper('SecureCode')->secureCode(base64_encode($hotelproposal['TPSysId']), 1);
                                                $viewPackageLink = $this->baseUrl('/package-booking/package-booking-view/pid/' . base64_encode($hotelproposal['TPSysId']) . '/ptype/f/code/' . $secureCode);
                                                $modifyPackageLink = "#";
                                                $modifyPkgOnclick = "modifyByoPackageProposal('$pkgId')";
                                            } else {
                                                $modifyPackageLink = '#';
                                                $modifyPkgOnclick = "modifyReadymadePackageProposal('$pkgId')";
                                                //													if(empty($hotelproposal['IsPriceShared'])){
                                                //link for itenary based
                                                //														$viewPackageLink=$this->baseUrl('/publicpackage/view-customer-proposal/id/'.base64_encode($hotelproposal['TPSysId']));
                                                //$modifyPackageLink=$this->baseUrl('/package/add-flexi-package/id/'.$hotelproposal['TPSysId']);
                                                //													}else {
                                                //link for onlyhotel based
                                                $viewPackageLink = $this->baseUrl('/publicpackage/view-customer-final-package/id/' . base64_encode($hotelproposal['TPSysId']) . '/code/' . $secureCode);
                                                //$modifyPackageLink=$this->baseUrl('/package/add-flexi-package/id/'.$hotelproposal['TPSysId']);
                                                //													}
                                            }
                                            $bookNowLink = $viewPackageLink;
                                            $cancelLink = '#';
                                            ?>
                                            <div class="btn-group" id="package_<?php echo $hotelproposal['TPSysId']; ?>">
                                                <button type="button" class="btn btn-danger btn-sm dropdown-toggle" data-toggle="dropdown">
                                                    Select <span class="caret"></span>

                                                </button>
                                                <ul class="dropdown-menu pull-right" role="menu">
                                                    <?php //"proposalModuleComp";

                                                    if (!empty($allStatusDisplayArrayById)) {
                                                        foreach ($allStatusDisplayArrayById as $keyid => $keyval) {

                                                            switch ($keyval['ComponentType']) {
                                                                case 1:
                                                    ?>
                                                                    <li><a href="<?php echo $viewPackageLink; ?>" target="_blank"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                    break;
                                                                case 2:
                                                                    if ($hotelproposal['PackSpecType'] != 3) {
                                                                    ?>
                                                                        <li><a onclick="return <?php echo $modifyPkgOnclick; ?>" href="javascript:void(0);<?php //echo $modifyPackageLink; 
                                                                                                                                                            ?>"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                    }
                                                                    break;
                                                                case 3:
                                                                    if ($isPkgReadymade == 0) { ?>
                                                                        <li><a href="javascript:void(0);" onclick="actionPackageSendProposal('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'url')"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php } else { ?>
                                                                        <li><a href="javascript:void(0);" onclick="actionReadymadePackageSendProposal('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'url')"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php }
                                                                    break;
                                                                case 4:
                                                                    ?>
                                                                    <li><a href="<?php echo $viewPackageLink; ?>" target="_blank"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                <?php
                                                                    break;
                                                                case 5:
                                                                ?>
                                                                    <li><a href="javascript:void(0);" onclick="actionChangeProposalStatus('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(15); ?>')"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                <?php
                                                                    break;
                                                                case 6:
                                                                ?>
                                                                    <li><a href="<?php echo $cancelLink; ?>" target="_blank"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                <?php
                                                                    break;
                                                                case 7:
                                                                ?>
                                                                    <li><a onclick="alert('Work in progress');"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                    break;
                                                                    //																	case 8:
                                                                    ?>
                                                                    <!--																	<li><a href="javascript:void(0);" onclick="actionChangeProposalStatus('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>')"><?php echo stripslashes($keyval['Title']); ?></a></li>-->
                                                                <?php
                                                                    //																	break;
                                                                case 8:
                                                                    // iteration require case : onclick function change here by Ranvir singh on 27 Sep
                                                                ?>
                                                                    <li><a href="javascript:void(0);" title="Add changes Required" click-src="itinerary" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
                                                                                            '<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                    break;
                                                                case 9:
                                                                    if ($hotelproposal['StatusType'] != 17) {
                                                                    ?>
                                                                        <li><a onclick="updatePayment('<?php echo $hotelproposal['TPSysId']; ?>','<?php echo round($hotelproposal['NetPrice']); ?>','<?php echo round($TotalAmountPaid); ?>');"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                    <?php
                                                                    }
                                                                    break;
                                                                case 10:
                                                                    ?>
                                                                    <li><a target="_blank" href="<?php echo $this->baseUrl('/package-booking/package-booking-voucher/pid/' . base64_encode($hotelproposal['TPSysId']) . '/pid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                                <?php
                                                                    break;
                                                                case 11:
                                                                ?>
                                                                    <li><a target="_blank" href="<?php echo $this->baseUrl('/package-booking/package-booking-invoice/pid/' . base64_encode($hotelproposal['TPSysId']) . '/pid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>"><?php echo stripslashes($keyval['Title']); ?></a></li>
                                                            <?php
                                                                    break;
                                                            } // end swich
                                                            ?>
                                                    <?php
                                                        }
                                                    }
                                                    ?>
                                                </ul>
                                            </div>
                                            <a data-target="#myModalSendSMSToDoCustomer" class="btn btn-xs tooltipLink" title='Send Sms' href="<?php echo $this->baseUrl('/leaddetail/view-sms-template-to-customer/cid/' . base64_encode($hotelproposal['CustomerSysId']) . '/tpid/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-toggle="modal"><i class="tooltipLink fa fa-comment-o btn btn-primary btn-xs"></i></a>
                                        </td>
                                    </tr>
                                <?php $h++;
                                }
                            } else { ?>
                                <tr>
                                    <td colspan="14" align="center"><strong>No Proposal Found, <a href="javascript:void(0);" class="createleadsnorecord">Click Here</a> to create new proposal</strong></td>
                                </tr>
                                <?php }
                        }
                        if ($this->leadDetail[0]['PlanType'] == 8) { // for activity
                            //echo "<pre>";print_r($record);
                            if ($totalrec > 0) {
                                $h = 0;
                                $objPkgBooking = new Travel_Model_TblPackageBooking();
                                foreach ($record as $hotelproposal) {
                                    $arrAmountPaid = $objPkgBooking->getAmountPaidForProposalByTPSysId($hotelproposal['TPSysId']);
                                    $TotalAmountPaid = !empty($arrAmountPaid['TotalAmountPaid']) ? $arrAmountPaid['TotalAmountPaid'] : 0;
                                    $proposalID = 'D/' . date('y') . '/' . $hotelproposal['TPSysId'] . "/" . 'V' . $hotelproposal['VersionId'];
                                    $chatDetails = $objTravelModel->GetCustomerChatHistoryDetailsById($hotelproposal['TPSysId']);
                                    //echo "<pre>";print_r($hotelproposal);die;
                                    $CurrencyType = $hotelproposal['CurrencyType'] > 0 ? $hotelproposal['CurrencyType'] : 1;
                                    $currencySymbol = $customhelper->GetCurrencyByCurrencyType($CurrencyType);
                                    $returndate = '';
                                    $departuredate = '';
                                    $paxTOtalArr = json_decode($hotelproposal['RoomInfoJson']);
                                    if (!empty($paxTOtalArr)) {
                                        foreach ($paxTOtalArr as $PaxTotal) {
                                            $departuredate = (trim($PaxTotal->departuredate) != '') ? DateTime::createFromFormat('d/m/Y', @$PaxTotal->departuredate) : '';
                                            $returndate = (trim($PaxTotal->returndate) != '') ? DateTime::createFromFormat('d/m/Y', @$PaxTotal->returndate) : '';

                                            $departuredate = (isset($PaxTotal->departuredate) && trim($PaxTotal->departuredate) != '') ? @$departuredate->format('d-M-y') : '';
                                            $returndate = (isset($PaxTotal->returndate) && trim($PaxTotal->returndate) != '') ? trim(@$returndate->format('d-M-y')) : '';
                                        }
                                    }
                                    //$suppliercount = $helperInstance->suppliers($hotelproposal['TPSysId']);
                                    $suppliercount = array();
                                    $totalsupplier = $suppliercount ? count($suppliercount) : 0;
                                    $suppIds = array();
                                    if (!empty($suppliercount)) {
                                        foreach ($suppliercount as $k => $v) {
                                            $suppIds[] = $v['SupplierSysId'];
                                        }
                                    }
                                    $allSuppIds = $suppIds ? implode(",", $suppIds) : 0;
                                ?>
                                    <tr>
                                        <td class="small"><?php echo $proposalID; ?> (PId-<?php echo trim($hotelproposal['TPId']); ?>)
                                            <?php if (!empty($hotelproposal['EmailText'])) { ?>
                                                <a style="display:none;" href="javascript:void(0);" title="<?php echo !empty($hotelproposal['EmailText']) ? stripslashes(trim($hotelproposal['EmailText'])) : 'NA'; ?>">Email Text</a>
                                            <?php } ?>
                                        </td>
                                        <td class="small"><?php echo $hotelproposal['CreateDate'] ? $hotelproposal['CreateDate']->format('d-M-y') : ''; ?></td>
                                        <td class="small"><?php echo $departuredate;
                                                            echo trim($returndate) != '' ? " - " . $returndate : ''; ?></td>
                                        <td class="small"><?php echo $customhelper->getPlanTypeName($hotelproposal['PlanType']); ?></td>
                                        <td class="small"><?php echo $hotelproposal['EmailDestination'] ? stripslashes($hotelproposal['EmailDestination']) : stripslashes(trim($hotelproposal['DestinationPlaces'])); ?></td>
                                        <td class="small">
                                            <a href="<?php echo $this->baseUrl('/leaddetail/lead-supplier-detail/id/' . base64_encode($hotelproposal['TPSysId']) . '/sid/' . base64_encode($allSuppIds)); ?>" data-target="#viewquotesupplier" data-toggle="modal">View</a>
                                        </td>
                                        <td class="small" style="white-space:nowrap; text-align:center;">
                                            <?php echo $currencySymbol['Symbol']; ?> <?php echo $hotelproposal['Price'] ? ($hotelproposal['Price']) : 0; ?>
                                        <td class="small" style="white-space:nowrap; text-align:center;">
                                            <?php echo $currencySymbol['Symbol']; ?> <?php echo $hotelproposal['NetPrice'] ? ($hotelproposal['NetPrice']) : 0; ?>
                                        </td>
                                        <td class="small"><?php echo !empty($hotelproposal['ProposalEmailTo']) ? $hotelproposal['ProposalEmailTo'] : $hotelproposal['EmailId']; ?>
                                            <?php if ($hotelproposal['PackSpecType'] == 4 && $hotelproposal['StatusType'] == 16) { ?>
                                                <a href="<?php echo $this->baseUrl('/packagesearch/buildquickpackage/id/' . ($hotelproposal['TPSysId'])); ?>" target="_blank">Open Proposal</a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/leaddetail/view-sent-proposal-email/proposalId/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-target="#viewsentproposalemail" data-toggle="modal">View Email</a>
                                            <?php } ?>
                                        </td>
                                        <td class="small">
                                            <span id="status_<?php echo $h; ?>" class="proposalStatus"><?php echo $travelPlanStatusName[$hotelproposal['StatusType']]['TPStatus']; ?>
                                                <?php $departuredate_exp = explode("/", $departuredate);
                                                $newStartDate = $departuredate_exp[2] . "-" . $departuredate_exp[1] . "-" . $departuredate_exp[0];
                                                $hotelToDate = strtotime($newStartDate);
                                                $curdate = strtotime(date('Y-m-d'));

                                                if ($curdate > $hotelToDate) {
                                                    $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($hotelproposal['StatusType'], 1, 'activity', 2, 15);
                                                } else {
                                                    $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($hotelproposal['StatusType'], '', 'activity', 2, 15);
                                                }
                                                $openAddModalToDo = "actionChangeProposalStatusAddIteration('" . base64_encode($hotelproposal['TPSysId']) . "',$h,'package_" . $hotelproposal['TPSysId'] . "'," . $hotelproposal['MasterTPSysId'] . "," . $hotelproposal['CustomerSysId'] . ",'" . base64_encode(27) . "','$proposalID', '" . trim($hotelproposal['CustomerSysId']) . "','" . trim($hotelproposal['ownerName']) . "','" . $hotelproposal['AgentSysId'] . "',this)";

                                                if ($hotelproposal['hasIteration']) {
                                                ?>
                                                    <br /><a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getItineraryRequired('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['TPSysId']; ?>', $(this).attr('func') );" title="View changes required list" style="color:#0e931d;">
                                                        Changes
                                                    </a>
                                                <?php
                                                } else {
                                                ?>
                                                    <br /> <a click-src="itinerary" href="javascript:void(0);" title="Add Changes" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
																   '<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"><i class="fa fa-plus"></i> Changes
                                                    </a>
                                                <?php
                                                }
                                                echo ' | ';
                                                if ($hotelproposal['hasFollowUp']) {
                                                ?>
                                                    <a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getFollowUp('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['MasterTPSysId']; ?>',$(this).attr('func'));" title="View follow up list" style="color:#0e931d;">
                                                        Follow Ups</a>
                                                <?php } else {
                                                ?>
                                                    <a click-src="addtodo" href="javascript:void(0);" title="Add Follow Up" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>','<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"><i class="fa fa-plus"></i> Follow Up</a>
                                                <?php
                                                }
                                                ?>
                                            </span>
                                        </td>
                                        <td class="small"><?php echo $hotelproposal['UpdateDate'] ? $hotelproposal['UpdateDate']->format('d-M-y') : ''; ?></td>
                                        <td class="small" style="white-space:nowrap; text-align:center;" align="center">

                                            <?php //if(count($chatDetails)>0){
                                            if (!empty($chatDetails)) { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments orange"></i></a>
                                            <?php } //} else { 
                                            ?> <a style="display:none;" href="javascript:void(0);" onclick="alert('No chat history found!')"><i class="fa fa-comments gray"></i></a><?php //} 
                                                                                                                                                                                    ?>

                                            <!--<a href="javascript:void(0);" onclick="alert('Under construction.Please try after some time.');return false;" data-toggle="modal" data-target="#myModa1Reply"><i class="fa fa-comments view_text1"></i></a>-->
                                        </td>
                                        <td class="small" style="white-space:nowrap; text-align:center;display:none;" align="center">
                                            <?php //if(count($chatDetails)>0){
                                            if ($chatDetails['IsAgent'] == 0) { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments orange"></i></a>
                                            <?php } //} else { 
                                            ?> <a style="display:none;" href="javascript:void(0);" onclick="alert('No chat history found!')"><i class="fa fa-comments gray"></i></a><?php //} 
                                                                                                                                                                                    ?>
                                            <!--<a href="javascript:void(0);" onclick="alert('Under construction.Please try after some time.');return false;" data-toggle="modal" data-target="#myModa1Reply"><i class="fa fa-comments orange"></i></a>-->
                                        </td>
                                        <td class="small" style="white-space:nowrap;">
                                            <?php
                                            echo $this->partial('leaddetail/leadstatusdropdownpartial.phtml', array('proposalDetails' => $hotelproposal, 'allStatusDisplayArrayById' => $allStatusDisplayArrayById, 'loopId' => $h, 'IsAdmin' => $this->IsAdmin, 'intLoggedinUserId'=>$this->intLoggedinUserId));
                                            ?>
                                            <a data-target="#myModalSendSMSToDoCustomer" class="btn btn-xs tooltipLink" title='Send Sms' href="<?php echo $this->baseUrl('/leaddetail/view-sms-template-to-customer/cid/' . base64_encode($hotelproposal['CustomerSysId']) . '/tpid/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-toggle="modal"><i class="tooltipLink fa fa-comment-o btn btn-primary btn-xs"></i></a>
                                        </td>
                                    </tr>
                                <?php $h++;
                                }
                            } else { ?>
                                <tr>
                                    <td colspan="14" align="center"><strong>No Proposal Found, <a href="javascript:void(0);" class="createleadsnorecord">Click Here</a> to create new proposal</strong></td>
                                </tr>
                                <?php }
                        }
                        if ($this->leadDetail[0]['PlanType'] == 9) { //for sight seeing
                            //echo "<pre>";print_r($record);
                            if ($totalrec > 0) {
                                $h = 0;
                                $objPkgBooking = new Travel_Model_TblPackageBooking();
                                foreach ($record as $hotelproposal) {

                                    $arrAmountPaid = $objPkgBooking->getAmountPaidForProposalByTPSysId($hotelproposal['TPSysId']);
                                    $TotalAmountPaid = !empty($arrAmountPaid['TotalAmountPaid']) ? $arrAmountPaid['TotalAmountPaid'] : 0;
                                    $proposalID = 'D/' . date('y') . '/' . $hotelproposal['TPSysId'] . "/" . 'V' . $hotelproposal['VersionId'];
                                    $chatDetails = $objTravelModel->GetCustomerChatHistoryDetailsById($hotelproposal['TPSysId']);
                                    //echo "<pre>";print_r($$hotelproposal);
                                    $CurrencyType = $hotelproposal['CurrencyType'] > 0 ? $hotelproposal['CurrencyType'] : 1;
                                    $currencySymbol = $customhelper->GetCurrencyByCurrencyType($CurrencyType);
                                    $returndate = '';
                                    $departuredate = '';
                                    $paxTOtalArr = json_decode($hotelproposal['RoomInfoJson']);
                                    if (!empty($paxTOtalArr)) {
                                        foreach ($paxTOtalArr as $PaxTotal) {
                                            $departuredate = (trim($PaxTotal->departuredate) != '') ? DateTime::createFromFormat('d/m/Y', @$PaxTotal->departuredate) : '';
                                            $returndate = (trim($PaxTotal->returndate) != '') ? DateTime::createFromFormat('d/m/Y', @$PaxTotal->returndate) : '';

                                            $departuredate = (isset($PaxTotal->departuredate) && trim($PaxTotal->departuredate) != '') ? @$departuredate->format('d-M-y') : '';
                                            $returndate = (isset($PaxTotal->returndate) && trim($PaxTotal->returndate) != '') ? trim(@$returndate->format('d-M-y')) : '';
                                        }
                                    }
                                ?>
                                    <tr>
                                        <td class="small"><?php echo $proposalID; ?> (PId-<?php echo trim($hotelproposal['TPId']); ?>)
                                            <?php if (!empty($hotelproposal['EmailText'])) { ?>
                                                <a style="display:none;" href="javascript:void(0);" title="<?php echo !empty($hotelproposal['EmailText']) ? stripslashes(trim($hotelproposal['EmailText'])) : 'NA'; ?>">Email Text</a>
                                            <?php } ?>
                                        </td>
                                        <td class="small"><?php echo $hotelproposal['CreateDate'] ? $hotelproposal['CreateDate']->format('d-M-y') : ''; ?></td>
                                        <td class="small"><?php echo $departuredate;
                                                            echo trim($returndate) != '' ? " - " . $returndate : ''; ?></td>
                                        <td class="small"><?php echo $customhelper->getPlanTypeName($hotelproposal['PlanType']); ?></td>
                                        <td class="small"><?php echo $hotelproposal['EmailDestination'] ? stripslashes($hotelproposal['EmailDestination']) : stripslashes(trim($hotelproposal['DestinationPlaces'])); ?></td>
                                        <td class="small">
                                            <a href="<?php echo $this->baseUrl('/leaddetail/lead-supplier-detail-dynamic/id/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-target="#viewquotesupplier" data-toggle="modal">View</a>
                                        </td>
                                        <td class="small" style="white-space:nowrap; text-align:center;">
                                            <?php echo $currencySymbol['Symbol']; ?> <?php echo $hotelproposal['Price'] ? ($hotelproposal['Price']) : 0; ?>
                                        <td class="small" style="white-space:nowrap; text-align:center;">
                                            <?php echo $currencySymbol['Symbol']; ?> <?php echo $hotelproposal['NetPrice'] ? ($hotelproposal['NetPrice']) : 0; ?>
                                        </td>
                                        <td class="small"><?php echo !empty($hotelproposal['ProposalEmailTo']) ? $hotelproposal['ProposalEmailTo'] : $hotelproposal['EmailId']; ?>
                                            <?php if ($hotelproposal['PackSpecType'] == 4 && $hotelproposal['StatusType'] == 16) { ?>
                                                <a href="<?php echo $this->baseUrl('/packagesearch/buildquickpackage/id/' . ($hotelproposal['TPSysId'])); ?>" target="_blank">Open Proposal</a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/leaddetail/view-sent-proposal-email/proposalId/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-target="#viewsentproposalemail" data-toggle="modal">View Email</a>
                                            <?php } ?>
                                        </td>
                                        <td class="small">
                                            <span id="status_<?php echo $h; ?>" class="proposalStatus"><?php echo $travelPlanStatusName[$hotelproposal['StatusType']]['TPStatus']; ?>
                                                <?php
                                                $departuredate_exp = explode("/", $departuredate);
                                                $newStartDate = $departuredate_exp[2] . "-" . $departuredate_exp[1] . "-" . $departuredate_exp[0];
                                                $hotelToDate = strtotime($newStartDate);
                                                $curdate = strtotime(date('Y-m-d'));

                                                if ($curdate > $hotelToDate) {
                                                    $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($hotelproposal['StatusType'], 1, 'sightseeing', 2, 15);
                                                } else {
                                                    $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($hotelproposal['StatusType'], '', 'sightseeing', 2, 15);
                                                }

                                                /*                                                $key_iteration_status = array_search( 8 , array_column( $allStatusDisplayArrayById , 'ComponentType')); // search if iteration exists in array
                                                if( $key_iteration_status ) {
                                                    ?>
                                                <br/><a href="javascript:void(0);" title="Add Iteration Required" class="lightGreen"
                                                   onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
                                                                                            '<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);" >Add Iteration Required
                                                </a>
                                                <?php
                                                }
 *
 */
                                                $openAddModalToDo = "actionChangeProposalStatusAddIteration('" . base64_encode($hotelproposal['TPSysId']) . "',$h,'package_" . $hotelproposal['TPSysId'] . "'," . $hotelproposal['MasterTPSysId'] . "," . $hotelproposal['CustomerSysId'] . ",'" . base64_encode(27) . "','$proposalID', '" . trim($hotelproposal['CustomerSysId']) . "','" . trim($hotelproposal['ownerName']) . "','" . $hotelproposal['AgentSysId'] . "',this)";

                                                if ($hotelproposal['hasIteration']) {
                                                ?>
                                                    <br /><a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getItineraryRequired('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['TPSysId']; ?>', $(this).attr('func') );" title="View changes required list" style="color:#0e931d;">
                                                        Changes
                                                    </a>
                                                <?php
                                                } else {
                                                ?>
                                                    <br /> <a click-src="itinerary" href="javascript:void(0);" title="Add Changes" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
															   '<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"><i class="fa fa-plus"></i> Changes
                                                    </a>
                                                <?php
                                                }
                                                echo ' | ';
                                                if ($hotelproposal['hasFollowUp']) {
                                                ?>
                                                    <a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getFollowUp('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['MasterTPSysId']; ?>',$(this).attr('func'));" title="View follow up list" style="color:#0e931d;">
                                                        Follow Ups</a>
                                                <?php } else {
                                                ?>
                                                    <a click-src="addtodo" href="javascript:void(0);" title="Add Follow Up" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
																							'<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"><i class="fa fa-plus"></i> Follow Up
                                                    </a>
                                                <?php
                                                }
                                                ?>

                                            </span>
                                        </td>
                                        <td class="small"><?php echo $hotelproposal['UpdateDate'] ? $hotelproposal['UpdateDate']->format('d-M-y') : ''; ?></td>
                                        <td class="small" style="white-space:nowrap; text-align:center;" align="center">

                                            <?php //if(count($chatDetails)>0){
                                            if (!empty($chatDetails)) { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments orange"></i></a>
                                            <?php } //} else { 
                                            ?> <a style="display:none;" href="javascript:void(0);" onclick="alert('No chat history found!')"><i class="fa fa-comments gray"></i></a><?php //} 
                                                                                                                                                                                    ?>

                                            <!--<a href="javascript:void(0);" onclick="alert('Under construction.Please try after some time.');return false;" data-toggle="modal" data-target="#myModa1Reply"><i class="fa fa-comments view_text1"></i></a>-->
                                        </td>
                                        <td class="small" style="white-space:nowrap; text-align:center;display:none;" align="center">
                                            <?php //if(count($chatDetails)>0){
                                            if ($chatDetails['IsAgent'] == 0) { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments orange"></i></a>
                                            <?php } //} else { 
                                            ?> <a style="display:none;" href="javascript:void(0);" onclick="alert('No chat history found!')"><i class="fa fa-comments gray"></i></a><?php //} 
                                                                                                                                                                                    ?>
                                            <!--<a href="javascript:void(0);" onclick="alert('Under construction.Please try after some time.');return false;" data-toggle="modal" data-target="#myModa1Reply"><i class="fa fa-comments orange"></i></a>-->
                                        </td>
                                        <td class="small" style="white-space:nowrap;">
                                            <?php
                                            echo $this->partial('leaddetail/leadstatusdropdownpartial.phtml', array('proposalDetails' => $hotelproposal, 'allStatusDisplayArrayById' => $allStatusDisplayArrayById, 'loopId' => $h, 'IsAdmin' => $this->IsAdmin, 'intLoggedinUserId'=>$this->intLoggedinUserId));
                                            ?>
                                            <a data-target="#myModalSendSMSToDoCustomer" class="btn btn-xs tooltipLink" title='Send Sms' href="<?php echo $this->baseUrl('/leaddetail/view-sms-template-to-customer/cid/' . base64_encode($hotelproposal['CustomerSysId']) . '/tpid/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-toggle="modal"><i class="tooltipLink fa fa-comment-o btn btn-primary btn-xs"></i></a>
                                        </td>
                                    </tr>
                                <?php $h++;
                                }
                            } else { ?>
                                <tr>
                                    <td colspan="14" align="center"><strong>No Proposal Found, <a href="javascript:void(0);" class="createleadsnorecord">Click Here</a> to create new proposal</strong></td>
                                </tr>
                                <?php }
                        }
                        if ($this->leadDetail[0]['PlanType'] == 11) { //for Transport
                            //echo "<pre>";print_r($record);
                            if ($totalrec > 0) {
                                $h = 0;
                                $objPkgBooking = new Travel_Model_TblPackageBooking();
                                foreach ($record as $hotelproposal) {

                                    $arrAmountPaid = $objPkgBooking->getAmountPaidForProposalByTPSysId($hotelproposal['TPSysId']);
                                    $TotalAmountPaid = !empty($arrAmountPaid['TotalAmountPaid']) ? $arrAmountPaid['TotalAmountPaid'] : 0;
                                    $proposalID = 'D/' . date('y') . '/' . $hotelproposal['TPSysId'] . "/" . 'V' . $hotelproposal['VersionId'];
                                    $chatDetails = $objTravelModel->GetCustomerChatHistoryDetailsById($hotelproposal['TPSysId']);
                                    //echo "<pre>";print_r($$hotelproposal);
                                    $CurrencyType = $hotelproposal['CurrencyType'] > 0 ? $hotelproposal['CurrencyType'] : 1;
                                    $currencySymbol = $customhelper->GetCurrencyByCurrencyType($CurrencyType);
                                    $returndate = '';
                                    $departuredate = '';
                                    $paxTOtalArr = json_decode($hotelproposal['RoomInfoJson']);

                                    if (!empty($paxTOtalArr)) {
                                        foreach ($paxTOtalArr as $PaxTotal) {
                                            //
                                            $departuredateMain = (trim($PaxTotal->departuredate) != '') ? @$PaxTotal->departuredate : '';
                                            $departuredate = (trim($PaxTotal->departuredate) != '') ? DateTime::createFromFormat('d/m/Y', @$PaxTotal->departuredate) : '';

                                            $returndate = (isset($PaxTotal->returndate) && trim($PaxTotal->returndate) != '') ? DateTime::createFromFormat('d/m/Y', @$PaxTotal->returndate) : '';

                                            $departuredate1 = (isset($PaxTotal->departuredate) && trim($PaxTotal->departuredate) != '') ? @$departuredate->format('d-M-y') : '';
                                            $returndate1 = (isset($PaxTotal->returndate) && trim($returndate) != '') ? trim(@$returndate->format('d-M-y')) : '';
                                        }
                                    }
                                    //                                                    echo $departuredate;die;
                                ?>
                                    <tr>
                                        <td class="small"><?php echo $proposalID; ?> (PId-<?php echo trim($hotelproposal['TPId']); ?>)
                                            <?php if (!empty($hotelproposal['EmailText'])) { ?>
                                                <a style="display:none;" href="javascript:void(0);" title="<?php echo !empty($hotelproposal['EmailText']) ? stripslashes(trim($hotelproposal['EmailText'])) : 'NA'; ?>">Email Text</a>
                                            <?php } ?>
                                        </td>
                                        <td class="small"><?php echo $hotelproposal['CreateDate'] ? $hotelproposal['CreateDate']->format('d-M-y') : ''; ?></td>
                                        <td class="small"><?php echo $departuredate1;
                                                            echo trim($returndate1) != '' ? " - " . $returndate1 : ''; ?></td>
                                        <td class="small"><?php echo $customhelper->getPlanTypeName($hotelproposal['PlanType']); ?></td>
                                        <td class="small"><?php echo $hotelproposal['EmailDestination'] ? stripslashes($hotelproposal['EmailDestination']) : stripslashes(trim($hotelproposal['DestinationPlaces'])); ?></td>
                                        <td class="small">
                                            <a href="<?php echo $this->baseUrl('/leaddetail/lead-supplier-detail-dynamic/id/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-target="#viewquotesupplier" data-toggle="modal">View</a>
                                        </td>
                                        <td class="small" style="white-space:nowrap; text-align:center;">
                                            <?php echo $currencySymbol['Symbol']; ?> <?php echo $hotelproposal['Price'] ? ($hotelproposal['Price']) : 0; ?>
                                        <td class="small" style="white-space:nowrap; text-align:center;">
                                            <?php echo $currencySymbol['Symbol']; ?> <?php echo $hotelproposal['NetPrice'] ? ($hotelproposal['NetPrice']) : 0; ?>
                                        </td>
                                        <td class="small"><?php echo !empty($hotelproposal['ProposalEmailTo']) ? $hotelproposal['ProposalEmailTo'] : $hotelproposal['EmailId']; ?>
                                            <?php if ($hotelproposal['PackSpecType'] == 4 && $hotelproposal['StatusType'] == 16) { ?>
                                                <a href="<?php echo $this->baseUrl('/packagesearch/buildquickpackage/id/' . ($hotelproposal['TPSysId'])); ?>" target="_blank">Open Proposal</a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/leaddetail/view-sent-proposal-email/proposalId/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-target="#viewsentproposalemail" data-toggle="modal">View Email</a>
                                            <?php } ?>
                                        </td>
                                        <td class="small">
                                            <span id="status_<?php echo $h; ?>" class="proposalStatus"><?php echo $travelPlanStatusName[$hotelproposal['StatusType']]['TPStatus']; ?>
                                                <?php
                                                $departuredate_exp = explode("/", $departuredateMain);
                                                $newStartDate = $departuredate_exp[2] . "-" . $departuredate_exp[1] . "-" . $departuredate_exp[0];
                                                $hotelToDate = strtotime($newStartDate);
                                                $curdate = strtotime(date('Y-m-d'));

                                                if ($curdate > $hotelToDate) {
                                                    $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($hotelproposal['StatusType'], 1, 'sightseeing', 2, 15);
                                                } else {
                                                    $allStatusDisplayArrayById = $customhelper->getDisplayStatusByStatusId($hotelproposal['StatusType'], '', 'sightseeing', 2, 15);
                                                }

                                                /*                                                $key_iteration_status = array_search( 8 , array_column( $allStatusDisplayArrayById , 'ComponentType')); // search if iteration exists in array
                                                if( $key_iteration_status ) {
                                                    ?>
                                                <br/><a href="javascript:void(0);" title="Add Iteration Required" class="lightGreen"
                                                   onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
                                                                                            '<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);" >Add Iteration Required
                                                </a>
                                                <?php
                                                }
 *
 */
                                                $openAddModalToDo = "actionChangeProposalStatusAddIteration('" . base64_encode($hotelproposal['TPSysId']) . "',$h,'package_" . $hotelproposal['TPSysId'] . "'," . $hotelproposal['MasterTPSysId'] . "," . $hotelproposal['CustomerSysId'] . ",'" . base64_encode(27) . "','$proposalID', '" . trim($hotelproposal['CustomerSysId']) . "','" . trim($hotelproposal['ownerName']) . "','" . $hotelproposal['AgentSysId'] . "',this)";

                                                if ($hotelproposal['hasIteration']) {
                                                ?>
                                                    <br /><a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getItineraryRequired('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['TPSysId']; ?>', $(this).attr('func') );" title="View changes required list" style="color:#0e931d;">
                                                        Changes
                                                    </a>
                                                <?php
                                                } else {
                                                ?>
                                                    <br /> <a click-src="itinerary" href="javascript:void(0);" title="Add Changes" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
															   '<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"><i class="fa fa-plus"></i> Changes
                                                    </a>
                                                <?php
                                                }
                                                echo ' | ';
                                                if ($hotelproposal['hasFollowUp']) {
                                                ?>
                                                    <a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getFollowUp('<?php echo $hotelproposal['CustomerSysId']; ?>','<?php echo $hotelproposal['MasterTPSysId']; ?>',$(this).attr('func'));" title="View follow up list" style="color:#0e931d;">
                                                        Follow Ups</a>
                                                <?php } else {
                                                ?>
                                                    <a click-src="addtodo" href="javascript:void(0);" title="Add Follow Up" class="" style="color: #F22C0C" onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($hotelproposal['TPSysId']); ?>',<?php echo $h; ?>,'package_<?php echo $hotelproposal['TPSysId']; ?>',<?php echo $hotelproposal['MasterTPSysId']; ?>,<?php echo $hotelproposal['CustomerSysId']; ?>,'<?php echo base64_encode(27); ?>',
																							'<?php echo $proposalID ?>', '<?php echo trim($hotelproposal['CustomerSysId']); ?>', '<?php echo trim($hotelproposal['ownerName']); ?>' , '<?php echo $hotelproposal['AgentSysId']; ?>',this);"><i class="fa fa-plus"></i> Follow Up
                                                    </a>
                                                <?php
                                                }
                                                ?>

                                            </span>

                                        </td>
                                        <td class="small"><?php echo $hotelproposal['UpdateDate'] ? $hotelproposal['UpdateDate']->format('d-M-y') : ''; ?></td>
                                        <td class="small" style="white-space:nowrap; text-align:center;" align="center">

                                            <?php //if(count($chatDetails)>0){
                                            if (!empty($chatDetails)) { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments orange"></i></a>
                                            <?php } //} else { 
                                            ?> <a style="display:none;" href="javascript:void(0);" onclick="alert('No chat history found!')"><i class="fa fa-comments gray"></i></a><?php //} 
                                                                                                                                                                                    ?>

                                            <!--<a href="javascript:void(0);" onclick="alert('Under construction.Please try after some time.');return false;" data-toggle="modal" data-target="#myModa1Reply"><i class="fa fa-comments view_text1"></i></a>-->
                                        </td>
                                        <td class="small" style="white-space:nowrap; text-align:center;display:none;" align="center">
                                            <?php //if(count($chatDetails)>0){
                                            if ($chatDetails['IsAgent'] == 0) { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments view_text1"></i></a>
                                            <?php } else { ?>
                                                <a href="<?php echo $this->baseUrl('/customer/customer-chat-history/id/' . base64_encode($hotelproposal['TPSysId']) . '/cid/' . base64_encode($hotelproposal['CustomerSysId'])); ?>" data-original-title="View" data-placement="top" data-target="#viewquotesupplier" data-toggle="modal" title=""><i class="fa fa-comments orange"></i></a>
                                            <?php } //} else { 
                                            ?> <a style="display:none;" href="javascript:void(0);" onclick="alert('No chat history found!')"><i class="fa fa-comments gray"></i></a><?php //} 
                                                                                                                                                                                    ?>
                                            <!--<a href="javascript:void(0);" onclick="alert('Under construction.Please try after some time.');return false;" data-toggle="modal" data-target="#myModa1Reply"><i class="fa fa-comments orange"></i></a>-->
                                        </td>
                                        <td class="small" style="white-space:nowrap;">
                                            <?php
                                            echo $this->partial('leaddetail/leadstatusdropdownpartial.phtml', array('proposalDetails' => $hotelproposal, 'allStatusDisplayArrayById' => $allStatusDisplayArrayById, 'loopId' => $h, 'IsAdmin' => $this->IsAdmin, 'intLoggedinUserId'=>$this->intLoggedinUserId));
                                            ?>
                                            <a data-target="#myModalSendSMSToDoCustomer" class="btn btn-xs tooltipLink" title='Send Sms' href="<?php echo $this->baseUrl('/leaddetail/view-sms-template-to-customer/cid/' . base64_encode($hotelproposal['CustomerSysId']) . '/tpid/' . base64_encode($hotelproposal['TPSysId'])); ?>" data-toggle="modal"><i class="tooltipLink fa fa-comment-o btn btn-primary btn-xs"></i></a>
                                        </td>
                                    </tr>
                                <?php $h++;
                                }
                            } else { ?>
                                <tr>
                                    <td colspan="14" align="center"><strong>No Proposal Found, <a href="javascript:void(0);" class="createleadsnorecord">Click Here</a> to create new proposal</strong></td>
                                </tr>
                        <?php }
                        }
                        ?>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="col-md-12 text-right no-padding">
            <?php if ($totalrec > $this->perPage) {
                echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml');
            } ?>
        </div>
        <div class="clearfix"></div>
    </div>
</div>
</div>

<!-- Main Content Element  End-->
</div>
</div>

<?php echo $this->render('my-modal-add-todo-customer.phtml'); ?>
<?php echo $this->render('copyrightfooter.phtml'); ?>
</section>
<!--Page main section end -->
<!-- popup modal for send sms to customer -->
<div class="modal fade in" id="myModalSendSMSToDoCustomer" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="center">
                <img class="loaderimg" id="loaderimg" src="<?php echo $this->baseUrl('/public/tinymce/skins/lightgray/img/loader.gif'); ?>" />
            </div>
        </div>
    </div>
</div>
<!-- end of popup modal for send sms to customer -->

<div class="modal fade" id="myModa1Reply" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">Accept Request <span class="pull-right maroon">(Balance : <span class="fa fa-rupee"></span>1,784)</span></h4>
            </div>
            <div class="modal-body">


                <div class="col-md-8 no-padding">
                    <div class="panel panel-default no-margin">

                        <div class="panel-heading">
                            <h3 class="panel-title">Supplier Information (3.5 <img src="assets/images/packStar_Orange.png"><img src="assets/images/packStar_Orange.png"><img src="assets/images/packStar_Orange.png"><img src="assets/images/packStar_Half.png"><img src="assets/images/packStar_Gray.png">)</h3>
                        </div>
                        <div class="panel-body">
                            <!--Table Wrapper Start-->
                            <div class="table-responsive ls-table">
                                <table class="table" style="margin-bottom:0px;">
                                    <thead>
                                        <tr>
                                            <td width="45%"><strong>Supplier Name</strong></td>
                                            <td width="55%">B2B Supplier</td>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td><strong>Supplier Type</strong></td>
                                            <td>Internal</td>
                                        </tr>
                                        <tr>
                                            <td width="45%"><strong>Location</strong></td>
                                            <td width="55%">New Delhi</td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <!--Table Wrapper Finish-->
                        </div>


                        <div class="panel-heading">
                            <h3 class="panel-title">Product Type</h3>
                        </div>
                        <div class="panel-body">
                            <!--Table Wrapper Start-->
                            <div class="table-responsive ls-table">
                                <table class="table" style="margin-bottom:0px;">
                                    <thead>
                                        <tr>
                                            <td width="20%"><strong>Type</strong></td>
                                            <td width="25%">Hotel</td>
                                            <td width="25%"><strong>Name</strong></td>
                                            <td width="30%">JW Marriott Walnut Grove Resort & Spa</td>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td><strong>Destination</strong></td>
                                            <td>Mumbai</td>
                                            <td><strong>Duration</strong></td>
                                            <td>2N/3D (Deluxe)</td>
                                        </tr>
                                        <tr>
                                            <td><strong>Price</strong></td>
                                            <td><span class="fa fa-rupee"></span>1,784</td>
                                            <td><strong>Requested Date</strong></td>
                                            <td>12/06/2016</td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <!--Table Wrapper Finish-->
                        </div>



                        <div class="panel-heading">
                            <h3 class="panel-title">Enquiry Info</h3>
                        </div>
                        <div class="panel-body">


                            <div class="table-responsive ls-table">
                                <table class="table" style="margin-bottom:0px;">
                                    <thead>
                                        <tr>
                                            <td width="20%"><strong>No. of Pax</strong></td>
                                            <td width="25%">3</td>
                                            <td width="25%"><strong>Booking Date</strong></td>
                                            <td width="30%">25/06/2016</td>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td><strong>Booking By</strong></td>
                                            <td>Immediate</td>
                                            <td></td>
                                            <td></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>

                        </div>


                        <div class="panel-heading">
                            <h3 class="panel-title">Reply</h3>
                        </div>
                        <div class="panel-body no-padding">


                            <div class="col-md-12">
                                <div class="form-group">
                                    <label><strong>Available Status</strong></label>
                                    <select id="select-title" class="demo-default select-country" disabled style="background:#f1f1f1 !important;">
                                        <option value="1">Yes</option>
                                        <option value="2">No</option>
                                    </select>
                                </div>
                            </div>

                            <div class="col-md-6">
                                <div class="form-group">
                                    <label><strong>Price Published</strong></label>
                                    <input type="text" class="form-control whbg " disabled value="1500" style="background:#f1f1f1 !important;">
                                </div>
                            </div>

                            <div class="col-md-6">
                                <div class="form-group">
                                    <label><strong>Offered Price</strong></label>
                                    <input type="text" class="form-control whbg" disabled value="1200" style="background:#f1f1f1 !important;">
                                </div>
                            </div>

                            <div class="col-md-12">
                                <div class="form-group">
                                    <label><strong>Comments</strong></label>
                                    <textarea name="" cols="" rows="" class="form-control whbg" disabled style="background:#f1f1f1 !important;">Available with above offer price, if booking done by tomorrow
                                            </textarea>
                                </div>
                            </div>

                            <div class="col-md-12">




                            </div>

                            <div class="col-md-12">

                                <div class="alert alert-info ">

                                    <div class="form-group form-group1 no-margin">
                                        <label class="inlinebl"><strong>Payment&nbsp;&nbsp;</strong></label>


                                        <label class="checkbox inlinebl no-margin"><input class="icheck-black" type="checkbox" id="checkRed4" value="option4"> TB Wallets</label>

                                        &nbsp;&nbsp;

                                        <label class="checkbox inlinebl no-margin"><input class="icheck-black" type="checkbox" id="checkRed4" value="option4"> Net Banking</label>

                                        <div class="clearfix"></div>
                                    </div>
                                    <div class="clear" style="padding-top:10px;"></div>
                                    <div class="form-group" style="min-height:inherit; margin-bottom:0;">
                                        <strong>Advance </strong>
                                        <input type="text" class="form-control whbg" value="10%">
                                    </div>
                                    <div class="clear" style="padding-top:10px;"></div>
                                    <div class="col-md-4 no-padding">
                                        <div class="form-group" style="margin-bottom:0; min-height:inherit;">
                                            <label><strong>Valid Till Date </strong></label>
                                            <div class="input-group ls-group-input">
                                                <input class="form-control datePickerOnly" type="text" />
                                                <span class="input-group-addon dateTimePickerCustom1"><i class="fa fa-calendar"></i></span>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-md-4 ">

                                        <div class="form-group" style="margin-bottom:0; min-height:inherit;">
                                            <label><strong>Balance Before </strong></label>
                                            <div class="input-group ls-group-input">

                                                <input type="text" class="form-control whbg" value="50,000,00">
                                            </div>
                                        </div>

                                    </div>





                                    <div class="col-md-4 no-padding">

                                        <div class="form-group" style="margin-bottom:0; min-height:inherit;">
                                            <label><strong>7 Days Travel Date </strong></label>
                                            <div class="input-group ls-group-input">
                                                <input class="form-control datePickerOnly" type="text" />
                                                <span class="input-group-addon dateTimePickerCustom1"><i class="fa fa-calendar"></i></span>
                                            </div>
                                        </div>

                                    </div>
                                    <div class="clear"></div>
                                </div>
                            </div>









                        </div>


                        <div class="panel-heading">
                            <h3 class="panel-title">My Response</h3>
                        </div>
                        <div class="panel-body no-padding">








                            <div class="col-md-12">

                                <div class="form-group">
                                    <label><strong>Remarks/Responsestrong</strong></label>
                                    <textarea name="" cols="" rows="" class="form-control whbg disabled">Please update the price by 1150</textarea>
                                </div>






                            </div>

                            <div class="col-md-12">

                                <table class="table table-bordered">
                                    <thead>
                                        <tr class="alert alert-success">
                                            <th data-sortable="true" data-sorted="true" data-sorted-direction="descending" class="small" style="vertical-align:top;">#</th>
                                            <th data-sortable="true" data-sorted="true" data-sorted-direction="descending" class="small" style="vertical-align:top;">RHID</th>
                                            <th data-sortable="true" data-sorted="true" data-sorted-direction="descending" class="small" style="vertical-align:top;">Replied&nbsp;On</th>
                                            <th data-sortable="true" data-sorted="true" data-sorted-direction="descending" class="small" style="vertical-align:top;">Replied&nbsp;By</th>
                                            <th data-sortable="true" data-sorted="true" data-sorted-direction="descending" class="small" style="vertical-align:top;">Remarks Response</th>
                                        </tr>
                                    </thead>
                                    <tbody>

                                        <tr>
                                            <td class="small">1</td>
                                            <td class="small">11</td>
                                            <td class="small">25/05/2016</td>
                                            <td class="small">Agent</td>
                                            <td class="small">
                                                <p>OK, Accepting the offer, please send quotation......&#13;</p>
                                            </td>
                                        </tr>


                                        <tr>
                                            <td class="small">2</td>
                                            <td class="small">12</td>
                                            <td class="small">25/05/2016</td>
                                            <td class="small">Supplier</td>
                                            <td class="small">
                                                <p>Updated price can be offered, pleaseĀ  confirm booking&#13;</p>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="small">3</td>
                                            <td class="small">13</td>
                                            <td class="small">25/05/2016</td>
                                            <td class="small">Agent</td>
                                            <td class="small">
                                                <p>Please update the price by 1150&#13;</p>
                                            </td>
                                        </tr>

                                        <tr>
                                            <td class="small">4</td>
                                            <td class="small">14</td>
                                            <td class="small">25/05/2016</td>
                                            <td class="small">Supplier</td>
                                            <td class="small">Available with above offer price, if booking done by tomorrow </td>
                                        </tr>
                                    </tbody>
                                </table>


                            </div>
                        </div>
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="col-md-4 no-padding">
                    <div class="panel panel-primary">
                        <div class="panel-heading">
                            <h3 class="panel-title"><strong>Chat With Agent </strong> <span class="user-status is-online"></span></h3>
                            <ul class="panel-control">
                                <!-- <li><a class="close-panel" href="javascript:void(0)"><i class="fa fa-times"></i></a></li>
                                    <li><a class="minus" href="javascript:void(0)"><i class="fa fa-angle-up large"></i></a></li>-->
                                <li><a class="refresh" href="javascript:void(0)"> <i class="fa fa-comments"></i> Chat History</a></li>
                                <li><a class="refresh" href="javascript:void(0)"><i class="fa fa-refresh"></i></a></li>
                            </ul>
                        </div>
                        <div class="panel-body" style="background:#2c3e50;">
                            <div class="nano nano-chat-widget">
                                <div class="nano-content nano-chat-box">
                                    <div class="ls-chat"> <img class="right rounded" alt="user2" src="assets/images/demo/avatar-80.png">
                                        <div class="triangle-right"></div>
                                        <div class="text text-right">
                                            <p class="msg msg-alter">Hi there! <span class="date">May, 25 2013 2:00pm</span> </p>
                                        </div>
                                    </div>
                                    <div class="ls-chat"> <img class="rounded" alt="user1" src="assets/images/demo/avatar-80.png">
                                        <div class="triangle"></div>
                                        <div class="text">
                                            <p class="msg">How are you? <span class="date">May, 25 2013 2:00pm</span> </p>
                                        </div>
                                    </div>
                                    <div class="ls-chat"> <img class="right rounded" alt="user2" src="assets/images/demo/avatar-80.png">
                                        <div class="triangle-right"></div>
                                        <div class="text text-right">
                                            <p class="msg msg-alter">Fine thanks :) <span class="date">May, 25 2013 2:00pm</span> </p>
                                        </div>
                                    </div>
                                    <div class="ls-chat"> <img class="rounded" alt="user1" src="assets/images/demo/avatar-80.png">
                                        <div class="triangle"></div>
                                        <div class="text">
                                            <p class="msg">Laos alnongside many of it's Southeast Asian neighbours, is well known. <span class="date">May, 25 2013 2:00pm</span> </p>
                                        </div>
                                    </div>
                                    <div class="ls-chat"> <img class="right rounded" alt="user2" src="assets/images/demo/avatar-80.png">
                                        <div class="triangle-right"></div>
                                        <div class="text text-right">
                                            <p class="msg msg-alter">Hi there! <span class="date">May, 25 2013 2:00pm</span> </p>
                                        </div>
                                    </div>
                                    <div class="ls-chat"> <img class="rounded" alt="user1" src="assets/images/demo/avatar-80.png">
                                        <div class="triangle"></div>
                                        <div class="text">
                                            <p class="msg">How are you? <span class="date">May, 25 2013 2:00pm</span> </p>
                                        </div>
                                    </div>
                                    <div class="ls-chat"> <img class="right rounded" alt="user2" src="assets/images/demo/avatar-80.png">
                                        <div class="triangle-right"></div>
                                        <div class="text text-right">
                                            <p class="msg msg-alter">Fine thanks :) <span class="date">May, 25 2013 2:00pm</span> </p>
                                        </div>
                                    </div>
                                    <div class="ls-chat"> <img class="rounded" alt="user1" src="assets/images/demo/avatar-80.png">
                                        <div class="triangle"></div>
                                        <div class="text">
                                            <p class="msg">Laos alnongside many of it's Southeast Asian neighbours, is well known. <span class="date">May, 25 2013 2:00pm</span> </p>
                                        </div>
                                    </div>
                                    <div class="ls-chat"> <img class="right rounded" alt="user2" src="assets/images/demo/avatar-80.png">
                                        <div class="triangle-right"></div>
                                        <div class="text text-right">
                                            <p class="msg msg-alter">Sometimes! <span class="date">May, 25 2013 2:00pm</span> </p>
                                        </div>
                                    </div>
                                    <div class="ls-chat"> <img class="rounded" alt="user1" src="assets/images/demo/avatar-80.png">
                                        <div class="triangle"></div>
                                        <div class="text">
                                            <p class="msg">Something :) <span class="date">May, 25 2013 2:00pm</span> </p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <hr />
                            <div>
                                <form class="ls_form" action="#">
                                    <div class="input-group input-group-message">
                                        <input type="text" placeholder="Write a message" class="form-control textColor">
                                        <span class="input-group-btn">
                                            <button type="button" class="btn ls-light-green-btn"> <i class="fa fa-location-arrow"></i></button>
                                        </span>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    <div class="clear"></div>
                </div>





                <div class="clear"></div>
            </div>

            <div class="modal-footer">
                <button type="button" class="btn ls-light-green-btn btn-xs" data-dismiss="modal" data-toggle="modal" data-target="#myModa1aCreatcustomer">Reply</button><button type="button" class="btn btn-success btn-xs" data-dismiss="modal">Accept</button><button type="button" class="btn btn-warning btn-xs" data-dismiss="modal">Reject</button> <button type="button" class="btn btn-danger btn-xs" data-dismiss="modal">Close</button>
            </div>


        </div>
    </div>
</div>

<!-- QUOTE SUPPLIER -->



<div class="modal fade" id="viewquotesupplier" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
        </div>
    </div>
</div>

<!-- this is comman modal for sent email  added : Activity -->
<div class="modal fade" id="viewsentproposalemail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
        </div>
    </div>
</div>
<div class="modal fade" id="viewsentemail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
        </div>
    </div>
</div>
<div class="modal fade" id="viewHotelSearchResult" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content" id="updateHotelSearchResult">
            Please Wait...
        </div>
    </div>
</div>

<script>
    $('#viewquotesupplier').on('hidden.bs.modal', function() {
        $(this).removeData('bs.modal');
    });
    $('#viewsentemail').on('hidden.bs.modal', function() {
        $(this).removeData('bs.modal');
    });
    $('#viewsentproposalemail').on('hidden.bs.modal', function() {
        $(this).removeData('bs.modal');
    });
</script>


<!-- QUOTE SUPPLIER -->
<script type="text/javascript" src="http://local.b2bzend.com/public/assets/js/customer.js"></script>
<?php include_once 'application/views/scripts/newfooter.phtml'; ?>

<script type="text/javascript">
    function EditProposal(tpID, isreadymade) {
        if (isreadymade) {
            $.ajax({
                url: '/customer/editreadymadeproposal',
                data: {
                    tpID: tpID
                },
                method: 'POST',
                dataType: 'json',
                error: function(err) {
                    //  alert(err);
                },
                beforeSend: function() {
                    $('#loaderimg').css('display', 'inline-block');
                },
                success: function(response) {
                    if (response.success) {
                        window.location = '/package/add-flexi-package/id/' + response.lastID;

                    }

                }
            });
        } else {
            $.ajax({
                url: '/customer/editproposal',
                data: {
                    tpID: tpID
                },
                method: 'POST',
                dataType: 'json',
                error: function(err) {
                    //  alert(err);
                },
                beforeSend: function() {
                    $('#loaderimg').css('display', 'inline-block');
                },
                success: function(response) {
                    if (response.success) {
                        window.location = '/package/add-customer-package/id/' + response.lastID;

                    }

                }
            });
        }

    }
    $(".createleadsnorecord").click(function() {
        $(".viewcustomerId").toggle();
    });
</script>





<script type="text/javascript">
    function updatePayment(TPSysId, netPrice, amountPaid) {
        $("#payment_type_online").iCheck('check');
        $("#fullPayment").iCheck('check');

        $(".TPSysIdForm").val(TPSysId);
         
        $("#pkgCost").html(netPrice);
        $("#pkgCostOnline").html(netPrice);
        $("#amountPaid").html(amountPaid);
        $("#amountPaidOnline").html(amountPaid);
        var remainingBalance = (parseInt(netPrice) - parseInt(amountPaid));
        $("#fullPayment").val(remainingBalance);
        $("#premium_val").val(remainingBalance);
        //alert(remainingBalance)
        $("#flex_pay").val(remainingBalance);
        $("#remainingBalance").html(remainingBalance);
        $(".outStandingBal").html(remainingBalance);
        $(".outStandingBalOnline").html(remainingBalance);
        var packageCurrency_ = $('#packageCurrency_' + parseInt(TPSysId)).val();
        $(".CurrencyHtml").html(packageCurrency_);
        var packagePlanType_ = $('#packagePlanType_' + parseInt(TPSysId)).val();
        $("#PlanType").val(packagePlanType_);
        $("#update-payment").modal();
    }

    function closeModal() {
        $("#update-payment").modal('hide');
    }



    $(document).ready(function() {

        $('#flex_pay').attr("disabled", true);


        $('#payment_type_online').on('ifChecked', function() {
            $("#paymentType").val(1);
            $("#payment_table_online").show();
            $("#payment_table_offline").hide();
        });
        $('#payment_type_offline').on('ifChecked', function() {
            $("#paymentType").val(2);
            var remainingBalance = parseInt(parseInt($("#fullPayment").val()) - parseInt($("#flex_pay").val()));
            $(".outStandingBal").html(remainingBalance);
            $("#premium_val").val($("#fullPayment").val());
            $("#payment_table_online").hide();
            $("#payment_table_offline").show();
        });

        $('#fullPayment').on('ifChecked', function() {

            $('#flex_pay').attr("disabled", true);
            var remainingBalance = (parseInt($("#fullPayment").val()) - parseInt($("#remainingBalance").html()));
            $("#premium_val").val($("#fullPayment").val());
            $("#flex_pay").val($("#remainingBalance").html());
            $(".outStandingBal").html(remainingBalance);
            //genrateSecureCode();

        });




        $('#flexiblePayment').on('ifChecked', function() {
            $('#flex_pay').attr("disabled", false);

            var remainingBalance = (parseInt($("#fullPayment").val()) - parseInt($("#flex_pay").val()));
            $("#premium_val").val($("#fullPayment").val());
            $(".outStandingBal").html(remainingBalance);

            //genrateSecureCode();

        });



        $('#flex_pay').on('blur keyup', function() {
            var advanceBookingPercentVal = $('#flex_pay').val();

            if (parseInt($("#flex_pay").val()) > parseInt($("#fullPayment").val())) {
                alert("Your amount of payment can not exceed " + $("#fullPayment").val());
                $("#flex_pay").val(0);
                $('#flex_pay').focus();
                return false;
            } else {
                var remainingBalance = parseInt(parseInt($("#fullPayment").val()) - parseInt($("#flex_pay").val()));
                $("#premium_val").val($("#flex_pay").val());
                $(".outStandingBal").html(remainingBalance);
            }

            //genrateSecureCode();


        });


    });


    function offlinePaymentProcess(PaymentType = 0) {
        //            var paymentType = $("#paymentType").val(); 
        //            var TPSysId     = $("#TPSysId").val();
        if(PaymentType > 0){
            $('#paymentType').val(PaymentType);
        }
        var formvalue = $("#form_repayment").serialize();
        $.ajax({
            url: '/packagesearch/offline-payment-process',
            data: formvalue,
            dataType: 'json',
            type: 'POST',
            beforeSend: function() {
                $("#offline-buttons").hide();
                $("#offline-buttons-inprocess").show();
            },
            success: function(response) {
                    if (response.success) {
                        if (response.pType == '11') {
                        window.location.replace("/package-booking/package-booking-view/pid/"+response.TPSysId+"/cid/"+response.CustomerSysId+"/ptype/b/code/"+response.SecureCode);
                    }else if (response.pType == '1') {
                        alert(response.msg);
                        $("#offline-buttons").show();
                        $("#offline-buttons-inprocess").hide();
                        $("#update-payment").modal('hide');
                    } else {
                        $("#guid_repayment").val(response.arrResponse.guid);
                        $("#securecode_repayment").val(response.arrResponse.securecode);
                        $("#Firstname").val(response.arrResponse.Firstname);
                        $("#email").val(response.arrResponse.email);
                        $("#phone").val(response.arrResponse.phone);
                        $("#premium_val").val(response.arrResponse.amount);
                        $("#AgencyUserSysId").val(response.arrResponse.AgencyUserSysId);
                        $("#AgencySysId").val(response.arrResponse.AgencySysId);
                        $("#TrxType").val(response.arrResponse.TrxType);
                        $("#PlanType").val(response.arrResponse.PlanType);
                        $("#TPSysId").val(response.arrResponse.TPSysId);
                        $("#IsCardChrgToCustomer").val(response.arrResponse.IsCardChrgToCustomer);
                        $("#CustomerSysId").val(response.arrResponse.CustomerSysId);
                        $("#returnURL").val(response.arrResponse.returnURL);
                        $("#stringData").val(response.arrResponse.stringData);
                        $("#errorURL").val(response.arrResponse.errorURL);
                        $("#strPaymentUrl").val(response.arrResponse.strPaymentUrl);
                        $('#form_repayment').attr('action', response.arrResponse.strPaymentUrl);

                        setTimeout(function() {
                            $('#form_repayment').submit();
                        }, 2000);


                    }
                } else {
                    alert(response.msg);
                    $("#offline-buttons").show();
                    $("#offline-buttons-inprocess").hide();
                }
            }
        });
    }
</script>




<div class="modal fade" id="update-payment" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">Update Payment</h4>
            </div>
            <div class="modal-body">

                <div class="col-md-12 no-padding" style="display:none;">
                    <div class="col-md-7">

                        <input class="icheck-black1111" type="radio" checked="checked" name="payment_type" id="payment_type_online" value="1">
                        <label for="payment_type_online" class="leftsidearea">Online (Send Payment Reminder)</label>&nbsp;
                    </div>
                    <div class="col-md-5">

                        <input class="icheck-black1111" type="radio" name="payment_type" id="payment_type_offline" value="2">
                        <label for="payment_type_offline" class="leftsidearea">Offline</label>
                    </div>

                </div>
                <div class="clear">&nbsp;</div>


                <div class="col-md-12 no-padding" id="payment_table_online">

                    <div class="col-md-8">
                        <table class="table tablestyle">
                            <tbody>
                                <tr>
                                    <td><label class="radio no-margin inlinebl"> Package Cost </label> <span style="text-align:center; font-size: 12px;">(Inc. GST)</span></td>
                                    <td align="right"><span class="CurrencyHtml"></span> <span id="pkgCostOnline"></span></td>
                                </tr>
                                <tr>
                                    <td><label class="radio no-margin inlinebl"> Amount Received </label></td>
                                    <td align="right"><span class="CurrencyHtml"></span> <span id="amountPaidOnline"></span></td>
                                </tr>
                                <tr>
                                    <td><strong>OutStanding Bal.</strong><br></td>
                                    <td align="right"><span class="CurrencyHtml"></span> <span class="outStandingBalOnline"></span></td>
                                </tr>

                            </tbody>






                        </table>
                    </div>

                </div>



                <div class="col-md-12 no-padding" id="payment_table_offline" style="display:none;">

                    <div class="col-md-12">
                        <table class="table tablestyle ">
                            <tbody>
                                <tr>
                                    <td><label class="radio no-margin inlinebl"> Package Cost </label> <span style="text-align:center; font-size: 12px;">(Inc. GST)</span></td>
                                    <td align="right"><span class="CurrencyHtml"></span> <span id="pkgCost"></span></td>
                                </tr>
                                <tr>
                                    <td><label class="radio no-margin inlinebl"> Amount Received </label></td>
                                    <td align="right"><span class="CurrencyHtml"></span> <span id="amountPaid"></span></td>
                                </tr>

                                <tr>
                                    <td>

                                        <input type="radio" name="bookingPayment" id="fullPayment" value="" class="icheck-black1" checked="" />
                                        <label for="fullPayment" class="leftsidearea">Full Payment</label>

                                    </td>

                                    <td align="right"><span class="CurrencyHtml"></span> <span id="remainingBalance"></span></td>
                                </tr>

                                <tr>
                                    <td>

                                        <input type="radio" name="bookingPayment" id="flexiblePayment" value="" class="icheck-black1" />
                                        <label for="flexiblePayment" class="leftsidearea">Flexible Payment</label>

                                    </td>

                                    <td class="pull-right" style="border:0px;">
                                        <span class="CurrencyHtml pull-left"></span>
                                        <input type="text" name="flex_pay" id="flex_pay" value="" class="form-control whbg" style="text-align:right; width: 120px">
                                    </td>
                                </tr>



                                <tr>
                                    <td><strong>OutStanding Bal.</strong><br></td>
                                    <td align="right"><span class="CurrencyHtml"></span> <span class="outStandingBal"></span></td>
                                </tr>

                            </tbody>


                            <form id="form_repayment" method="post" name="form_repayment" action="">
                                <input name="paymentType" id="paymentType" value="1" type="hidden">
                                <input name="guid" id="guid_repayment" value="" type="hidden">
                                <input name="securecode" id="securecode_repayment" value="" type="hidden">
                                <input name="Firstname" id="Firstname" value="" type="hidden">
                                <input name="email" id="email" value="" type="hidden">
                                <input name="phone" id="phone" value="" type="hidden">
                                <input id="premium_val" name="amount" value="" type="hidden">
                                <input name="AgencyUserSysId" id="AgencyUserSysId" value="" type="hidden">
                                <input name="AgencySysId" id="AgencySysId" value="" type="hidden">
                                <input name="TrxType" id="TrxType" value="" type="hidden">
                                <input name="PlanType" id="PlanType" value="" type="hidden">
                                <input name="TPSysId" id="TPSysId" class="TPSysIdForm" value="" type="hidden">
                                <input name="IsCardChrgToCustomer" id="IsCardChrgToCustomer" value="" type="hidden">
                                <input name="CustomerSysId" id="CustomerSysId" value="" type="hidden">
                                <input name="returnURL" id="returnURL" value="" type="hidden">
                                <input name="stringData" id="stringData" value="" type="hidden">
                                <input name="errorURL" id="errorURL" value="" type="hidden">
                            </form>





                        </table>
                    </div>

                </div>
                <div class="col-md-12 no-padding">
                    <div class="form-group form-group1 flexipadding pull-left"  >
                        <a href="javascript://" onclick="offlinePaymentProcess(11)" class="btn btn-primary">Pay Offline </a>
                    </div>
                    <div class="form-group form-group1 flexipadding pull-right" id="offline-buttons">
                        <button onclick="closeModal();" class="btn btn-primarygray" type="button">Cancel</button>
                        <button class="btn btn-primary" onclick="offlinePaymentProcess(1);" type="submit">Send Payment Reminder</button>
                    </div>

                    <div class="form-group form-group1 flexipadding" id="offline-buttons-inprocess" style="display:none;">
                        <img src="<?php echo $this->baseUrl('public/assets/images/loader.gif'); ?>"> Please Wait...
                    </div>


                </div>

                <div class="clear"></div>

            </div>
        </div>
    </div>
</div>

<!--Modal for Itinerary required-->
<div class="modal fade" id="getItineraryRequiredModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">Changes Required</h4>
            </div>

            <div class="col-md-12 no-padding">
                <div class="panel">
                    <div class="panel-body">
                        <div class="col-md-12 table-responsive no-padding overflowflight" id="itinerary_required_response">
                            <img src="<?php echo $this->baseUrl('public/assets/images/loader.gif'); ?>">
                        </div>
                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

Youez - 2016 - github.com/yon3zu
LinuXploit