mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 12:42:36 +01:00
Proposals
This commit is contained in:
parent
db6cc52faa
commit
a136c3c325
@ -81,6 +81,19 @@ class ClientPortalController extends BaseController
|
||||
return view('invited.proposal', $data);
|
||||
}
|
||||
|
||||
public function downloadProposal($invitationKey)
|
||||
{
|
||||
if (! $invitation = $this->propoosalRepo->findInvitationByKey($invitationKey)) {
|
||||
return $this->returnError(trans('texts.proposal_not_found'));
|
||||
}
|
||||
|
||||
$proposal = $invitation->proposal;
|
||||
|
||||
$mpdf = new \mPDF();
|
||||
$mpdf->WriteHTML($proposal->present()->htmlDocument);
|
||||
$mpdf->Output($proposal->present()->filename, 'D');
|
||||
}
|
||||
|
||||
public function viewInvoice($invitationKey)
|
||||
{
|
||||
if (! $invitation = $this->invoiceRepo->findInvoiceByInvitation($invitationKey)) {
|
||||
|
@ -15,6 +15,7 @@ use Auth;
|
||||
use Input;
|
||||
use Session;
|
||||
use View;
|
||||
use mPDF;
|
||||
|
||||
class ProposalController extends BaseController
|
||||
{
|
||||
@ -139,6 +140,8 @@ class ProposalController extends BaseController
|
||||
{
|
||||
$proposal = $request->entity();
|
||||
|
||||
|
||||
$mpdf = new mPDF();
|
||||
$mpdf->WriteHTML($proposal->present()->htmlDocument);
|
||||
$mpdf->Output($proposal->present()->filename, 'D');
|
||||
}
|
||||
}
|
||||
|
@ -30,4 +30,17 @@ class ProposalPresenter extends EntityPresenter
|
||||
return $actions;
|
||||
}
|
||||
|
||||
public function htmlDocument()
|
||||
{
|
||||
$proposal = $this->entity;
|
||||
|
||||
return "<html><head><style>{$proposal->css}</style><head><body>{$proposal->html}</body></html>";
|
||||
}
|
||||
|
||||
public function filename()
|
||||
{
|
||||
$proposal = $this->entity;
|
||||
|
||||
return sprintf('%s_%s.pdf', trans('texts.proposal'), $proposal->invoice->invoice_number);
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ Route::post('/get_started', 'AccountController@getStarted');
|
||||
// Client visible pages
|
||||
Route::group(['middleware' => ['lookup:contact', 'auth:client']], function () {
|
||||
Route::get('view/{invitation_key}', 'ClientPortalController@viewInvoice');
|
||||
Route::get('proposal/{proposal_invitation_key}/download', 'ClientPortalController@downloadProposal');
|
||||
Route::get('proposal/{proposal_invitation_key}', 'ClientPortalController@viewProposal');
|
||||
Route::get('download/{invitation_key}', 'ClientPortalController@download');
|
||||
Route::put('sign/{invitation_key}', 'ClientPortalController@sign');
|
||||
|
Loading…
Reference in New Issue
Block a user