Add paypal payments
This commit is contained in:
111
resources/views/theme/backend/adminlte/u/invoice/cart.blade.php
Normal file
111
resources/views/theme/backend/adminlte/u/invoice/cart.blade.php
Normal file
@@ -0,0 +1,111 @@
|
||||
@extends('adminlte::layouts.app')
|
||||
|
||||
@section('htmlheader_title')
|
||||
Payment Cart
|
||||
@endsection
|
||||
|
||||
@section('contentheader_title')
|
||||
Payment Cart
|
||||
@endsection
|
||||
@section('contentheader_description')
|
||||
@endsection
|
||||
|
||||
@section('main-content')
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">Invoices to Pay</span>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ url('u/checkout/pay') }}">
|
||||
{{ csrf_field() }}
|
||||
<input type="hidden" name="type" value="invoice">
|
||||
|
||||
<div class="input-group flex-nowrap mb-5">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">Payment Method</span>
|
||||
</div>
|
||||
|
||||
<select class="form-control" id="paymethod" name="checkout_id[]" required>
|
||||
<option></option>
|
||||
@foreach (\App\Models\Checkout::active()->orderBy('name')->get() as $oo)
|
||||
<option value="{{ $oo->id }}">{{ $oo->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<table id="invoices" class="table table-sm w-100">
|
||||
<tr>
|
||||
<th>Invoice</th>
|
||||
<th class="text-right">Balance Due</th>
|
||||
</tr>
|
||||
|
||||
@foreach ($invoices as $io)
|
||||
<input type="hidden" name="invoice_id[]" value="{{ $io->id }}">
|
||||
<tr>
|
||||
<td>{{ $io->id }}</td>
|
||||
<td class="text-right">{{ $io->due }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="text-right">Sub Total</th>
|
||||
<td class="text-right">{{ number_format($invoices->sum('due'),2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-right">Payment Fees</th>
|
||||
<td class="text-right"><span id="payfee">TBA</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-right">Payment Total</th>
|
||||
<th class="text-right"><span id="paytotal">TBA</span></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<input type="submit" class="btn btn-dark mt-2" name="pay" value="Cancel">
|
||||
<input type="submit" class="btn btn-success mt-2 float-right" name="pay" value="Submit" disabled>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('page-scripts')
|
||||
@css('//cdnjs.cloudflare.com/ajax/libs/select2/4.0.12/css/select2.min.css','select-css')
|
||||
@js('//cdnjs.cloudflare.com/ajax/libs/select2/4.0.12/js/select2.min.js','select-js')
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#paymethod').select2({
|
||||
placeholder: 'Payment method...',
|
||||
|
||||
}).on('change',function(item) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {total: {{ $invoices->sum('due') }},count: {{ $invoices->count() }} },
|
||||
dataType: "json",
|
||||
cache: true,
|
||||
url: '{{ url('api/u/checkout/fee') }}'+'/'+$(this).val(),
|
||||
timeout: 25000,
|
||||
error: function(x) {
|
||||
alert("Failed to submit, please try again...");
|
||||
},
|
||||
success: function(data) {
|
||||
$("span[id=payfee]").html(data.toFixed(2));
|
||||
$("span[id=paytotal]").html(({{ $invoices->sum('due') }}+data).toFixed(2));
|
||||
$("input[type=submit]").prop('disabled',false);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@append
|
232
resources/views/theme/backend/adminlte/u/invoice/home.blade.php
Normal file
232
resources/views/theme/backend/adminlte/u/invoice/home.blade.php
Normal file
@@ -0,0 +1,232 @@
|
||||
@extends('adminlte::layouts.app')
|
||||
|
||||
@section('htmlheader_title')
|
||||
Invoice #{{ $o->id }}
|
||||
@endsection
|
||||
|
||||
@section('contentheader_title')
|
||||
Invoice #{{ $o->id }}
|
||||
@endsection
|
||||
@section('contentheader_description')
|
||||
{{ $o->invoice_account_id }}
|
||||
@endsection
|
||||
|
||||
@section('main-content')
|
||||
<!-- Main content -->
|
||||
<div class="invoice p-3 mb-3">
|
||||
<!-- title row -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h4>
|
||||
<i class="fa fa-globe"></i> {{ $so->site_name }}
|
||||
<small class="float-right">Date: {{ $o->invoice_date}}</small>
|
||||
</h4>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
|
||||
<!-- info row -->
|
||||
<div class="row invoice-info">
|
||||
<div class="col-4 invoice-col">
|
||||
FROM:
|
||||
<address>
|
||||
<strong>{{ $so->site_name }}</strong><br>
|
||||
{!! $so->address('html') !!}<br>
|
||||
<br>
|
||||
<strong>Email:</strong> {{ $so->site_email }}<br>
|
||||
<strong>Phone:</strong> {{ $so->site_phone }}
|
||||
</address>
|
||||
</div>
|
||||
|
||||
<div class="col-4 invoice-col">
|
||||
TO:
|
||||
<address>
|
||||
<strong>{{ $o->account->company }}</strong><br>
|
||||
{!! $o->account->address('html') !!}<br>
|
||||
<br>
|
||||
<strong>Email:</strong> {{ $o->account->email }}<br>
|
||||
@if ($o->account->phone)
|
||||
<strong>Phone:</strong> {{ $o->account->phone }}<br>
|
||||
@endif
|
||||
</address>
|
||||
</div>
|
||||
|
||||
<div class="ml-auto col-3">
|
||||
<table class="table table-borderless text-right" style="font-size: 1.1rem;">
|
||||
<tr >
|
||||
<td class="p-0">Account:</td><td class="p-0"><strong>{{ $o->account->account_id }}</strong></td>
|
||||
</tr>
|
||||
<tr >
|
||||
<td class="p-0">Invoice:</td><td class="p-0"><strong>{{ $o->invoice_id }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="p-0">Payment Due:</td><td class="p-0"><strong>{{ $o->due_date->format('Y-m-d') }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="p-0">Total Due:</td><td class="p-0"><strong>${{ number_format($o->total,$o->currency()->rounding) }}</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
<!-- Table row -->
|
||||
<div class="row">
|
||||
<div class="col-12 table-responsive">
|
||||
<table id="restripe" class="table" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Qty</th>
|
||||
<th>Product</th>
|
||||
<th colspan="2">Description</th>
|
||||
<th class="text-right" colspan="3">Subtotal</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($o->products() as $po)
|
||||
<tr id="invoice-services">
|
||||
<td>{{ $po->count }}</td>
|
||||
<td>{{ $po->product_id }}</td>
|
||||
<td colspan="2">{{ $po->name($o->account->user->language) }}</td>
|
||||
<td colspan="3" class="text-right">${{ number_format($o->items->filter(function($item) use ($po) {return $item->product_id == $po->id; })->sum('total'),$o->currency()->rounding) }}</td>
|
||||
</tr>
|
||||
@foreach ($o->product_services($po) as $so)
|
||||
<tr id="invoice-service-items" class="invoice-services d-none @if($o->products()->count() > 1) d-print-table-row @endif">
|
||||
<td colspan="2"> </td>
|
||||
<td colspan="2">Service: <strong>{{ $so->service_id }}: {{ $so->name }}</strong></td>
|
||||
<td> </td>
|
||||
<td class="text-right">${{ number_format($o->product_service_items($po,$so)->sum('total'),$o->currency()->rounding) }}</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
@foreach ($o->product_service_items($po,$so) as $io)
|
||||
<tr class="invoice-service-items d-none d-print-table-row">
|
||||
<td colspan="2"> </td>
|
||||
<td width="5%"> </td>
|
||||
<td>{{ $io->item_type_name }}</td>
|
||||
<td class="text-right">${{ number_format($io->total,$o->currency()->rounding) }}</td>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endforeach
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
<div class="row">
|
||||
<!-- accepted payments column -->
|
||||
<div class="col-6">
|
||||
<p class="lead">Payment Methods:</p>
|
||||
{{--
|
||||
<img src="../../dist/img/credit/visa.png" alt="Visa">
|
||||
<img src="../../dist/img/credit/mastercard.png" alt="Mastercard">
|
||||
<img src="../../dist/img/credit/american-express.png" alt="American Express">
|
||||
<img src="../../dist/img/credit/paypal2.png" alt="Paypal">
|
||||
--}}
|
||||
|
||||
<p class="text-muted well well-sm no-shadow" style="margin-top: 10px;">
|
||||
{!! $o->invoice_text !!}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- /.col -->
|
||||
<div class="ml-auto col-4">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th colspan="2" style="width:50%">Subtotal:</th>
|
||||
<td class="text-right">${{ number_format($o->sub_total,$o->currency()->rounding) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Tax (GST 10%)</th>
|
||||
<td class="text-right">${{ number_format($o->tax_total,$o->currency()->rounding) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Other Charges:</th>
|
||||
<td class="text-right">$0.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">Total:</th>
|
||||
<td class="text-right">${{ number_format($o->total,$o->currency()->rounding) }}</td>
|
||||
</tr>
|
||||
@if($o->id)
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Payments To Clear:</th>
|
||||
<td class="text-right">${{ number_format($o->pending_paid,$o->currency()->rounding) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Payments:</th>
|
||||
<td class="text-right">${{ number_format($o->paid,$o->currency()->rounding) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">Invoice Total Due:</th>
|
||||
<td class="text-right">${{ number_format($o->due,$o->currency()->rounding) }}</td>
|
||||
</tr>
|
||||
{{--
|
||||
<tr>
|
||||
<th colspan="2">Account Due:</th>
|
||||
<td class="text-right">${{ number_format($o->account->due,$o->currency()->rounding) }}</td>
|
||||
</tr>
|
||||
--}}
|
||||
@endif
|
||||
</table>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
<!-- this row will not appear when printing -->
|
||||
<div class="row d-print-none">
|
||||
<div class="col-12">
|
||||
<a href="javascript:window.print();" class="btn btn-default"><i class="fa fa-print"></i> Print</a>
|
||||
@if($o->id)
|
||||
<a href="{{ url('u/invoice/cart',$o->id) }}" class="btn btn-success float-right">
|
||||
<i class="fa fa-credit-card"></i> Pay
|
||||
</a>
|
||||
<a href="{{ url(sprintf('u/invoice/%s/pdf',$o->id)) }}" class="btn btn-primary float-right mr-2">
|
||||
<i class="fa fa-download"></i> Download PDF
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.content -->
|
||||
|
||||
<div class="clearfix"></div>
|
||||
@endsection
|
||||
|
||||
@section('page-scripts')
|
||||
<style>
|
||||
.stripe-odd {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
.stripe-even {
|
||||
background-color: #e9e9e9;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("table#restripe").removeClass("table-striped");
|
||||
|
||||
$("table#restripe tr:not(.d-print-table-row)").each(function (index) {
|
||||
$(this).toggleClass("stripe-odd", (index & 1));
|
||||
$(this).toggleClass("stripe-even", !!(index & 1));
|
||||
});
|
||||
|
||||
$('tr[id="invoice-services"]').click(function() {
|
||||
$(".invoice-services").toggleClass("d-none");
|
||||
});
|
||||
|
||||
$('tr[id="invoice-service-items"]').click(function() {
|
||||
$(".invoice-service-items").toggleClass("d-none");
|
||||
});
|
||||
})
|
||||
</script>
|
||||
@append
|
Reference in New Issue
Block a user