
<?php $this->load->view('site/layout'); ?>
<link href="<?php echo base_url() ?>public/css/style.bundle_front.css"
      rel="stylesheet" type="text/css" />
<style>
    .label {
        border-radius: 0%;
        width: 100%;
        font-weight: bold;
        font-size: 12px;
    }
    .first_ele{
        text-align: left;
    }
    .last_ele{
        text-align: right;
    }
    .rtl .first_ele{
        text-align: right;
    }
    .rtl .last_ele{
        text-align: left;
    }
    .rtl .table{
        text-align: right;
    }
    .first_notes{
        float: left;
    }
    .last_notes{
        float: right;
    }
    .rtl .first_notes{
        float: right;
        text-align: right;
    }
    .rtl .last_notes{
        float: left;
        text-align: right;
    }
</style>
<div
    class="kt-content  kt-grid__item kt-grid__item--fluid kt-grid kt-grid--hor"
    id="kt_content">

    <!-- begin:: Content Head -->
   
</div>

<div
    class="kt-container  kt-container--fluid  kt-grid__item kt-grid__item--fluid"
    style="margin-bottom: 40px">
    <div class="card card-custom overflow-hidden">
        <div class="card-body p-0">
            <!-- begin: Invoice-->
            <!-- begin: Invoice header-->
            <div
                class="row justify-content-center bgi-size-cover bgi-no-repeat py-8 px-8 py-md-27 px-md-0"
                style="background-image: url(<?= base_url() ?>public/media/bg/bg-6.jpg);margin: 0px">
                <div class="col-md-9">
                    <div
                        class="d-flex justify-content-between pb-10 pb-md-20 flex-column flex-md-row"
                        style="margin: 0px">
                        <h1 class="display-4 text-white font-weight-boldest mb-10"><?php echo $this->config->item('company_title') ?></h1>
                        <div class="d-flex flex-column align-items-md-end px-0">
                            <!--begin::Logo-->
                            <a style="margin-bottom: 5px"> <img style="width: 100px"
                                                                src="<?= base_url() ?>public/upload/userimage/<?= $this->config->item('invoice_logo') ?>" alt="" />
                            </a>
                            <!--end::Logo-->
                            <span
                                class="text-white d-flex flex-column align-items-md-end opacity-70">
                                <span><?php echo $this->config->item('company_address') ?></span>
                                <span><?php echo $this->config->item('company_email') ?></span>
                                <span><?php echo $this->lang->line('phone') ?><?php echo $this->config->item('company_mobile') ?></span>
                            </span>
                        </div>
                    </div>
                    <div class="border-bottom w-100 opacity-20"></div>
                    <div class="d-flex justify-content-between text-white pt-6">
                        <div class="d-flex flex-column flex-root first_ele">
                            <span class="font-weight-bolde mb-2r"><?= $this->lang->line('data') ?></span> <span
                                class="opacity-70"><?= date('M d, Y', strtotime($show['date_now'])) ?></span>
                        </div>
                        <div class="d-flex flex-column flex-root"
                             style="text-align: center">
                            <span class="font-weight-bolder mb-2"><?= $this->lang->line('invoice_num') ?></span> <span
                                class="opacity-70">INV <?= str_pad($show['id_orders'], 6, "0", STR_PAD_LEFT); ?></span>
                        </div>
                        <div class="d-flex flex-column flex-root last_ele"
                             >
                            <span class="font-weight-bolder mb-2"><?= $this->lang->line('invoice_to') ?></span> <span
                                class="opacity-70"><?= $show['name'] ?> <br /><?= $show2['phone'] ?>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <!-- end: Invoice header-->
            <!-- begin: Invoice body-->
            <div class="row justify-content-center py-8 px-8 py-md-10 px-md-0"
                 style="margin: 0px">
                <div class="col-md-9">
                    <div class="table-responsive">
                        <table class="table" >
                            <thead>
                                <tr>
                                    <th class="pl-0 font-weight-bold text-muted text-uppercase"><?= $this->lang->line('product') ?></th>
                                    <th
                                        class="text-right font-weight-bold text-muted text-uppercase eshtraq"><?= $this->lang->line('start-date') ?></th>
                                    <th
                                        class="text-right font-weight-bold text-muted text-uppercase eshtraq"><?= $this->lang->line('end-date') ?></th>
                                    <th
                                        class="text-right pr-0 font-weight-bold text-muted text-uppercase qu"><?= $this->lang->line('quantity') ?></th>

                                    <th
                                        class="text-right pr-0 font-weight-bold text-muted text-uppercase"><?= $this->lang->line('the-amount') ?></th>
                                    <th
                                        class="text-right pr-0 font-weight-bold text-muted text-uppercase discount"><?= $this->lang->line('discount') ?></th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $qu = $discount = $eshtraq = FALSE;
                                foreach ($producer as $value) {
                                    ?>
                                    <tr class="font-weight-boldest font-size-lg">
                                        <td class="pl-0 pt-7"><?= $value->name_order ?></td>
                                        <?php
                                        if ($value->start_date) {
                                            $eshtraq = TRUE;
                                            ?>
                                            <td class="text-right pt-7"><?= date('d/m/Y', strtotime($value->start_date)) ?></td>
                                        <?php } ?>
                                        <?php
                                        if ($value->expiry_date) {
                                            $eshtraq = TRUE;
                                            ?>
                                            <td class="text-right pt-7"><?= date('d/m/Y', strtotime($value->expiry_date)) ?></td>
                                        <?php } ?>
                                        <?php
                                        if ($value->quantity != 0) {
                                            $qu = true;
                                            ?>
                                            <td class="pr-0 pt-7 text-right"><?= $value->quantity ?></td>
                                        <?php } ?>
                                        <td class="text-danger pr-0 pt-7 text-right"><?= $value->payment ?> <?= $sett->inv_currency ?></td>
                                        <?php
                                        if ($value->discount) {
                                            $discount = TRUE;
                                            ?>
                                            <td class="pr-0 pt-7 text-right"><?= $value->discount ?> <?= $sett->inv_currency ?></td>
    <?php } ?>


                                    </tr>
<?php } ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <!-- end: Invoice body-->
            <!-- begin: Invoice footer-->
            <div
                class="row justify-content-center bg-gray-100 py-8 px-8 py-md-10 px-md-0"
                style="margin: 0px">
                <div class="col-md-9">
                    <div
                        class="d-flex justify-content-between flex-column flex-md-row font-size-lg">
                        <div class="d-flex flex-column mb-10 mb-md-0">
                            <div class="font-weight-bolder font-size-lg mb-3"><?php echo $this->lang->line('payment-status') ?></div>
                            <div class="d-flex justify-content-between mb-3">
                                <?php
                                if ($show['paid'] == '')
                                    echo $this->lang->line('not-paid');

                                if ($show['paid'] == '1')
                                    echo '<span class="label label-success">' . $this->lang->line('payment-is-made') . '</span>';
                                if ($show['paid'] == '3')
                                    echo '<span class="label label-warning">' . $this->lang->line('complimentary') . '</span>';
                                if ($show['paid'] == '4')
                                    echo '<span class="label label-primary">' . $this->lang->line('retriever') . '</span>';
                                ?>
                            </div>

                        </div>
                        <div class="d-flex flex-column text-md-right">
                            <span class="font-size-lg font-weight-bolder mb-1"><?= $this->lang->line('total_amount') ?></span>
                            <span class="font-size-h2 font-weight-boldest text-danger mb-1"
                                  style="text-align: center"><?= $price ? $price->total_price : '' ?> <?= $sett->inv_currency ?></span>
                          <!-- <span>Taxes Included</span>  -->
                        </div>


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



            <div class="row justify-content-center py-8 px-8 py-md-10 px-md-0"
                 style="margin: 0px;padding-bottom: 0rem !important;">
                <div class="col-md-9">
                    <div class="col-md-5 first_notes" >
                        <div class="font-weight-bolder font-size-lg mb-3"><?php echo $this->lang->line('terms-and-conditions') ?></div>
                        <div class="d-flex justify-content-between mb-3">
