<div class="col-sm-8">
    <div class="row gray_ttc">
        <div class="col-sm-12 ">
            <span class="col-sm-12 h3 text-left"> My Invoice</span>
        </div>
        <div class="col-sm-12">
            <hr><br>
        </div>
        <div class="col-sm-12  text-left">
            <span class="col-sm-12  text-left" style="background-color: #F0F0F0">
                <a href="<?php echo base_url(); ?>">Dashboard</a> -> 
                <a href="<?php echo base_url('user/invoice'); ?>">My Invoice</a> -> 
                View Invoice -> 
                Invoice # <?php echo $invoice_number; ?>
                <input type="hidden" id="baseUrl" value="<?php echo base_url(); ?>">
                <input type="hidden" id="invoiceID" value="<?php echo $invoice_id; ?>">
            </span>
        </div>
        <div class="col-sm-12 ">
            <br>
        </div>
<!--        <div class="col-sm-12" id="invoice">
            <?php
//            if ($payment_info->person_id == $this->session->person_id) {
//                if (empty($payment_invoice_info)) {
//                    if (in_array($payment_info->payment_status, Array(2, 3))) {
                        ?>
                        <div class="col-sm-4 form-group">
                            <div class="input-group">
                                <select class="form-control" id="currency<?php echo $invoice_id; ?>">
                                    <option value=""> -Select Currency - </option>
                                    <?php
//                                    if ($person_info->person_country == 'BD') {
//                                        if (isset($currency_info)) {
//                                            echo ($currency_info->currency_type == 1) ? '<option value="1">BDT</option>' : '<option value="2">USD</option>';
//                                        } else {
//                                            echo '<option value="1">BDT</option>';
//                                            echo '<option value="2">USD</option>';
//                                        }
//                                    } else {
//                                        echo '<option value="2">USD</option>';
//                                    }
                                    ?>
                                </select>
                                <span class="input-group-addon" id="basic-addon1" title="Please select money Currency"><i class="fa fa-money"></i></span>
                            </div>
                        </div>

                        <div class="col-sm-4 form-group" >
                            <select class="form-control" 
                                    id="view_payment_type">
                                <option value=""> Select Payment Method </option>
                            </select>
                        </div>

                        <div class="form-group col-sm-3" id="change_button">
                            <button type="button" 
                                    class="btn btn-success" 
                                    style="font-size: 14px;" 
                                    id="paymentBtn">Choose Payment Method</button>
                        </div>
                        <?php
//                    }
//                }
//            }
            ?>
        </div>-->
<?php
$invoice_id_infprmation= explode('-', $invoice_number);


$temp_invoice_id=$invoice_id_infprmation[1];

?>

