From ef44a9590253fce59ce81cb5c0d5d8825ca219eb Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 6 Nov 2016 13:44:58 +0200 Subject: [PATCH] Working on signature feature --- app/Http/Controllers/AccountGatewayController.php | 2 +- app/Http/Controllers/InvoiceController.php | 3 +-- app/Models/Invitation.php | 9 +++++++++ app/Ninja/PaymentDrivers/BasePaymentDriver.php | 2 +- resources/lang/en/texts.php | 4 +++- resources/views/accounts/client_portal.blade.php | 2 +- resources/views/invoices/edit.blade.php | 13 +++++++++++-- resources/views/invoices/view.blade.php | 6 +++--- 8 files changed, 30 insertions(+), 11 deletions(-) diff --git a/app/Http/Controllers/AccountGatewayController.php b/app/Http/Controllers/AccountGatewayController.php index e02e4e8d77..844cd21754 100644 --- a/app/Http/Controllers/AccountGatewayController.php +++ b/app/Http/Controllers/AccountGatewayController.php @@ -249,7 +249,7 @@ class AccountGatewayController extends BaseController } if (!$value && ($field == 'testMode' || $field == 'developerMode')) { // do nothing - } elseif ($gatewayId == GATEWAY_CUSTOM && $field == 'text') { + } elseif ($gatewayId == GATEWAY_CUSTOM) { $config->$field = strip_tags($value); } else { $config->$field = $value; diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 10d7f40a52..843a83777d 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -218,8 +218,7 @@ class InvoiceController extends BaseController $contact->invitation_viewed = $invitation->viewed_date && $invitation->viewed_date != '0000-00-00 00:00:00' ? $invitation->viewed_date : false; $contact->invitation_openend = $invitation->opened_date && $invitation->opened_date != '0000-00-00 00:00:00' ? $invitation->opened_date : false; $contact->invitation_status = $contact->email_error ? false : $invitation->getStatus(); - $contact->invitation_signature_svg = $invitation->signature_base64; - $contact->invitation_signature_date = $invitation->signature_date; + $contact->invitation_signature_svg = $invitation->signatureDiv(); } } } diff --git a/app/Models/Invitation.php b/app/Models/Invitation.php index a86cc72173..fd0fc7d720 100644 --- a/app/Models/Invitation.php +++ b/app/Models/Invitation.php @@ -134,4 +134,13 @@ class Invitation extends EntityModel $invoice->markViewed(); $client->markLoggedIn(); } + + public function signatureDiv() + { + if ( ! $this->signature_base64) { + return false; + } + + return sprintf('

%s: %s', $this->signature_base64, trans('texts.signed'), Utils::fromSqlDateTime($this->signature_date)); + } } diff --git a/app/Ninja/PaymentDrivers/BasePaymentDriver.php b/app/Ninja/PaymentDrivers/BasePaymentDriver.php index 3084e33802..991717bd77 100644 --- a/app/Ninja/PaymentDrivers/BasePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/BasePaymentDriver.php @@ -821,7 +821,7 @@ class BasePaymentDriver if ($gatewayTypeId == GATEWAY_TYPE_CUSTOM) { $url = "javascript:showCustomModal();"; - $label = $this->accountGateway->getConfigField('name'); + $label = e($this->accountGateway->getConfigField('name')); } else { $url = $this->paymentUrl($gatewayTypeAlias); $label = trans("texts.{$gatewayTypeAlias}"); diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 0c615e0ec6..62acecd412 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2186,8 +2186,10 @@ $LANG = array( 'require_invoice_signature_help' => 'Require client to provide their signature.', 'require_quote_signature' => 'Quote Signature', 'require_quote_signature_help' => 'Require client to provide their signature.', - 'i_agree' => 'I Agree To The Terms & Conditions', + 'i_agree' => 'I Agree To The Terms', 'sign_here' => 'Please sign here:', + 'authorization' => 'Authorization', + 'signed' => 'Signed', ); diff --git a/resources/views/accounts/client_portal.blade.php b/resources/views/accounts/client_portal.blade.php index 86d179ec96..7152680952 100644 --- a/resources/views/accounts/client_portal.blade.php +++ b/resources/views/accounts/client_portal.blade.php @@ -65,7 +65,7 @@

-

{!! trans('texts.authentication') !!}

+

{!! trans('texts.authorization') !!}

diff --git a/resources/views/invoices/edit.blade.php b/resources/views/invoices/edit.blade.php index c1ac2ec6f3..4736cef1a4 100644 --- a/resources/views/invoices/edit.blade.php +++ b/resources/views/invoices/edit.blade.php @@ -28,6 +28,13 @@ overflow-y: auto; overflow-x: hidden; } + + .signature-wrapper .tooltip-inner { + width: 600px; + max-width: 600px; + padding: 20px; + } + @stop @@ -125,8 +132,10 @@ - +   + + @endif @endif diff --git a/resources/views/invoices/view.blade.php b/resources/views/invoices/view.blade.php index 949febfbda..9ced648f25 100644 --- a/resources/views/invoices/view.blade.php +++ b/resources/views/invoices/view.blade.php @@ -116,7 +116,7 @@ @if ($showApprove) {!! Button::success(trans('texts.approve'))->asLinkTo(URL::to('/approve/' . $invitation->invitation_key))->large() !!} @endif - @elseif ($invoice->client->account->isGatewayConfigured() && !$invoice->isPaid() && !$invoice->is_recurring) + @elseif ($invoice->client->account->isGatewayConfigured() && floatval($invoice->balance) && !$invoice->is_recurring) {!! Button::normal(trans('texts.download_pdf'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}   @if (count($paymentTypes) > 1) {!! DropdownButton::success(trans('texts.pay_now'))->withContents($paymentTypes)->large() !!} @@ -319,11 +319,11 @@