<!-- Dashboard content -->
<div class="row">
    <div class="col-lg-6">                                
        <?php include 'common/quick_stats.php'; ?>       

        <!-- Basic modal -->
        <div id="modal_theme_primary" class="modal fade">
            <div class="modal-dialog">
                <div class="modal-content" id="modal-content">

                    <div class="map-container map-symbol-custom">
                        <?php echo $map['html']; ?>
                    </div>
                    <div id="directionsDiv" style="margin-top:15px"></div>

                </div>
            </div>
        </div>
        <!-- /basic modal -->

        <!-- Support tickets -->
        <div class="panel panel-flat">
            <div class="table-responsive">

                <table class="table">
                    <thead>
                        <tr>
                            <td colspan="5"><b> Recent Service Request(s)</b></td>
                        </tr>


                        <tr>
                            <th style="width: 150px">Service Type<br>Due Days</th>
                            <th style="width: 230px;">User<br>Agent</th>

                            <th style="width: 180px;">Quantity/<br>Date & Time</th>
                            <th class="text-center" style="width: 20px;"><i class="icon-arrow-down12"></i></th>
                        </tr>
                    </thead>
                    <tbody>

                        <?
                        foreach ($transport_request as $rect) {
                            ?>

                            <tr>
                                <td class="text-center">
                                    <? echo $rect->service_type_text; ?> <br>   <h6 class="no-margin"><?= $rect->day_gap ?> days </h6> 
                                </td>
                                <td>


                                    <div class="media-body">
                                        <a href="#" onclick="openMemberID(<? echo $rect->member_id; ?>);" class="display-inline-block text-default text-semibold letter-icon-title"><? echo $rect->firstname; ?> <? echo $rect->lastname; ?></a>
                                        <br><span class="text-semibold"><? echo $rect->agent_name; ?> </span> <!-- div class="text-muted text-size-small"><span class="status-mark border-blue position-left"></span> Active</div --> - 
                                    </div>
                                </td>


                                <td>
                                    <? echo $rect->quantity; ?> Bags
                                    <small class="display-block text-size-small no-margin"><b><?= date("Y-m-d h:i a", strtotime($rect->service_date)) ?></b></small>
                                </td>
                                <td class="text-center">
                                    <button type="button" id="acc<?= $rect->id ?>" class="btn btn-info btn-xs" onclick="processPendTransp(<?= $rect->id ?>);" >View</button>
                                </td>
                            </tr>                      

                            <?
                        }
                        ?>
                        <tr><td colspan='6'></td></tr>
                    </tbody>
                </table>



            </div>
        </div>
        <!-- /support tickets -->
    </div>



    <div class="col-lg-6">
        <!-- Recent Members -->
        <div class="panel panel-flat" style="background-color: #ccffff;">
            <div id="transp_detail">
                <div class="panel-heading">
                    <h6 class="panel-title">Resent Signup</h6>
                    <div class="heading-elements">
                        <span class="heading-text">Last: <span class="text-bold text-danger-600 position-right">10</span></span>             
                    </div>
                </div>


                <div class="table-responsive">
                    <table class="table text-nowrap" >
                        <thead>
                            <tr>
                                <th>Name/Email</th>
                                <th>Date</th>
                                <th>Pry.Phone</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            foreach ($recent_signup as $rect) {
                                ?>
                                <tr>
                                    <td>                     

                                        <div class="media-body">
                                            <div class="media-heading">
                                                <a href="#"  onclick="openMemberID(<? echo $rect->id; ?>);" class="letter-icon-title"><? echo $rect->firstname; ?> <? echo $rect->lastname; ?></a>  - <? echo $rect->email; ?>
                                            </div>


                                        </div>
                                    </td>
                                    <td>
                                        <span class="text-muted text-size-small"><? echo $rect->added; ?></span>
                                    </td>
                                    <td>
                                        <h6 class="text-semibold no-margin"><? echo $rect->phone; ?></h6>
                                    </td>
                                </tr>  
                            <? }
                            ?>
                            <tr>
                                <td colspan='3'><a href='/member/find'>Sign Up Report</a></td>

                            </tr>
                        </tbody>
                    </table>
                </div>          

            </div>

        </div>
        <!-- /Recent Members -->
    </div>
</div>
<!-- /dashboard content -->


<script type="text/javascript">
<!--
    var loaded_data = new Array();
    function showTranspModal(service_request_id) {
        if (typeof event !== 'undefined') {
            event.preventDefault();
        }
        //  alert(service_request_id);
        // collect data - either from forms or from data variables
        var id = $(this).data('id');

        // load the modal content with a loader gif and message
        $('#modal-content').html('Loading...');

        // show modal window
        $('#modal_theme_primary').modal('show');
//alert(5);
        // do the ajax bit
        var post_data = {
            'interest_id': service_request_id,
        };
//alert(6);
        $.ajax({
            url: "/transp/transp_modal?service_request_id=" + service_request_id
        }).done(function (data) {
//alert(data);
//alert(7);
            $('#modal-content').html(data);
            //initialize_map();
            var myLatlng = new google.maps.LatLng(33.7489954, -84.3879824);
            var myOptions = {
                zoom: 13,
                center: myLatlng,
                mapTypeId: google.maps.MapTypeId.ROADMAP};
            map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
            directionsDisplay.setMap(map);
            directionsDisplay.setPanel(document.getElementById("directionsDiv"));

            fitMapToBounds_map();

            calcRoute(loaded_data[0], loaded_data[1]);
            //alert(loaded_data[0]);
        });
    }

    function processPendTransp(link_id) {

        $('#transp_detail').html('Processing...');
        $('#acc' + link_id).prop('disabled', true);
        $.ajax({
            url: "/service/selpending?proc=PROCESS&transp_id=" + link_id
        }).done(function (data) {
            $('#transp_detail').html(data);
            $('#acc' + link_id).prop('disabled', false);
        });
        return false;
    }

// -->
</script>


