diff --git a/app/Models/Client.php b/app/Models/Client.php index f264218e22de..d09984343f00 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -51,6 +51,7 @@ class Client extends EntityModel 'website', 'invoice_number_counter', 'quote_number_counter', + 'public_notes', ]; /** diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 87c3d3112ea0..ce45c8827bb2 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -46,6 +46,7 @@ class Invoice extends EntityModel implements BalanceAffecting 'tax_rate1', 'tax_name2', 'tax_rate2', + 'private_notes', ]; /** diff --git a/app/Models/Payment.php b/app/Models/Payment.php index fb51b594d662..8e644a651db8 100644 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -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', diff --git a/app/Ninja/Transformers/ClientTransformer.php b/app/Ninja/Transformers/ClientTransformer.php index 4f12d9c0d4b9..6e1d6a23f662 100644 --- a/app/Ninja/Transformers/ClientTransformer.php +++ b/app/Ninja/Transformers/ClientTransformer.php @@ -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, diff --git a/app/Ninja/Transformers/InvoiceTransformer.php b/app/Ninja/Transformers/InvoiceTransformer.php index 7935fce8991c..907eaf0c127f 100644 --- a/app/Ninja/Transformers/InvoiceTransformer.php +++ b/app/Ninja/Transformers/InvoiceTransformer.php @@ -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, diff --git a/app/Ninja/Transformers/PaymentTransformer.php b/app/Ninja/Transformers/PaymentTransformer.php index d5278cc193b1..fd58f127f440 100644 --- a/app/Ninja/Transformers/PaymentTransformer.php +++ b/app/Ninja/Transformers/PaymentTransformer.php @@ -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, ]); } } diff --git a/resources/views/clients/edit.blade.php b/resources/views/clients/edit.blade.php index 691a20f8cd06..ea81fe533ba7 100644 --- a/resources/views/clients/edit.blade.php +++ b/resources/views/clients/edit.blade.php @@ -67,7 +67,7 @@ -
{{ $client->public_notes }}
+ @endif + @if ($client->private_notes){{ $client->private_notes }}
@endif diff --git a/resources/views/invoices/knockout.blade.php b/resources/views/invoices/knockout.blade.php index 5c852bd63485..17b790dc2461 100644 --- a/resources/views/invoices/knockout.blade.php +++ b/resources/views/invoices/knockout.blade.php @@ -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() {