Allow draft quotes to be approved if accessed directly

This commit is contained in:
David Bomba 2022-02-08 21:18:41 +11:00
parent 8fbab48019
commit f6686c7df5
3 changed files with 3 additions and 5 deletions

View File

@ -160,7 +160,7 @@ class QuoteController extends Controller
$quotes = Quote::whereIn('id', $ids) $quotes = Quote::whereIn('id', $ids)
->where('client_id', auth('contact')->user()->client->id) ->where('client_id', auth('contact')->user()->client->id)
->where('company_id', auth('contact')->user()->client->company_id) ->where('company_id', auth('contact')->user()->client->company_id)
->where('status_id', Quote::STATUS_SENT) ->whereIn('status_id', [Quote::STATUS_DRAFT, Quote::STATUS_SENT])
->withTrashed() ->withTrashed()
->get(); ->get();

View File

@ -79,7 +79,7 @@ class InvoiceService
public function setExchangeRate() public function setExchangeRate()
{ {
if($this->invoice->exchange_rate != 0) if($this->invoice->exchange_rate != 1)
return $this; return $this;
$client_currency = $this->invoice->client->getSetting('currency_id'); $client_currency = $this->invoice->client->getSetting('currency_id');

View File

@ -21,14 +21,12 @@
@endcomponent @endcomponent
@endif @endif
@if($quote->status_id === \App\Models\Quote::STATUS_SENT) @if(in_array($quote->status_id, [\App\Models\Quote::STATUS_SENT, \App\Models\Quote::STATUS_DRAFT]))
<div class="mb-4"> <div class="mb-4">
@include('portal.ninja2020.quotes.includes.actions', ['quote' => $quote]) @include('portal.ninja2020.quotes.includes.actions', ['quote' => $quote])
</div> </div>
@elseif($quote->status_id === \App\Models\Quote::STATUS_APPROVED) @elseif($quote->status_id === \App\Models\Quote::STATUS_APPROVED)
<p class="text-right text-gray-900 text-sm mb-4">{{ ctrans('texts.approved') }}</p> <p class="text-right text-gray-900 text-sm mb-4">{{ ctrans('texts.approved') }}</p>
@else
<p class="text-right text-gray-900 text-sm mb-4">{{ ctrans('texts.quotes_with_status_sent_can_be_approved') }}</p>
@endif @endif
@include('portal.ninja2020.components.entity-documents', ['entity' => $quote]) @include('portal.ninja2020.components.entity-documents', ['entity' => $quote])