<?
//print_r($_SESSION['selected_user_row']);
?>
<!-- Dashboard content -->
<div class="row">
    <?
    include 'extra/member_head.php';
    ?>



    <div class="col-lg-6"> 

        <div class="panel panel-flat">
            <div class="panel-heading">
                <h6 class="panel-title">Payment Cards for : <?= $_SESSION['selected_user_row']->firstname ?> <?= $_SESSION['selected_user_row']->lastname ?>, <?= $_SESSION['selected_user_row']->street1 ?>, <?= $_SESSION['selected_user_row']->street2 ?>,<?= $_SESSION['selected_user_row']->city ?>,<?= $_SESSION['selected_user_row']->state ?>,<?= $_SESSION['selected_user_row']->zipcode ?></h6>
            </div>

            <div class="panel-body">

                <form class="form-horizontal" method="POST" action="/members/payments">
                    <input type="hidden" name="member_id" value="<?= $_SESSION['selected_user_row']->member_id ?>">
                    <fieldset class="content-group">
                        <legend class="text-bold">Add New Card:</legend>
                        <div class="form-group">
                            <label class="control-label col-lg-2">Process By</label>
                            <div class="col-lg-10">
                                <input type="text" class="form-control" readonly="readonly" value='Web Admin'>
                            </div>
                        </div>


                        <div class="form-group">
                            <label class="control-label col-lg-2">Name on Card</label>
                            <div class="col-lg-10">
                                <input type="text" class="form-control"  name="cardname" value="<?= $cardname ?>" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-lg-2">Card No</label>
                            <div class="col-lg-8">
                                <input type="text" class="form-control"  name="cardnumber" placeholder='Card Number' value="<?= $cardnumber ?>">
                            </div>
                            <div class="col-lg-2">
                                <input type="text" class="form-control"  name="cvc" placeholder='cvv2' value="<?= $cvc ?>">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-lg-2"></label>

                            <div class="col-lg-2">
                                Exp. Month
                            </div>
                            <div class="col-lg-3">
                                <!-- input type="text" class="form-control"  name="exp_month" placeholder='exp_month' value="<?= $exp_month ?>" -->

                                <select name="exp_month" class="form-control">
                                    <option value="01">January</option>
                                    <option value="02">February</option>
                                    <option value="03">March</option>
                                    <option value="04">April</option>
                                    <option value="05">May</option>
                                    <option value="06">June</option>
                                    <option value="07">July</option>
                                    <option value="08">August </option>
                                    <option value="09">September</option>
                                    <option value="10">October </option>
                                    <option value="11">November </option>
                                    <option value="12">December </option>
                                </select>
                            </div>
                            <div class="col-lg-2">
                                Exp. Year
                            </div>
                            <div class="col-lg-3">
                                <!-- input type="text" class="form-control"  name="exp_year" placeholder='exp_year' value="<?= $exp_year ?>" -->

                                <select name="exp_year" class="form-control">
                                    <option value="2018">2018</option>
                                    <option value="2019">2019</option>
                                    <option value="2020">2020</option>
                                    <option value="2021">2021</option>
                                    <option value="2022">2022</option>
                                    <option value="2023">2023</option>		
                                </select>
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="control-label col-lg-2">Address</label>
                            <div class="col-lg-10">
                                <input type="text" class="form-control"  name="street1" value="<?= $street1 ?>" readonly>
                            </div>
                        </div>  

                        <div class="form-group">
                            <label class="control-label col-lg-2">City/Zipcode/State</label>
                            <div class="col-lg-4"> 
                                <input type="text" class="form-control" name="city" placeholder='City..' value="<?= $city ?>" readonly>
                            </div>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" name="zipcode" placeholder="ZipCode" value="<?= $zipcode ?>" readonly>
                            </div>
                            <div class="col-lg-3">
                                <select name="state" class="form-control" readonly>
                                    <option value="GA">Georgia</option>                                                                 
                                </select>
                            </div>
                        </div>      

                    </fieldset>
                    <div class="text-left">
                        <?= $card_save_message ?>
                    </div>
                    <div class="text-right">
                        <button type="submit" class="btn btn-primary">Add Card <i class="icon-arrow-right14 position-right"></i></button>
                    </div>
                </form>

            </div>
        </div>

    </div>

    <div class="col-lg-6">
        <!-- Recent Members -->
        <div class="panel panel-flat">
            <div class="panel-heading">
                <h6 class="panel-title">[<b><?= $_SESSION['selected_user_row']->firstname ?> <?= $_SESSION['selected_user_row']->lastname ?></b>] -  [<?= $_SESSION['selected_user_row']->username ?>]</h6>                
            </div>

            <div class="panel-body">
                <div id="sales-heatmap"></div>
            </div>

            <div class="table-responsive">
                <table class="table text-nowrap">
                    <thead>
                        <tr>
                            <th>Address</th>                         
                            <th style="width:110px; ">Pry.Phone</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>

                            <td>
                                <span class="text-semibold"><?= $_SESSION['selected_user_row']->street1 ?>, <?= $_SESSION['selected_user_row']->street2 ?>,<?= $_SESSION['selected_user_row']->city ?>,<?= $_SESSION['selected_user_row']->state ?>,<?= $_SESSION['selected_user_row']->zipcode ?></span>
                            </td>
                            <td>
                                <h6 class="text-semibold no-margin"><? echo $_SESSION['selected_user_row']->primary_phone; ?></h6>
                            </td>
                        </tr>               

                    </tbody>
                </table>
            </div>
        </div>
        <!-- /Recent Members -->

        <!-- Form horizontal -->
        <div class="panel panel-flat">



            <div class="panel-heading">
                <h5 class="panel-title">Previous Cards</h5> 
            </div>

            <div class="panel-body">           

                <?= $other_cards ?>
            </div>
            <div>
                <button id="butdelcard" name="butdelcard" type="submit" onclick="deleteAllPaymentCards(<? echo $_SESSION['selected_user_row']->member_id; ?>);" class="btn btn-primary btn-xs">Delete all & Clear Stripe ID </button>     <div id="delcardall"></div>            
            </div>
        </div>
        <!-- /form horizontal -->
    </div>
</div>
<!-- /dashboard content -->


<script type="text/javascript">
<!--
    function deleteAllPaymentCards(member_id) {

        $('#delcardall').html('Processing...');
        $('#butdelcard').prop('disabled', true);
        $.ajax({
            url: "/members/deletaallcards?proc=PROCESS&member_id=" + member_id
        }).done(function (data) {
            $('#delcardall').html(data);
            $('#butdelcard').prop('disabled', false);
        });
        return false;
    }
// -->
</script>


