<?php $__env->startSection('content'); ?>
    <div class="col-md-12 content-header" >
        <h1><i class="fa fa-money"></i> <?php echo e(trans('application.pay_invoice')); ?></h1>
    </div>
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-md-12 text-right" style="max-width:1040px;">
                                <?php echo Form::open(['route' => ['stripesuccess']]); ?>

                                    <input type="hidden" name="invoice_id" value="<?php echo e($invoice->uuid); ?>"/>
                                    <input type="hidden" name="amount" value="<?php echo e($invoice->totals['amountDue']); ?>"/>
                                    <script src="https://checkout.stripe.com/checkout.js" class="stripe-button" data-key="<?php echo e($stripe_key); ?>"
                                            data-name="<?php echo e(!empty($settings) ? $settings->name : ''); ?>"
                                            data-description="<?php echo e(get_company_name()); ?>"
                                            data-color="black"
                                            data-currency="<?php echo e(strtolower(defaultCurrencyCode())); ?>"
                                            data-amount="<?php echo e(currency_convert(getCurrencyId($invoice->currency),$invoice->totals['amountDue'])*100); ?>"
                                            data-image="<?php echo e(asset('assets/img/dollar.png')); ?>">
                                    </script>
                                <?php echo Form::close(); ?>

                            </div>
                        </div>
                        <div class="row">
                            <div class="invoice">
                                <div class="row">
                                    <div class="col-md-3">
                                        <div class="panel-body">
                                            <?php if($invoiceSettings && $invoiceSettings->logo != ''): ?>
                                                <img src="<?php echo e(asset('assets/img/'.$invoiceSettings->logo)); ?>" alt="logo" width="100%"/>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                    <div class="col-md-9 text-right">
                                        <div class="panel-body" style="font-size: 16px;font-weight: bold;padding:0">
                                            <div class="col-xs-12 text-right"> <h1 style="margin:0"><?php echo e(trans('application.invoice')); ?></h1></div>
                                            <div class="col-xs-9 text-right invoice_title"><?php echo e(trans('application.reference')); ?></div>
                                            <div class="col-xs-3 text-right"><?php echo e($invoice->number); ?></div>
                                            <div class="col-xs-9 text-right invoice_title"><?php echo e(trans('application.date')); ?></div>
                                            <div class="col-xs-3 text-right"><?php echo e(format_date($invoice->invoice_date)); ?></div>
                                            <?php if($invoice->due_date != '0000-00-00'): ?>
                                                <div class="col-xs-9 text-right invoice_title"><?php echo e(trans('application.due_date')); ?></div>
                                                <div class="col-xs-3 text-right"><?php echo e(format_date($invoice->due_date)); ?></div>
                                            <?php endif; ?>
                                            <?php if($settings && $settings->gst != ''): ?>
                                                <div class="col-xs-9 text-right invoice_title"><?php echo e(trans('application.gst_number')); ?></div>
                                                <div class="col-xs-3 text-right"><?php echo e($settings ? $settings->gst : ''); ?></div>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                </div>

                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="panel-body">
                                            <h4 class="invoice_title"><?php echo e(trans('application.our_information')); ?></h4><hr class="separator"/>
                                            <?php if($settings): ?>
                                                <h4><?php echo e($settings->name); ?></h4>
                                                <?php echo e($settings->address1 ? $settings->address1.',' : ''); ?> <?php echo e($settings->state ? $settings->state : ''); ?><br/>
                                                <?php echo e($settings->city ? $settings->city.',' : ''); ?> <?php echo e($settings->postal_code ? $settings->postal_code.','  : ''); ?><br/>
                                                <?php echo e($settings->country); ?><br/>
                                                <?php if($settings->phone != ''): ?>
                                                    <?php echo e(trans('application.phone')); ?>: <?php echo e($settings->phone); ?><br/>
                                                <?php endif; ?>
                                                <?php if($settings->email != ''): ?>
                                                    <?php echo e(trans('application.email')); ?>: <?php echo e($settings->email); ?>.
                                                <?php endif; ?>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                    <div class="col-xs-6">
                                        <div class="panel-body">
                                            <h4 class="invoice_title"><?php echo e(trans('application.billing_to')); ?> </h4><hr class="separator"/>
                                            <h4><?php echo e($invoice->client->name); ?></h4>
                                            <?php echo e($invoice->client->address1 ? $invoice->client->address1.',' : ''); ?> <?php echo e($invoice->client->state ? $invoice->client->state : ''); ?><br/>
                                            <?php echo e($invoice->client->city ? $invoice->client->city.',' : ''); ?> <?php echo e($invoice->client->postal_code ? $invoice->client->postal_code.','  : ''); ?><br/>
                                            <?php echo e($invoice->client->country); ?><br/>
                                            <?php if($invoice->client->phone != ''): ?>
                                                <?php echo e(trans('application.phone')); ?>: <?php echo e($invoice->client->phone); ?><br/>
                                            <?php endif; ?>
                                            <?php if($invoice->client->email != ''): ?>
                                                <?php echo e(trans('application.email')); ?>: <?php echo e($invoice->client->email); ?>.
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-12">
                                    <table class="table">
                                        <thead style="margin-bottom:30px;background: #2e3e4e;color: #fff;">
                                        <tr>
                                            <th style="width:50%"><?php echo e(trans('application.product')); ?></th>
                                            <th style="width:10%" class="text-center"><?php echo e(trans('application.quantity')); ?></th>
                                            <th style="width:15%" class="text-right"><?php echo e(trans('application.price')); ?></th>
                                            <th style="width:10%" class="text-center"><?php echo e(trans('application.tax')); ?></th>
                                            <th style="width:15%" class="text-right"><?php echo e(trans('application.total')); ?></th>
                                        </tr>
                                        </thead>
                                        <tbody id="items">
                                        <?php $__currentLoopData = $invoice->items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getFirstLoop(); ?>
                                            <tr>
                                                <td><b><?php echo $item->item_name; ?></b><br/><?php echo $item->item_description; ?></td>
                                                <td class="text-center"><?php echo e($item->quantity); ?></td>
                                                <td class="text-right"><?php echo e(format_amount($item->price)); ?></td>
                                                <td class="text-center"><?php echo e($item->tax ? $item->tax->value.'%' : ''); ?></td>
                                                <td class="text-right"><?php echo e(format_amount($invoice->totals[$item->uuid]['itemTotal'])); ?></td>
                                            </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getFirstLoop(); ?>
                                        </tbody>
                                    </table>
                                </div>
                                <div class="col-md-6" style="padding: 7% 12% 0 15%; text-transform: uppercase">
                                    <?php if($invoiceSettings && $invoiceSettings->show_status): ?>
                                        <div class="<?php echo e($invoice->status == 2 ? 'invoice_status_paid' : 'invoice_status_cancelled'); ?>">
                                            <?php echo e(statuses()[$invoice->status]['label']); ?>

                                        </div>
                                    <?php endif; ?>
                                </div>
                                <div class="col-md-6">
                                    <div class="table-responsive">
                                        <table class="table">
                                            <tbody>
                                            <tr>
                                                <th style="width:50%"><?php echo e(trans('application.subtotal')); ?></th>
                                                <td class="text-right">
                                                    <span id="subTotal"><?php echo e(format_amount($invoice->totals['subTotal'])); ?></span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th><?php echo e(trans('application.tax')); ?></th>
                                                <td class="text-right">
                                                    <span id="taxTotal"><?php echo e(format_amount($invoice->totals['taxTotal'])); ?></span>
                                                </td>
                                            </tr>
                                            <?php if($invoice->totals['discount'] > 0): ?>
                                                <tr>
                                                    <th><?php echo e(trans('application.discount')); ?></th>
                                                    <td class="text-right">
                                                        <span id="taxTotal"><?php echo e(format_amount($invoice->totals['discount'])); ?></span>
                                                    </td>
                                                </tr>
                                            <?php endif; ?>
                                            <tr>
                                                <th><?php echo e(trans('application.total')); ?></th>
                                                <td class="text-right">
                                                    <span id="grandTotal"><?php echo e(format_amount($invoice->totals['grandTotal'])); ?></span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th><?php echo e(trans('application.paid')); ?></th>
                                                <td class="text-right">
                                                    <span id="grandTotal"><?php echo e(format_amount($invoice->totals['paidFormatted'])); ?></span>
                                                </td>
                                            </tr>
                                            <tr class="amount_due">
                                                <th><?php echo e(trans('application.amount_due')); ?>:</th>
                                                <td class="text-right">
                                                    <span class="currencySymbol" style="display: inline-block;"><?php echo e($invoice->currency); ?> </span>
                                                    <span id="amountDue"><?php echo e($invoice->totals['amountDue']); ?></span>
                                                </td>
                                            </tr>
                                            </tbody></table>
                                    </div>
                                </div>
                                <div class="col-md-12">
                                    <?php if($invoice->notes): ?>
                                        <h4 class="invoice_title"><?php echo e(trans('application.notes')); ?></h4><hr class="separator"/>
                                        <?php echo e($invoice->notes); ?> <br/><br/>
                                    <?php endif; ?>
                                    <?php if($invoice->terms): ?>
                                        <h4 class="invoice_title"><?php echo e(trans('application.terms')); ?></h4><hr class="separator"/>
                                        <?php echo $invoice->terms; ?>

                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="cleafix"></div>
        </div>
    </section>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('clientarea.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>