<div class="form-group col-sm-3" id="change_button">    
    <a href="<?php echo base_url();?>pay-invoice/<?php echo $temp_invoice_id; ?>"><button type="button" 
                                    class="btn btn-success" 
                                    style="font-size: 14px;" 
                                    >Pay Now</button></a>
                        </div>

        <div class="col-sm-12 ">
            <span class="col-sm-12">
                <?php
                if (isset($this->session->sess_message)) {
                    echo $this->session->sess_message;
                    $this->session->unset_userdata('sess_message');
                }
                ?>
            </span>
            <br> 
            <div class="col-sm-12 text-left">Invoice# <?php echo $invoice_number; ?></div>
            <hr> 
            <br>
            <br>
        </div>

        <div class="col-sm-12 ">
            <div class="col-sm-6 text-left">
                <address>
                    Billing BY <br>
                    <?php echo $person_info->person_first_name; ?></br>
                    <?php
                    echo '<br>';

                    if ($person_info->person_address != '') {
                        echo $person_info->person_address . '<br>';
                    }
                    if ($person_info->person_city != '') {
                        echo $person_info->person_city . '<br>';
                    }
                    if ($person_info->person_country) {
                        ?>
                        <span id="country_name"></span><br>
                        <script>
                            CountryCode = '<?php echo $person_info->person_country; ?>';
                            $(document).ready(function () {
                                CountryName = getCountryName(CountryCode);
                                if (CountryName !== null)
                                    document.getElementById('country_name').innerHTML = CountryName;
                            });
                        </script>
                    <?php } ?>
                </address>
            </div>

            <div class="col-sm-6 text-right">
                <span style="color: green;font-size: 22px;font-weight: bold"> 
                    <?php
                    $status = array('', 'Paid', 'Partial Paid', 'Unpaid', 'Droped', 'Cancel', 'Pending', 'Request Refund', 'Refund');
                    $status_color = array('', 'green', 'blue', 'red', '#dba900', 'red', 'red', 'red', 'red');
                    echo "<span style='color:" . $status_color[$payment_info->payment_status] . "'>" . $status[$payment_info->payment_status] . "</span><br>";
                    ?>
                </span></br><br>
            </div>
            <div class="col-sm-6">
                <address class="text-right">
                    Invoice Date : <span style="margin-left: 30px"> <?php echo $invoice_info->invoice_created_date; ?></span> <br>
                    Invoice Due Date : <span style="margin-left: 5px">  
                        <?php
                        echo (isset($payment_invoice_info->invoice_paid_date)) ? $payment_invoice_info->invoice_paid_date : 'none';
                        ?>
                    </span><br>
                </address>
            </div>

        </div>
        <div class="col-sm-12">
            <br>
        </div>

        <div class="col-sm-12">
            <table style="border: 1px solid #ddd" class="table table-striped table-hover col-sm-12 table-responsive">
                <thead>
                    <tr>
                        <th class="col-sm-6 text-center">Description </th>
                        <th class="col-sm-3 text-center">Unit Price</th>
                        <th class="col-sm-3 text-center">Total</th>
                    </tr>
                </thead>
                <tbody>
                    <tr class="gray_ttc">
                        <td class="col-sm-6 text-left">
                            <?php echo $invoice_info->invoice_description; ?>
                        </td>

                        <td class="col-sm-3 text-center" id="unitPrice">
                            <?php echo $unit_price . $currency_sign; ?>
                        </td>
                        <td class="col-sm-3 text-right" id="totalPrice">
                            <?php echo $total_price . $currency_sign; ?>
                        </td>
                    </tr>
                    <tr class="gray_ttc">
                        <td class="text-right" colspan="2">
                            Sub Total
                        </td>
                        <td class="col-sm-2 text-right" id="totalPrice1">
                            <?php echo $total_price . $currency_sign; ?>
                        </td>
                    </tr>
                    <tr class="gray_ttc">
                        <td class="text-right" colspan="2">
                            Discount
                        </td>
                        <td class="col-sm-2 text-right" id="totalPrice1">
                            <?php echo $discount_price . $currency_sign; ?>
                        </td>
                    </tr>
                    <tr class="gray_ttc">
                        <td class="text-right" colspan="2"> Due </td>
                        <td class="col-sm-2 text-right" id="dueAmount">
                            <?php
                            echo ($due_amount < 0) ? '0.00' : $due_amount . $currency_sign;
                            ?>
                        </td>
                    </tr>

                    <tr class="gray_ttc">
                        <td class="text-right" colspan="2">
                            Total Paid
                        </td>
                        <td class="col-sm-2 text-right" >
                            <?php echo ($paid_amount == 0) ? '0.00' : $paid_amount . $currency_sign; ?>
                        </td>
                    </tr>
                    <?php
                    if ($refund_payment_info) {
                        ?>
                        <tr class="gray_ttc">
                            <td class="text-right" colspan="2">
                                Refund Amount
                            </td>
                            <td class="col-sm-2 text-right" >
                                <?php echo $refund_payment_info->payment_refund_amount . $currency_sign; ?>
                            </td>
                        </tr>
                        <?php
                    }
                    ?>
                </tbody>
            </table>
        </div>
    </div>
    <!--All modal view-->
</div>
<?php
include_once 'modal/bkash_payment.php';
include_once 'modal/cheque_payment.php';
include_once 'modal/cash_payment.php';
?>
<script type="text/javascript" src="<?php echo base_url() ?>front_end_resource/payment/invoice.js"></script>