mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Improve invoice design help documentation
This commit is contained in:
parent
c2c2b1ef07
commit
b5fc9669df
@ -627,21 +627,6 @@ class AccountController extends BaseController
|
|||||||
} else {
|
} else {
|
||||||
$data['customDesign'] = $design;
|
$data['customDesign'] = $design;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sample invoice to help determine variables
|
|
||||||
$invoice = Invoice::scope()
|
|
||||||
->invoiceType(INVOICE_TYPE_STANDARD)
|
|
||||||
->with('client', 'account')
|
|
||||||
->where('is_recurring', '=', false)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
if ($invoice) {
|
|
||||||
$invoice->hidePrivateFields();
|
|
||||||
unset($invoice->account);
|
|
||||||
unset($invoice->invoice_items);
|
|
||||||
unset($invoice->client->contacts);
|
|
||||||
$data['sampleInvoice'] = $invoice;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return View::make("accounts.{$section}", $data);
|
return View::make("accounts.{$section}", $data);
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -347,14 +347,24 @@ NINJA.decodeJavascript = function(invoice, javascript)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
field = match.replace('$invoice.', '$');
|
||||||
|
|
||||||
// legacy style had 'Value' at the end
|
// legacy style had 'Value' at the end
|
||||||
if (endsWith(match, 'Value"')) {
|
if (endsWith(field, 'Value"')) {
|
||||||
field = match.substring(2, match.indexOf('Value'));
|
field = field.substring(2, field.indexOf('Value'));
|
||||||
} else {
|
} else {
|
||||||
field = match.substring(2, match.length - 1);
|
field = field.substring(2, field.length - 1);
|
||||||
}
|
}
|
||||||
field = toSnakeCase(field);
|
field = toSnakeCase(field);
|
||||||
|
|
||||||
|
if (field == 'footer') {
|
||||||
|
field = 'invoice_footer';
|
||||||
|
} else if (match == '$account.phone') {
|
||||||
|
field = 'account.work_phone';
|
||||||
|
} else if (match == '$client.phone') {
|
||||||
|
field = 'client.phone';
|
||||||
|
}
|
||||||
|
|
||||||
var value = getDescendantProp(invoice, field) || ' ';
|
var value = getDescendantProp(invoice, field) || ' ';
|
||||||
value = doubleDollarSign(value) + '';
|
value = doubleDollarSign(value) + '';
|
||||||
value = value.replace(/\n/g, "\\n").replace(/\r/g, "\\r");
|
value = value.replace(/\n/g, "\\n").replace(/\r/g, "\\r");
|
||||||
|
@ -656,7 +656,6 @@ $LANG = array(
|
|||||||
'primary_user' => 'Primary User',
|
'primary_user' => 'Primary User',
|
||||||
'help' => 'Help',
|
'help' => 'Help',
|
||||||
'customize_help' => '<p>We use <a href="http://pdfmake.org/" target="_blank">pdfmake</a> to define the invoice designs declaratively. The pdfmake <a href="http://pdfmake.org/playground.html" target="_blank">playground</a> provides a great way to see the library in action.</p>
|
'customize_help' => '<p>We use <a href="http://pdfmake.org/" target="_blank">pdfmake</a> to define the invoice designs declaratively. The pdfmake <a href="http://pdfmake.org/playground.html" target="_blank">playground</a> provides a great way to see the library in action.</p>
|
||||||
<p>You can access a child property using dot notation. For example to show the client name you could use <code>$client.name</code>.</p>
|
|
||||||
<p>If you need help figuring something out post a question to our <a href="https://www.invoiceninja.com/forums/forum/support/" target="_blank">support forum</a> with the design you\'re using.</p>',
|
<p>If you need help figuring something out post a question to our <a href="https://www.invoiceninja.com/forums/forum/support/" target="_blank">support forum</a> with the design you\'re using.</p>',
|
||||||
'invoice_due_date' => 'Due Date',
|
'invoice_due_date' => 'Due Date',
|
||||||
'quote_due_date' => 'Valid Until',
|
'quote_due_date' => 'Valid Until',
|
||||||
|
@ -162,11 +162,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
refreshPDF(true);
|
refreshPDF(true);
|
||||||
|
|
||||||
@if (isset($sampleInvoice) && $sampleInvoice)
|
|
||||||
var sample = {!! $sampleInvoice->toJSON() !!}
|
|
||||||
$('#sampleData').show().html(prettyJson(sample));
|
|
||||||
@endif
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -234,10 +229,8 @@
|
|||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{!! trans('texts.customize_help') !!}<br/>
|
{!! trans('texts.customize_help') !!}<br/>
|
||||||
<pre id="sampleData" style="display:none;height:200px;padding-top:16px;"></pre>
|
|
||||||
@if (empty($sampleInvoice))
|
@include('partials/variables_help', ['entityType' => ENTITY_INVOICE, 'account' => $account])
|
||||||
<div class="help-block">{{ trans('texts.create_invoice_for_sample') }}</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if ($account->require_invoice_signature || $account->require_invoice_signature)
|
@if ($account->require_invoice_signature || $account->require_invoice_signature)
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
85
resources/views/partials/variables_help.blade.php
Normal file
85
resources/views/partials/variables_help.blade.php
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<div class="col-md-6">
|
||||||
|
<ul>
|
||||||
|
@if ($entityType === ENTITY_QUOTE)
|
||||||
|
<li>$quote.quoteNumber</li>
|
||||||
|
<li>$quote.quoteDate</li>
|
||||||
|
<li>$quote.validUntil</li>
|
||||||
|
@elseif ($entityType === ENTITY_INVOICE)
|
||||||
|
<li>$invoice.invoiceNumber</li>
|
||||||
|
<li>$invoice.invoiceDate</li>
|
||||||
|
<li>$invoice.dueDate</li>
|
||||||
|
@endif
|
||||||
|
<li>${{ $entityType }}.discount</li>
|
||||||
|
<li>${{ $entityType }}.poNumber</li>
|
||||||
|
<li>${{ $entityType }}.publicNotes</li>
|
||||||
|
<li>${{ $entityType }}.amount</li>
|
||||||
|
<li>${{ $entityType }}.terms</li>
|
||||||
|
<li>${{ $entityType }}.footer</li>
|
||||||
|
<li>${{ $entityType }}.partial</li>
|
||||||
|
<li>${{ $entityType }}.partialDueDate</li>
|
||||||
|
@if ($account->custom_invoice_label1)
|
||||||
|
<li>${{ $entityType }}.customValue1</li>
|
||||||
|
@endif
|
||||||
|
@if ($account->custom_invoice_label2)
|
||||||
|
<li>${{ $entityType }}.customValue2</li>
|
||||||
|
@endif
|
||||||
|
@if ($account->custom_invoice_text_label1)
|
||||||
|
<li>${{ $entityType }}.customTextValue1</li>
|
||||||
|
@endif
|
||||||
|
@if ($account->custom_invoice_text_label2)
|
||||||
|
<li>${{ $entityType }}.customTextValue2</li>
|
||||||
|
@endif
|
||||||
|
</ul>
|
||||||
|
<ul>
|
||||||
|
<li>$account.name</li>
|
||||||
|
<li>$account.idNumber</li>
|
||||||
|
<li>$account.vatNumber</li>
|
||||||
|
<li>$account.address1</li>
|
||||||
|
<li>$account.address2</li>
|
||||||
|
<li>$account.city</li>
|
||||||
|
<li>$account.state</li>
|
||||||
|
<li>$account.postalCode</li>
|
||||||
|
<li>$account.country.name</li>
|
||||||
|
<li>$account.phone</li>
|
||||||
|
@if ($account->custom_label1)
|
||||||
|
<li>$account.customValue1</li>
|
||||||
|
@endif
|
||||||
|
@if ($account->custom_label2)
|
||||||
|
<li>$account.customValue2</li>
|
||||||
|
@endif
|
||||||
|
</ul>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<ul>
|
||||||
|
<li>$client.name</li>
|
||||||
|
<li>$client.idNumber</li>
|
||||||
|
<li>$client.vatNumber</li>
|
||||||
|
<li>$client.address1</li>
|
||||||
|
<li>$client.address2</li>
|
||||||
|
<li>$client.city</li>
|
||||||
|
<li>$client.state</li>
|
||||||
|
<li>$client.postalCode</li>
|
||||||
|
<li>$client.country.name</li>
|
||||||
|
<li>$client.phone</li>
|
||||||
|
<li>$client.balance</li>
|
||||||
|
@if ($account->custom_client_label1)
|
||||||
|
<li>$client.customValue1</li>
|
||||||
|
@endif
|
||||||
|
@if ($account->custom_client_label2)
|
||||||
|
<li>$client.customValue2</li>
|
||||||
|
@endif
|
||||||
|
</ul>
|
||||||
|
<ul>
|
||||||
|
<li>$contact.firstName</li>
|
||||||
|
<li>$contact.lastName</li>
|
||||||
|
<li>$contact.email</li>
|
||||||
|
<li>$contact.phone</li>
|
||||||
|
@if ($account->custom_contact_label1)
|
||||||
|
<li>$contact.customValue1</li>
|
||||||
|
@endif
|
||||||
|
@if ($account->custom_contact_label2)
|
||||||
|
<li>$contact.customValue2</li>
|
||||||
|
@endif
|
||||||
|
</ul>
|
||||||
|
</div>
|
@ -21,64 +21,7 @@ function showProposalHelp() {
|
|||||||
<div class="container" style="width: 100%; padding-bottom: 0px !important">
|
<div class="container" style="width: 100%; padding-bottom: 0px !important">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
@include('partials/variables_help', ['entityType' => ENTITY_QUOTE, 'account' => auth()->user()->account])
|
||||||
<div class="col-md-6">
|
|
||||||
<ul>
|
|
||||||
<li>$quote.quoteNumber</li>
|
|
||||||
<li>$quote.discount</li>
|
|
||||||
<li>$quote.poNumber</li>
|
|
||||||
<li>$quote.quoteDate</li>
|
|
||||||
<li>$quote.validUntil</li>
|
|
||||||
<li>$quote.publicNotes</li>
|
|
||||||
<li>$quote.amount</li>
|
|
||||||
<li>$quote.terms</li>
|
|
||||||
<li>$quote.footer</li>
|
|
||||||
<li>$quote.partial</li>
|
|
||||||
<li>$quote.partialDueDate</li>
|
|
||||||
<li>$quote.customValue1</li>
|
|
||||||
<li>$quote.customValue2</li>
|
|
||||||
<li>$quote.customTextValue1</li>
|
|
||||||
<li>$quote.customTextValue2</li>
|
|
||||||
</ul>
|
|
||||||
<ul>
|
|
||||||
<li>$contact.firstName</li>
|
|
||||||
<li>$contact.lastName</li>
|
|
||||||
<li>$contact.email</li>
|
|
||||||
<li>$contact.phone</li>
|
|
||||||
<li>$contact.customValue1</li>
|
|
||||||
<li>$contact.customValue2</li>
|
|
||||||
</ul>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<ul>
|
|
||||||
<li>$client.name</li>
|
|
||||||
<li>$client.idNumber</li>
|
|
||||||
<li>$client.vatNumber</li>
|
|
||||||
<li>$client.address1</li>
|
|
||||||
<li>$client.address2</li>
|
|
||||||
<li>$client.city</li>
|
|
||||||
<li>$client.state</li>
|
|
||||||
<li>$client.postalCode</li>
|
|
||||||
<li>$client.country.name</li>
|
|
||||||
<li>$client.phone</li>
|
|
||||||
<li>$client.balance</li>
|
|
||||||
<li>$client.customValue1</li>
|
|
||||||
<li>$client.customValue2</li>
|
|
||||||
</ul>
|
|
||||||
<ul>
|
|
||||||
<li>$account.name</li>
|
|
||||||
<li>$account.idNumber</li>
|
|
||||||
<li>$account.vatNumber</li>
|
|
||||||
<li>$account.address1</li>
|
|
||||||
<li>$account.address2</li>
|
|
||||||
<li>$account.city</li>
|
|
||||||
<li>$account.state</li>
|
|
||||||
<li>$account.postalCode</li>
|
|
||||||
<li>$account.country.name</li>
|
|
||||||
<li>$account.phone</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user