<?= $this->session->userdata('language') == 'arabic' ? $sett->inv_footer_ar : $sett->inv_footer ?>
                        </div>
                    </div>
                    <div class="col-md-5 last_notes" >
                        <div class="font-weight-bolder font-size-lg mb-3"><?php echo $this->lang->line('notes') ?></div>
                        <div class="d-flex justify-content-between mb-3">
<?= $show['note'] ?>
                        </div>
                    </div>
                </div>
            </div>
            <!-- end: Invoice footer-->
            <!-- begin: Invoice action-->
            <div class="row justify-content-center py-8 px-8 py-md-10 px-md-0"
                 style="margin: 0px">
                <div class="col-md-9">
                    <div class="d-flex justify-content-between">
                        <!-- <button type="button"
                                class="btn btn-light-primary font-weight-bold"
                                onclick="window.print();">Download Invoice</button>  
                         <button type="button" class="btn btn-primary font-weight-bold"
                                onclick="window.print();">Print Invoice</button> -->
                    </div>
                </div>
            </div>
            <!-- end: Invoice action-->
            <!-- end: Invoice-->
        </div>
    </div>
</div>

<?php $this->load->view('site/footer_2') ?>
<script>
<?php if (!$qu) { ?>
        $(".qu").hide();
<?php } ?>
<?php if (!$discount) { ?>
        $(".discount").hide();
<?php } ?>
<?php if (!$eshtraq) { ?>
        $(".eshtraq").hide();
<?php } ?>
</script>
