Merge pull request #6270 from beganovich/v5-570-571

(v5) Quotes improvements
This commit is contained in:
Benjamin Beganović 2021-07-14 14:36:00 +02:00 committed by GitHub
commit 04e17c7349
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 3 deletions

View File

@ -1,6 +1,12 @@
# Release notes # Release notes
## [Unreleased (daily channel)](https://github.com/invoiceninja/invoiceninja/tree/v5-develop) ## [Unreleased (daily channel)](https://github.com/invoiceninja/invoiceninja/tree/v5-develop)
## Added:
- Client portal: Show message when trying to approve non-approvable quotes
- Client portal: Remove "Approve" button from single quote page if quote is non-approvable
## Fixed:
- Client portal: Showing message instead of blank page when trying to download zero quotes.
## [v5.2.0-release](https://github.com/invoiceninja/invoiceninja/releases/tag/v5.2.0-release) ## [v5.2.0-release](https://github.com/invoiceninja/invoiceninja/releases/tag/v5.2.0-release)
## Added: ## Added:

View File

@ -85,7 +85,9 @@ class QuoteController extends Controller
->get(); ->get();
if (! $quotes || $quotes->count() == 0) { if (! $quotes || $quotes->count() == 0) {
return; return redirect()
->route('client.quotes.index')
->with('message', ctrans('texts.no_quotes_available_for_download'));
} }
if ($quotes->count() == 1) { if ($quotes->count() == 1) {
@ -121,7 +123,9 @@ class QuoteController extends Controller
->get(); ->get();
if (!$quotes || $quotes->count() == 0) { if (!$quotes || $quotes->count() == 0) {
return redirect()->route('client.quotes.index'); return redirect()
->route('client.quotes.index')
->with('message', ctrans('texts.quotes_with_status_sent_can_be_approved'));
} }
if ($process) { if ($process) {

View File

@ -4278,6 +4278,8 @@ $LANG = array(
'one_time_purchases' => 'One time purchases', 'one_time_purchases' => 'One time purchases',
'recurring_purchases' => 'Recurring purchases', 'recurring_purchases' => 'Recurring purchases',
'you_might_be_interested_in_following' => 'You might be interested in following', 'you_might_be_interested_in_following' => 'You might be interested in following',
'quotes_with_status_sent_can_be_approved' => 'Only quotes with "Sent" status can be approved.',
'no_quotes_available_for_download' => 'No quotes available for download.',
); );
return $LANG; return $LANG;

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,7 +89,18 @@ 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');
}); });
} }
public function testNoQuotesAvailableForDownloadMessage()
{
$this->browse(function (Browser $browser) {
$browser
->visitRoute('client.quotes.index')
->press('Download')
->assertSee('No quotes available for download.');
});
}
} }