Change UX for downloading documents from the client portal

This commit is contained in:
David Bomba 2022-11-14 07:30:16 +11:00
parent 84a985ec0e
commit 4830154ac6
2 changed files with 32 additions and 29 deletions

View File

@ -214,9 +214,8 @@ class MatchBankTransactions implements ShouldQueue
$this->invoice = Invoice::withTrashed()->where('id', $invoice->id)->lockForUpdate()->first(); $this->invoice = Invoice::withTrashed()->where('id', $invoice->id)->lockForUpdate()->first();
// if($invoices->count() == 1){ $_amount = false;
// $_amount = $this->available_balance;
// }
if(floatval($this->invoice->balance) < floatval($this->available_balance) && $this->available_balance > 0) if(floatval($this->invoice->balance) < floatval($this->available_balance) && $this->available_balance > 0)
{ {
$_amount = $this->invoice->balance; $_amount = $this->invoice->balance;
@ -230,6 +229,9 @@ class MatchBankTransactions implements ShouldQueue
$this->available_balance = 0; $this->available_balance = 0;
} }
if($_amount)
{
$this->attachable_invoices[] = ['id' => $this->invoice->id, 'amount' => $_amount]; $this->attachable_invoices[] = ['id' => $this->invoice->id, 'amount' => $_amount];
$this->invoice $this->invoice
@ -239,6 +241,7 @@ class MatchBankTransactions implements ShouldQueue
->updatePaidToDate($_amount) ->updatePaidToDate($_amount)
->setCalculatedStatus() ->setCalculatedStatus()
->save(); ->save();
}
}); });

View File

@ -7,10 +7,10 @@
@foreach ($entity->documents as $document) @foreach ($entity->documents as $document)
<div class="inline-flex items-center space-x-1"> <div class="inline-flex items-center space-x-1">
@if($entity instanceof App\Models\PurchaseOrder) @if($entity instanceof App\Models\PurchaseOrder)
<a href="{{ route('vendor.documents.show', $document->hashed_id) }}" target="_blank" <a href="{{ route('vendor.documents.download', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a> class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
@else @else
<a href="{{ route('client.documents.show', $document->hashed_id) }}" target="_blank" <a href="{{ route('client.documents.download', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a> class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
@endif @endif
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
@ -30,10 +30,10 @@
@foreach ($entity->company->documents as $document) @foreach ($entity->company->documents as $document)
<div class="inline-flex items-center space-x-1"> <div class="inline-flex items-center space-x-1">
@if($entity instanceof App\Models\PurchaseOrder) @if($entity instanceof App\Models\PurchaseOrder)
<a href="{{ route('vendor.documents.show', $document->hashed_id) }}" target="_blank" <a href="{{ route('vendor.documents.download', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a> class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
@else @else
<a href="{{ route('client.documents.show', $document->hashed_id) }}" target="_blank" <a href="{{ route('client.documents.download', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a> class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
@endif @endif
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
@ -54,7 +54,7 @@
@foreach ($entity->expense_documents() as $expense) @foreach ($entity->expense_documents() as $expense)
@foreach($expense->documents as $document) @foreach($expense->documents as $document)
<div class="inline-flex items-center space-x-1"> <div class="inline-flex items-center space-x-1">
<a href="{{ route('client.documents.show', $document->hashed_id) }}" target="_blank" <a href="{{ route('client.documents.download', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a> class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
@ -77,7 +77,7 @@
@foreach ($entity->task_documents() as $task) @foreach ($entity->task_documents() as $task)
@foreach($task->documents as $document) @foreach($task->documents as $document)
<div class="inline-flex items-center space-x-1"> <div class="inline-flex items-center space-x-1">
<a href="{{ route('client.documents.show', $document->hashed_id) }}" target="_blank" <a href="{{ route('client.documents.download', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a> class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"