Added option to show/hide signature on the PDF

This commit is contained in:
Hillel Coren 2017-12-27 20:34:36 +02:00
parent 97e4bf0e8d
commit 0fbe83eaaf
19 changed files with 2649 additions and 2408 deletions

View File

@ -180,6 +180,7 @@ class Account extends Eloquent
'task_rate', 'task_rate',
'inclusive_taxes', 'inclusive_taxes',
'convert_products', 'convert_products',
'signature_on_pdf',
]; ];
/** /**

View File

@ -992,6 +992,7 @@ class Invoice extends EntityModel implements BalanceAffecting
'date_format', 'date_format',
'datetime_format', 'datetime_format',
'timezone', 'timezone',
'signature_on_pdf',
]); ]);
foreach ($this->invitations as $invitation) { foreach ($this->invitations as $invitation) {

View File

@ -278,6 +278,7 @@ class AccountTransformer extends EntityTransformer
'task_rate' => (float) $account->task_rate, 'task_rate' => (float) $account->task_rate,
'inclusive_taxes' => (bool) $account->inclusive_taxes, 'inclusive_taxes' => (bool) $account->inclusive_taxes,
'convert_products' => (bool) $account->convert_products, 'convert_products' => (bool) $account->convert_products,
'signature_on_pdf' => (bool) $account->signature_on_pdf,
]; ];
} }
} }

View File

@ -51,6 +51,7 @@ class AddRemember2faToken extends Migration
Schema::table('accounts', function ($table) { Schema::table('accounts', function ($table) {
$table->boolean('convert_products')->default(false); $table->boolean('convert_products')->default(false);
$table->boolean('enable_reminder4')->default(false); $table->boolean('enable_reminder4')->default(false);
$table->boolean('signature_on_pdf')->default(false);
}); });
Schema::table('invoice_items', function ($table) { Schema::table('invoice_items', function ($table) {
@ -125,6 +126,7 @@ class AddRemember2faToken extends Migration
Schema::table('accounts', function ($table) { Schema::table('accounts', function ($table) {
$table->dropColumn('convert_products'); $table->dropColumn('convert_products');
$table->dropColumn('enable_reminder4'); $table->dropColumn('enable_reminder4');
$table->dropColumn('signature_on_pdf');
}); });
Schema::table('invoice_items', function ($table) { Schema::table('invoice_items', function ($table) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -366,6 +366,10 @@ NINJA.signatureImage = function(invoice) {
return blankImage; return blankImage;
} }
if (! parseInt(invoice.account.signature_on_pdf)) {
return blankImage;
}
return invoice.invitations[0].signature_base64 || blankImage; return invoice.invitations[0].signature_base64 || blankImage;
} }
@ -374,8 +378,11 @@ NINJA.signatureDate = function(invoice) {
return ''; return '';
} }
var date = invoice.invitations[0].signature_date; if (! parseInt(invoice.account.signature_on_pdf)) {
return '';
}
var date = invoice.invitations[0].signature_date;
return NINJA.formatDateTime(date, invoice.account); return NINJA.formatDateTime(date, invoice.account);
} }

View File

@ -2639,7 +2639,9 @@ $LANG = array(
'view_project' => 'View Project', 'view_project' => 'View Project',
'summary' => 'Summary', 'summary' => 'Summary',
'endless_reminder' => 'Endless Reminder', 'endless_reminder' => 'Endless Reminder',
'signature_on_invoice_help' => 'Add the following code to show your client\'s signature on the PDF.' 'signature_on_invoice_help' => 'Add the following code to show your client\'s signature on the PDF.',
'signature_on_pdf' => 'Show on PDF',
'signature_on_pdf_help' => 'Show the client signature on the invoice PDF.',
); );

View File

@ -37,6 +37,7 @@
{!! Former::populateField('show_accept_quote_terms', intval($account->show_accept_quote_terms)) !!} {!! Former::populateField('show_accept_quote_terms', intval($account->show_accept_quote_terms)) !!}
{!! Former::populateField('require_invoice_signature', intval($account->require_invoice_signature)) !!} {!! Former::populateField('require_invoice_signature', intval($account->require_invoice_signature)) !!}
{!! Former::populateField('require_quote_signature', intval($account->require_quote_signature)) !!} {!! Former::populateField('require_quote_signature', intval($account->require_quote_signature)) !!}
{!! Former::populateField('signature_on_pdf', intval($account->signature_on_pdf)) !!}
@include('accounts.nav', ['selected' => ACCOUNT_CLIENT_PORTAL, 'advanced' => true]) @include('accounts.nav', ['selected' => ACCOUNT_CLIENT_PORTAL, 'advanced' => true])
@ -195,11 +196,17 @@
->help(trans('texts.require_invoice_signature_help')) ->help(trans('texts.require_invoice_signature_help'))
->label(trans('texts.require_invoice_signature')) ->label(trans('texts.require_invoice_signature'))
->value(1) !!} ->value(1) !!}
{!! Former::checkbox('require_quote_signature') {!! Former::checkbox('require_quote_signature')
->text(trans('texts.enable')) ->text(trans('texts.enable'))
->help(trans('texts.require_quote_signature_help')) ->help(trans('texts.require_quote_signature_help'))
->label(trans('texts.require_quote_signature')) ->label(trans('texts.require_quote_signature'))
->value(1) !!} ->value(1) !!}
{!! Former::checkbox('signature_on_pdf')
->text(trans('texts.enable'))
->help(trans('texts.signature_on_pdf_help'))
->value(1) !!}
</div> </div>
</div> </div>
</div> </div>

View File

@ -95,6 +95,28 @@
} }
] ]
}, },
{
"stack": [
{
"image": "$signatureBase64",
"margin": [
200,
10,
0,
0
]
},
{
"text": "$signatureDate",
"margin": [
200,
-40,
0,
0
]
}
]
},
{ {
"stack":[ "stack":[
"$invoiceDocuments" "$invoiceDocuments"

View File

@ -115,6 +115,28 @@
} }
] ]
}, },
{
"stack": [
{
"image": "$signatureBase64",
"margin": [
200,
10,
0,
0
]
},
{
"text": "$signatureDate",
"margin": [
200,
-40,
0,
0
]
}
]
},
{ {
"stack": [ "stack": [
"$invoiceDocuments" "$invoiceDocuments"

View File

@ -113,6 +113,28 @@
} }
] ]
}, },
{
"stack": [
{
"image": "$signatureBase64",
"margin": [
200,
10,
0,
0
]
},
{
"text": "$signatureDate",
"margin": [
200,
-40,
0,
0
]
}
]
},
{ {
"stack":[ "stack":[
"$invoiceDocuments" "$invoiceDocuments"

View File

@ -90,6 +90,28 @@
"text": "$balanceDue", "text": "$balanceDue",
"style": "subtotalsBalanceDue" "style": "subtotalsBalanceDue"
}, },
{
"stack": [
{
"image": "$signatureBase64",
"margin": [
200,
10,
0,
0
]
},
{
"text": "$signatureDate",
"margin": [
200,
-40,
0,
0
]
}
]
},
{ {
"stack": [ "stack": [
"$invoiceDocuments" "$invoiceDocuments"

View File

@ -95,6 +95,28 @@
{ {
"canvas": [{ "type": "line", "x1": 270, "y1": 20, "x2": 515, "y2": 20, "lineWidth": 1,"dash": { "length": 2 }}] "canvas": [{ "type": "line", "x1": 270, "y1": 20, "x2": 515, "y2": 20, "lineWidth": 1,"dash": { "length": 2 }}]
}, },
{
"stack": [
{
"image": "$signatureBase64",
"margin": [
200,
10,
0,
0
]
},
{
"text": "$signatureDate",
"margin": [
200,
-40,
0,
0
]
}
]
},
{ {
"stack": [ "stack": [
"$invoiceDocuments" "$invoiceDocuments"

View File

@ -114,6 +114,28 @@
} }
] ]
}, },
{
"stack": [
{
"image": "$signatureBase64",
"margin": [
200,
10,
0,
0
]
},
{
"text": "$signatureDate",
"margin": [
200,
-40,
0,
0
]
}
]
},
{ {
"stack": [ "stack": [
"$invoiceDocuments" "$invoiceDocuments"

View File

@ -86,6 +86,28 @@
} }
] ]
}, },
{
"stack": [
{
"image": "$signatureBase64",
"margin": [
200,
10,
0,
0
]
},
{
"text": "$signatureDate",
"margin": [
200,
-40,
0,
0
]
}
]
},
{ {
"stack": [ "stack": [
"$invoiceDocuments" "$invoiceDocuments"

View File

@ -102,6 +102,28 @@
} }
}] }]
}, },
{
"stack": [
{
"image": "$signatureBase64",
"margin": [
200,
10,
0,
0
]
},
{
"text": "$signatureDate",
"margin": [
200,
-40,
0,
0
]
}
]
},
{ {
"stack": [ "stack": [
"$invoiceDocuments" "$invoiceDocuments"

View File

@ -78,6 +78,28 @@
} }
] ]
}, },
{
"stack": [
{
"image": "$signatureBase64",
"margin": [
200,
10,
0,
0
]
},
{
"text": "$signatureDate",
"margin": [
200,
-40,
0,
0
]
}
]
},
{ {
"stack": [ "stack": [
"$invoiceDocuments" "$invoiceDocuments"

View File

@ -121,13 +121,35 @@
} }
] ]
}, },
{
"stack": [
{
"image": "$signatureBase64",
"margin": [
200,
10,
0,
0
]
},
{
"text": "$signatureDate",
"margin": [
200,
-40,
0,
0
]
}
]
},
{ {
"stack": [ "stack": [
"$invoiceDocuments" "$invoiceDocuments"
], ],
"style": "invoiceDocuments" "style": "invoiceDocuments"
} }
], ],
"footer": [ "footer": [
{"canvas": [{ "type": "line", "x1": 0, "y1": 38, "x2": 68, "y2": 38, "lineWidth": 6,"lineColor":"#009d91"}]}, {"canvas": [{ "type": "line", "x1": 0, "y1": 38, "x2": 68, "y2": 38, "lineWidth": 6,"lineColor":"#009d91"}]},
{"canvas": [{ "type": "line", "x1": 68, "y1": 0, "x2": 135, "y2": 0, "lineWidth": 6,"lineColor":"#1d766f"}]}, {"canvas": [{ "type": "line", "x1": 68, "y1": 0, "x2": 135, "y2": 0, "lineWidth": 6,"lineColor":"#1d766f"}]},