1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00

Show 'Only quotes with "Sent" status can be approved.' for non-approvable quotes

This commit is contained in:
Benjamin Beganović 2021-07-14 14:30:24 +02:00
parent a9ac73264e
commit 7f7120af6b
2 changed files with 15 additions and 1 deletions

View File

@ -19,10 +19,12 @@
@endcomponent @endcomponent
@endif @endif
@if(!$quote->isApproved()) @if($quote->status_id === \App\Models\Quote::STATUS_SENT)
<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>
@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])

View File

@ -70,6 +70,17 @@ class QuotesTest extends DuskTestCase
} }
public function testQuotesWithSentStatusCanOnlyBeApproved() public function testQuotesWithSentStatusCanOnlyBeApproved()
{
$this->browse(function (Browser $browser) {
$browser
->visitRoute('client.quotes.index')
->clickLink('View')
->assertSee('Only quotes with "Sent" status can be approved.')
->visitRoute('client.logout');
});
}
public function testMessageForNonApprovableQuotesIsVisible()
{ {
$this->browse(function (Browser $browser) { $this->browse(function (Browser $browser) {
$browser $browser
@ -78,6 +89,7 @@ class QuotesTest extends DuskTestCase
->press('Approve') ->press('Approve')
->assertPathIs('/client/quotes') ->assertPathIs('/client/quotes')
->assertDontSee('Quote(s) approved successfully.') ->assertDontSee('Quote(s) approved successfully.')
->assertSee('Only quotes with "Sent" status can be approved.')
->visitRoute('client.logout'); ->visitRoute('client.logout');
}); });
} }