114 lines
3.1 KiB
PHP
114 lines
3.1 KiB
PHP
@extends('adminlte::layouts.app')
|
|
|
|
@section('htmlheader_title')
|
|
Payment Cart
|
|
@endsection
|
|
@section('page_title')
|
|
Payments
|
|
@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 |