From 7f7120af6bee36dd934637a356c912aec7d87ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Wed, 14 Jul 2021 14:30:24 +0200 Subject: [PATCH] Show 'Only quotes with "Sent" status can be approved.' for non-approvable quotes --- .../views/portal/ninja2020/quotes/show.blade.php | 4 +++- tests/Browser/ClientPortal/QuotesTest.php | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/resources/views/portal/ninja2020/quotes/show.blade.php b/resources/views/portal/ninja2020/quotes/show.blade.php index 380242d429f5..46ddef487cad 100644 --- a/resources/views/portal/ninja2020/quotes/show.blade.php +++ b/resources/views/portal/ninja2020/quotes/show.blade.php @@ -19,10 +19,12 @@ @endcomponent @endif - @if(!$quote->isApproved()) + @if($quote->status_id === \App\Models\Quote::STATUS_SENT)
@include('portal.ninja2020.quotes.includes.actions', ['quote' => $quote])
+ @else +

{{ ctrans('texts.quotes_with_status_sent_can_be_approved') }}

@endif @include('portal.ninja2020.components.entity-documents', ['entity' => $quote]) diff --git a/tests/Browser/ClientPortal/QuotesTest.php b/tests/Browser/ClientPortal/QuotesTest.php index 2a294eca2ed2..189352be5f8d 100644 --- a/tests/Browser/ClientPortal/QuotesTest.php +++ b/tests/Browser/ClientPortal/QuotesTest.php @@ -70,6 +70,17 @@ class QuotesTest extends DuskTestCase } 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) { $browser @@ -78,6 +89,7 @@ class QuotesTest extends DuskTestCase ->press('Approve') ->assertPathIs('/client/quotes') ->assertDontSee('Quote(s) approved successfully.') + ->assertSee('Only quotes with "Sent" status can be approved.') ->visitRoute('client.logout'); }); }