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,31 +214,34 @@ class MatchBankTransactions implements ShouldQueue
$this->invoice = Invoice::withTrashed()->where('id', $invoice->id)->lockForUpdate()->first();
// if($invoices->count() == 1){
// $_amount = $this->available_balance;
// }
if(floatval($this->invoice->balance) < floatval($this->available_balance) && $this->available_balance > 0)
{
$_amount = $this->invoice->balance;
$this->applied_amount += $this->invoice->balance;
$this->available_balance = $this->available_balance - $this->invoice->balance;
}
elseif(floatval($this->invoice->balance) >= floatval($this->available_balance) && $this->available_balance > 0)
{
$_amount = $this->available_balance;
$this->applied_amount += $this->available_balance;
$this->available_balance = 0;
}
$_amount = false;
$this->attachable_invoices[] = ['id' => $this->invoice->id, 'amount' => $_amount];
if(floatval($this->invoice->balance) < floatval($this->available_balance) && $this->available_balance > 0)
{
$_amount = $this->invoice->balance;
$this->applied_amount += $this->invoice->balance;
$this->available_balance = $this->available_balance - $this->invoice->balance;
}
elseif(floatval($this->invoice->balance) >= floatval($this->available_balance) && $this->available_balance > 0)
{
$_amount = $this->available_balance;
$this->applied_amount += $this->available_balance;
$this->available_balance = 0;
}
$this->invoice
->service()
->setExchangeRate()
->updateBalance($_amount * -1)
->updatePaidToDate($_amount)
->setCalculatedStatus()
->save();
if($_amount)
{
$this->attachable_invoices[] = ['id' => $this->invoice->id, 'amount' => $_amount];
$this->invoice
->service()
->setExchangeRate()
->updateBalance($_amount * -1)
->updatePaidToDate($_amount)
->setCalculatedStatus()
->save();
}
});

View File

@ -7,10 +7,10 @@
@foreach ($entity->documents as $document)
<div class="inline-flex items-center space-x-1">
@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>
@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>
@endif
<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)
<div class="inline-flex items-center space-x-1">
@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>
@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>
@endif
<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($expense->documents as $document)
<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>
<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($task->documents as $document)
<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>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"