1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Default note to client #1463

This commit is contained in:
Hillel Coren 2017-05-16 16:00:56 +03:00
parent ec56df33ce
commit 1f4e3baecf
9 changed files with 25 additions and 2 deletions

View File

@ -51,6 +51,7 @@ class Client extends EntityModel
'website',
'invoice_number_counter',
'quote_number_counter',
'public_notes',
];
/**

View File

@ -46,6 +46,7 @@ class Invoice extends EntityModel implements BalanceAffecting
'tax_rate1',
'tax_name2',
'tax_rate2',
'private_notes',
];
/**

View File

@ -19,6 +19,13 @@ class Payment extends EntityModel
use PresentableTrait;
use SoftDeletes;
/**
* @var array
*/
protected $fillable = [
'private_notes',
];
public static $statusClasses = [
PAYMENT_STATUS_PENDING => 'info',
PAYMENT_STATUS_COMPLETED => 'success',

View File

@ -25,6 +25,7 @@ class ClientTransformer extends EntityTransformer
* @SWG\Property(property="country_id", type="integer", example=840)
* @SWG\Property(property="work_phone", type="string", example="(212) 555-1212")
* @SWG\Property(property="private_notes", type="string", example="Notes...")
* @SWG\Property(property="public_notes", type="string", example="Notes...")
* @SWG\Property(property="last_login", type="string", format="date-time", example="2016-01-01 12:10:00")
* @SWG\Property(property="website", type="string", example="http://www.example.com")
* @SWG\Property(property="industry_id", type="integer", example=1)
@ -119,6 +120,7 @@ class ClientTransformer extends EntityTransformer
'country_id' => (int) $client->country_id,
'work_phone' => $client->work_phone,
'private_notes' => $client->private_notes,
'public_notes' => $client->public_notes,
'last_login' => $client->last_login,
'website' => $client->website,
'industry_id' => (int) $client->industry_id,

View File

@ -18,6 +18,8 @@ class InvoiceTransformer extends EntityTransformer
* @SWG\Property(property="client_id", type="integer", example=1)
* @SWG\Property(property="invoice_number", type="string", example="0001")
* @SWG\Property(property="invoice_status_id", type="integer", example=1)
* @SWG\Property(property="private_notes", type="string", example="Notes...")
* @SWG\Property(property="public_notes", type="string", example="Notes...")
*/
protected $defaultIncludes = [
'invoice_items',
@ -96,6 +98,7 @@ class InvoiceTransformer extends EntityTransformer
'due_date' => $invoice->due_date,
'terms' => $invoice->terms,
'public_notes' => $invoice->public_notes,
'private_notes' => $invoice->private_notes,
'is_deleted' => (bool) $invoice->is_deleted,
'invoice_type_id' => (int) $invoice->invoice_type_id,
'is_recurring' => (bool) $invoice->is_recurring,

View File

@ -16,6 +16,7 @@ class PaymentTransformer extends EntityTransformer
* @SWG\Property(property="id", type="integer", example=1, readOnly=true)
* @SWG\Property(property="amount", type="number", format="float", example=10, readOnly=true)
* @SWG\Property(property="invoice_id", type="integer", example=1)
* @SWG\Property(property="private_notes", type="string", example="Notes...")
*/
protected $defaultIncludes = [];
@ -58,6 +59,7 @@ class PaymentTransformer extends EntityTransformer
'payment_type_id' => (int) $payment->payment_type_id,
'invoice_id' => (int) ($this->invoice ? $this->invoice->public_id : $payment->invoice->public_id),
'invoice_number' => $this->invoice ? $this->invoice->invoice_number : $payment->invoice->invoice_number,
'private_notes' => $client->private_notes,
]);
}
}

View File

@ -67,7 +67,7 @@
</div>
</div>
<div class="panel panel-default" style="min-height: 500px">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.address') !!}</h3>
</div>
@ -139,7 +139,7 @@
</div>
<div class="panel panel-default" style="min-height: 500px">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.additional_info') !!}</h3>
</div>
@ -159,6 +159,7 @@
->fromQuery($sizes, 'name', 'id') !!}
{!! Former::select('industry_id')->addOption('','')
->fromQuery($industries, 'name', 'id') !!}
{!! Former::textarea('public_notes') !!}
{!! Former::textarea('private_notes') !!}
</div>
</div>

View File

@ -122,6 +122,10 @@
<i class="fa fa-phone" style="width: 20px"></i>{{ $client->work_phone }}
@endif
@if ($client->public_notes)
<p><i>{{ $client->public_notes }}</i></p>
@endif
@if ($client->private_notes)
<p><i>{{ $client->private_notes }}</i></p>
@endif

View File

@ -14,6 +14,8 @@ function ViewModel(data) {
@if (!$invoice->id)
self.setDueDate();
@endif
// copy default note from the client to the invoice
model.invoice().public_notes(client.public_notes);
}
self.showMoreFields = function() {