mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Add unsubscribe landing page for emails
This commit is contained in:
parent
d26082912d
commit
d038877044
@ -19,8 +19,10 @@ use App\Http\Controllers\Controller;
|
||||
use App\Jobs\Entity\CreateRawPdf;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\CreditInvitation;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use App\Models\Payment;
|
||||
use App\Models\QuoteInvitation;
|
||||
use App\Services\ClientPortal\InstantPayment;
|
||||
use App\Utils\CurlUtils;
|
||||
use App\Utils\Ninja;
|
||||
@ -265,4 +267,24 @@ class InvitationController extends Controller
|
||||
|
||||
abort(404, "Invoice not found");
|
||||
}
|
||||
|
||||
public function unsubscribe(Request $request, string $invitation_key)
|
||||
{
|
||||
if($invite = InvoiceInvitation::where('key', $invitation_key)->first()){
|
||||
$invite->contact->send_email = false;
|
||||
$invite->contact->save();
|
||||
}elseif($invite = QuoteInvitation::where('key', $invitation_key)->first()){
|
||||
$invite->contact->send_email = false;
|
||||
$invite->contact->save();
|
||||
}elseif($invite = CreditInvitation::where('key', $invitation_key)->first()){
|
||||
$invite->contact->send_email = false;
|
||||
$invite->contact->save();
|
||||
}
|
||||
|
||||
$data['logo'] = auth()->user()->company()->present()->logo();
|
||||
|
||||
return $this->render('generic.unsubscribe', $data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4545,6 +4545,8 @@ $LANG = array(
|
||||
'activity_124' => ':user restored recurring expense :recurring_expense',
|
||||
'fpx' => "FPX",
|
||||
'to_view_entity_set_password' => 'To view the :entity you need to set password.',
|
||||
'unsubscribed' => 'Unsubscribed',
|
||||
'Unsubscribed_text' => 'You have been removed from notifications for this document'
|
||||
);
|
||||
|
||||
return $LANG;
|
||||
|
@ -0,0 +1,20 @@
|
||||
@extends('portal.ninja2020.layout.clean')
|
||||
@section('meta_title', ctrans('texts.unsubscribed'))
|
||||
|
||||
@section('body')
|
||||
|
||||
<div class="flex h-screen">
|
||||
<div class="m-auto md:w-1/3 lg:w-1/5">
|
||||
<div class="flex flex-col items-center">
|
||||
<img src="{{ $logo }}" class="border-b border-gray-100 h-18 pb-4" alt="Invoice Ninja logo">
|
||||
<h1 class="text-center text-3xl mt-10">{{ ctrans('texts.unsubscribed') }}</h1>
|
||||
<p class="text-center opacity-75">{{ ctrans('texts.unsubscribed_text') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@stop
|
||||
|
||||
@push('footer')
|
||||
|
||||
@endpush
|
@ -113,6 +113,9 @@ Route::group(['middleware' => ['invite_db'], 'prefix' => 'client', 'as' => 'clie
|
||||
Route::get('credit/{invitation_key}/download_pdf', 'CreditController@downloadPdf')->name('credit.download_invitation_key');
|
||||
Route::get('{entity}/{invitation_key}/download', 'ClientPortal\InvitationController@routerForDownload');
|
||||
Route::get('pay/{invitation_key}', 'ClientPortal\InvitationController@payInvoice')->name('pay.invoice');
|
||||
|
||||
Route::get('unsubscribe/{invitation_key}', 'ClientPortal\InvitationController@unsubscribe')->name('unsubscribe');
|
||||
|
||||
// Route::get('{entity}/{client_hash}/{invitation_key}', 'ClientPortal\InvitationController@routerForIframe')->name('invoice.client_hash_and_invitation_key'); //should never need this
|
||||
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user