Rework payment tables, enable payment editing
This commit is contained in:
@@ -32,14 +32,14 @@
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="form-group has-validation">
|
||||
<label for="date_payment">Date Received</label>
|
||||
<label for="payment_date">Date Received</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control @error('date_payment') is-invalid @enderror" id="date_payment" name="date_payment" value="{{ old('date_payment',$o->exists ? $o->date_payment : \Carbon\Carbon::now()->format('Y-m-d')) }}" required>
|
||||
<input type="date" class="form-control @error('payment_date') is-invalid @enderror" id="payment_date" name="payment_date" value="{{ old('payment_date',($o->exists ? $o->payment_date : \Carbon\Carbon::now())->format('Y-m-d')) }}" required>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('date_payment')
|
||||
@error('payment_date')
|
||||
{{ $message }}
|
||||
@else
|
||||
Payment Date is required.
|
||||
@@ -50,14 +50,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="offset-1 col-4">
|
||||
<div class="offset-4 col-4">
|
||||
<div class="form-group has-validation">
|
||||
<label for="total_amt">Amount</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-dollar-sign"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control @error('total_amt') is-invalid @enderror" id="total_amt" name="total_amt" value="{{ old('total_amt',$o->exists ? $o->total_amt : 0) }}" required>
|
||||
<input type="text" class="text-right form-control @error('total_amt') is-invalid @enderror" id="total_amt" name="total_amt" value="{{ old('total_amt',$o->exists ? $o->total_amt : 0) }}" required>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('total_amt')
|
||||
{{ $message }}
|
||||
@@ -97,19 +97,19 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="offset-1 col-4">
|
||||
<div class="offset-4 col-4">
|
||||
<div class="form-group has-validation">
|
||||
<label for="fees_amt">Fee</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-dollar-sign"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control @error('fees_amt') is-invalid @enderror" id="fees_amt" name="fees_amt" value="{{ old('fees_amt',$o->exists ? $o->fees_amt : 0) }}" required>
|
||||
<input type="text" class="text-right form-control @error('fees_amt') is-invalid @enderror" id="fees_amt" name="fees_amt" value="{{ old('fees_amt',$o->exists ? $o->fees_amt : 0) }}" required>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('fees_amt')
|
||||
{{ $message }}
|
||||
@else
|
||||
Payment Amount is required.
|
||||
Total Fees is required.
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
@@ -136,20 +136,30 @@
|
||||
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('account_id')
|
||||
{{ $message }}
|
||||
{{ $message }}
|
||||
@else
|
||||
Account is required.
|
||||
@enderror
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
<span class="input-helper">Account to add payment to.</span>
|
||||
<i class="fas fa-spinner d-none"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="offset-2 col-4">
|
||||
<label for="fees_amt">Balance</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-dollar-sign"></i></span>
|
||||
</div>
|
||||
<input type="text" class="text-right form-control @error('fees_amt') is-invalid @enderror" value="{{ $o->exists ? $o->balance : 0 }}" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-6">
|
||||
<div class="row mt-3 mb-3">
|
||||
<div class="col-12">
|
||||
<div id="invoices"></div>
|
||||
@error('invoices')
|
||||
<span class="invalid-feedback d-block mt-2 mb-2" role="alert">
|
||||
@@ -193,6 +203,7 @@
|
||||
dataType: 'html',
|
||||
cache: false,
|
||||
url: '{{ url('api/r/invoices') }}'+'/'+account,
|
||||
data: {pid:{{ $o->id }}},
|
||||
timeout: 2000,
|
||||
error: function(x) {
|
||||
spinner.toggleClass('d-none').toggleClass('fa-spin');
|
@@ -0,0 +1,72 @@
|
||||
@extends('adminlte::layouts.app')
|
||||
|
||||
@section('htmlheader_title')
|
||||
Unapplied Payments
|
||||
@endsection
|
||||
@section('page_title')
|
||||
Unapplied
|
||||
@endsection
|
||||
|
||||
@section('contentheader_title')
|
||||
Unapplied Payments
|
||||
@endsection
|
||||
@section('contentheader_description')
|
||||
@endsection
|
||||
|
||||
@section('main-content')
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<table class="table table-striped table-hover" id="unapplied_payments">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Date Paid</th>
|
||||
<th>Account</th>
|
||||
<th>Method</th>
|
||||
<th class="text-right">Total</th>
|
||||
<th class="text-right">Balance</th>
|
||||
<th>Invoices</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach(\App\Models\Payment::unapplied()->with(['account.user','checkout','items'])->get() as $o)
|
||||
@if (! $o->balance) @continue @endif
|
||||
<tr>
|
||||
<td><a href="{{ url('a/payment/addedit',$o->id) }}">{{ $o->id }}</td>
|
||||
<td>{{ $o->payment_date->format('Y-m-d') }}</td>
|
||||
<td>{{ $o->account->name }}</td>
|
||||
<td>{{ $o->checkout->name }}</td>
|
||||
<td class="text-right">{{ number_format($o->total_amt,2) }}</td>
|
||||
<td class="text-right">{{ number_format($o->balance,2) }}</td>
|
||||
<td>{!! $o->items->pluck('invoice_id')->map(function($item) { return sprintf('<a href="%s">%d</a>',url('u/invoice',$item),$item); })->join(', ') !!}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('page-scripts')
|
||||
@css('//cdn.datatables.net/1.10.25/css/dataTables.bootstrap4.min.css','jq-dt-css')
|
||||
@js('//cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js','jq-dt-js')
|
||||
@js('//cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js','jq-dt-bs5-js','jq-dt-js')
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#unapplied_payments').DataTable( {
|
||||
order: [1,'desc'],
|
||||
orderFixed: [1,'desc']
|
||||
});
|
||||
|
||||
$('#unapplied_payments tbody').on('click','tr', function () {
|
||||
$(this).toggleClass('selected');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@append
|
@@ -1,6 +1,11 @@
|
||||
<div class="form-group mb-0">
|
||||
<label for="checkout_id">Invoices Due</label>
|
||||
@if(($x=$o->invoices()->where('active',TRUE)->orderBy('due_date')->with(['items.taxes','paymentitems.payment','account'])->get()->where('due','>',0))->count())
|
||||
@if(($x=$o->invoices()
|
||||
->where('active',TRUE)
|
||||
->orderBy('due_date')
|
||||
->with(['items.taxes','paymentitems.payment','account'])
|
||||
->get()
|
||||
->filter(function($item) use ($pid) { return $item->due > 0 || $item->payments->search(function($item) use ($pid) { return $item->id == $pid; }) !== FALSE; }))->count())
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -9,7 +14,7 @@
|
||||
<th>Date Due</th>
|
||||
<th>Total</th>
|
||||
<th>Due</th>
|
||||
<th>Apply</th>
|
||||
<th class="text-right">Apply</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -21,7 +26,9 @@
|
||||
<td>{{ $io->due_date->format('Y-m-d') }}</td>
|
||||
<td>{{ number_format($io->total,2) }}</td>
|
||||
<td>{{ number_format($io->due,2) }}</td>
|
||||
<td><input type="text" name="invoices[{{ $io->id }}]"></td>
|
||||
<td class="text-right">
|
||||
<input type="text" class="text-right" name="invoices[{{ $io->id }}]" value="{{ ($x=$io->paymentitems->filter(function($item) use ($pid) { return $item->payment_id == $pid; })) ? $x->sum('alloc_amt') : 0}}">
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
Reference in New Issue
Block a user