1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Add notes in datatables

This commit is contained in:
Hillel Coren 2017-10-14 20:55:37 +03:00
parent 8a08aef3d5
commit 62d31999ed
14 changed files with 37 additions and 16 deletions

View File

@ -17,7 +17,8 @@ class ClientDatatable extends EntityDatatable
[
'name',
function ($model) {
return link_to("clients/{$model->public_id}", $model->name ?: '')->toHtml();
$str = link_to("clients/{$model->public_id}", $model->name ?: '')->toHtml();
return $this->addNote($str, $model->private_notes);
},
],
[

View File

@ -90,4 +90,12 @@ class EntityDatatable
return $indices;
}
public function addNote($str, $note) {
if (! $note) {
return $str;
}
return $str . '&nbsp; <span class="fa fa-file-o" data-toggle="tooltip" data-placement="bottom" title="' . e($note) . '"></span>';
}
}

View File

@ -52,7 +52,8 @@ class ExpenseDatatable extends EntityDatatable
return Utils::fromSqlDate($model->expense_date_sql);
}
return link_to("expenses/{$model->public_id}/edit", Utils::fromSqlDate($model->expense_date_sql))->toHtml();
$str = link_to("expenses/{$model->public_id}/edit", Utils::fromSqlDate($model->expense_date_sql))->toHtml();
return $this->addNote($str, $model->private_notes);
},
],
[

View File

@ -24,7 +24,8 @@ class InvoiceDatatable extends EntityDatatable
return $model->invoice_number;
}
return link_to("{$entityType}s/{$model->public_id}/edit", $model->invoice_number, ['class' => Utils::getEntityRowClass($model)])->toHtml();
$str = link_to("{$entityType}s/{$model->public_id}/edit", $model->invoice_number, ['class' => Utils::getEntityRowClass($model)])->toHtml();
return $this->addNote($str, $model->private_notes);
},
],
[

View File

@ -46,7 +46,8 @@ class PaymentDatatable extends EntityDatatable
[
'transaction_reference',
function ($model) {
return $model->transaction_reference ? e($model->transaction_reference) : '<i>'.trans('texts.manual_entry').'</i>';
$str = $model->transaction_reference ? e($model->transaction_reference) : '<i>'.trans('texts.manual_entry').'</i>';
return $this->addNote($str, $model->private_notes);
},
],
[

View File

@ -57,6 +57,16 @@ class RecurringExpenseDatatable extends EntityDatatable
},
],
*/
[
'frequency',
function ($model) {
$frequency = strtolower($model->frequency);
$frequency = preg_replace('/\s/', '_', $frequency);
$str = link_to("recurring_expenses/{$model->public_id}/edit", trans('texts.freq_'.$frequency))->toHtml();
return $this->addNote($str, $model->private_notes);
},
],
[
'amount',
function ($model) {
@ -91,15 +101,6 @@ class RecurringExpenseDatatable extends EntityDatatable
return $model->public_notes != null ? substr($model->public_notes, 0, 100) : '';
},
],
[
'frequency',
function ($model) {
$frequency = strtolower($model->frequency);
$frequency = preg_replace('/\s/', '_', $frequency);
return link_to("recurring_expenses/{$model->public_id}/edit", trans('texts.freq_'.$frequency))->toHtml();
},
],
];
}

View File

@ -17,7 +17,8 @@ class VendorDatatable extends EntityDatatable
[
'name',
function ($model) {
return link_to("vendors/{$model->public_id}", $model->name ?: '')->toHtml();
$str = link_to("vendors/{$model->public_id}", $model->name ?: '')->toHtml();
return $this->addNote($str, $model->private_notes);
},
],
[

View File

@ -41,6 +41,7 @@ class ClientRepository extends BaseRepository
DB::raw("CONCAT(contacts.first_name, ' ', contacts.last_name) contact"),
'clients.public_id',
'clients.name',
'clients.private_notes',
'contacts.first_name',
'contacts.last_name',
'clients.balance',

View File

@ -81,6 +81,7 @@ class ExpenseRepository extends BaseRepository
'expenses.user_id',
'expenses.tax_rate1',
'expenses.tax_rate2',
'expenses.private_notes',
'expenses.payment_date',
'expense_categories.name as category',
'expense_categories.user_id as category_user_id',

View File

@ -89,7 +89,8 @@ class InvoiceRepository extends BaseRepository
'invoices.partial',
'invoices.user_id',
'invoices.is_public',
'invoices.is_recurring'
'invoices.is_recurring',
'invoices.private_notes'
);
$this->applyFilters($query, $entityType, ENTITY_INVOICE);

View File

@ -63,6 +63,7 @@ class PaymentRepository extends BaseRepository
'payments.email',
'payments.routing_number',
'payments.bank_name',
'payments.private_notes',
'invoices.is_deleted as invoice_is_deleted',
'gateways.name as gateway_name',
'gateways.id as gateway_id',

View File

@ -60,6 +60,7 @@ class RecurringExpenseRepository extends BaseRepository
'recurring_expenses.user_id',
'recurring_expenses.tax_rate1',
'recurring_expenses.tax_rate2',
'recurring_expenses.private_notes',
'frequencies.name as frequency',
'expense_categories.name as category',
'expense_categories.user_id as category_user_id',

View File

@ -44,7 +44,8 @@ class VendorRepository extends BaseRepository
'vendor_contacts.email',
'vendors.deleted_at',
'vendors.is_deleted',
'vendors.user_id'
'vendors.user_id',
'vendors.private_notes'
);
$this->applyFilters($query, ENTITY_VENDOR);

View File

@ -210,6 +210,7 @@
});
actionListHandler();
$('[data-toggle="tooltip"]').tooltip();
}
$('.listForm_{{ $entityType }} .archive, .invoice').prop('disabled', true);