mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add additional date formats / performance improvements. (#3161)
* Improve eager loading * Fixes for performance on client portal datatable with large datasets * Add missing date format
This commit is contained in:
parent
e125052f96
commit
519c1114c1
@ -46,7 +46,7 @@ class PaymentController extends Controller
|
||||
public function index(PaymentFilters $filters, Builder $builder)
|
||||
{
|
||||
//$payments = Payment::filter($filters);
|
||||
$payments = Payment::with('type','client')->get();
|
||||
$payments = Payment::with('type','client');
|
||||
|
||||
if (request()->ajax()) {
|
||||
|
||||
|
@ -93,9 +93,9 @@ class Client extends BaseModel
|
||||
protected $with = [
|
||||
//'currency',
|
||||
// 'primary_contact',
|
||||
// 'country',
|
||||
'country',
|
||||
// 'shipping_country',
|
||||
// 'company'
|
||||
'company'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
|
@ -104,7 +104,7 @@ class Payment extends BaseModel
|
||||
|
||||
public function type()
|
||||
{
|
||||
return $this->hasOne(PaymentType::class,'id','type_id');
|
||||
return $this->belongsTo(PaymentType::class);
|
||||
}
|
||||
|
||||
public function paymentables()
|
||||
|
@ -33,7 +33,7 @@ class CompanyPresenter extends EntityPresenter
|
||||
if(!$settings)
|
||||
$settings = $this->entity->settings;
|
||||
|
||||
return strlen($settings->company_logo > 0) ? $settings->company_logo : 'https://www.invoiceninja.com/wp-content/uploads/2019/01/InvoiceNinja-Logo-Round-300x300.png';
|
||||
return iconv_strlen($settings->company_logo > 0) ? $settings->company_logo : 'https://www.invoiceninja.com/wp-content/uploads/2019/01/InvoiceNinja-Logo-Round-300x300.png';
|
||||
}
|
||||
|
||||
public function address($settings = null)
|
||||
|
@ -34,6 +34,9 @@ trait MakesInvoiceHtml
|
||||
{
|
||||
|
||||
$variables = array_merge($invoice->makeLabels(), $invoice->makeValues());
|
||||
|
||||
// uasort($variables, 'arraySort');
|
||||
|
||||
$design = str_replace(array_keys($variables), array_values($variables), $design);
|
||||
|
||||
$data['invoice'] = $invoice;
|
||||
|
@ -49,7 +49,7 @@ trait MakesInvoiceValues
|
||||
private static $labels = [
|
||||
'date',
|
||||
'due_date',
|
||||
'number',
|
||||
'invoice_number',
|
||||
'po_number',
|
||||
'discount',
|
||||
'taxes',
|
||||
@ -138,6 +138,8 @@ trait MakesInvoiceValues
|
||||
*/
|
||||
public function makeLabels() :array
|
||||
{
|
||||
//todo we might want to translate like this
|
||||
//trans('texts.labe', [], null, $this->client->locale());
|
||||
$data = [];
|
||||
|
||||
foreach(self::$labels as $label)
|
||||
|
@ -25,6 +25,7 @@ class DateFormatsSeeder extends Seeder
|
||||
['id' => 11, 'format' => 'd.m.Y', 'format_moment' => 'D.MM.YYYY', 'format_dart' => 'dd.MM.yyyy'],
|
||||
['id' => 12, 'format' => 'j. M. Y', 'format_moment' => 'DD. MMM. YYYY', 'format_dart' => 'd. MMM. yyyy'],
|
||||
['id' => 13, 'format' => 'j. F Y', 'format_moment' => 'DD. MMMM YYYY', 'format_dart' => 'd. MMMM yyyy'],
|
||||
['id' => 14, 'format' => 'dd/mm/yyyy', 'format_moment' => 'DD/MM/YYY', 'format_dart' => 'dd/MM/yyyy'],
|
||||
];
|
||||
|
||||
foreach ($formats as $format) {
|
||||
@ -54,6 +55,7 @@ class DateFormatsSeeder extends Seeder
|
||||
['id' => 11, 'format' => 'd.m.Y g:i a', 'format_moment' => 'D.MM.YYYY h:mm:ss a', 'format_dart' => 'dd.MM.yyyy h:mm a'],
|
||||
['id' => 12, 'format' => 'j. M. Y g:i a', 'format_moment' => 'DD. MMM. YYYY h:mm:ss a', 'format_dart' => 'd. MMM. yyyy h:mm a'],
|
||||
['id' => 13, 'format' => 'j. F Y g:i a', 'format_moment' => 'DD. MMMM YYYY h:mm:ss a', 'format_dart' => 'd. MMMM yyyy h:mm a'],
|
||||
['id' => 14, 'format' => 'dd/mm/yyyy g:i a', 'format_moment' => 'DD/MM/YYYY h:mm:ss a', 'format_dart' => 'dd/MM/yyyy h:mm a'],
|
||||
];
|
||||
|
||||
foreach ($formats as $format) {
|
||||
|
@ -58,11 +58,11 @@
|
||||
<div class="row mt-4">
|
||||
|
||||
<div class="col-md-4">
|
||||
<img src="$company_logo" style="width:100%; max-width:150px;">
|
||||
<img src="$company.logo" style="width:100%; max-width:150px;">
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 ml-auto">
|
||||
$number_label: $number <br>
|
||||
$invoice_number_label: $number <br>
|
||||
$date_label: $date <br>
|
||||
$due_date_label: $due_date
|
||||
</div>
|
||||
@ -80,8 +80,8 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 ml-auto">
|
||||
$company_name<br>
|
||||
$company_address<br>
|
||||
$company.name<br>
|
||||
$company.address<br>
|
||||
$phone<br>
|
||||
$email<br>
|
||||
</div>
|
||||
|
@ -118,12 +118,12 @@
|
||||
<table>
|
||||
<tr>
|
||||
<td class="title">
|
||||
<img src="$company_logo" style="width:100%; max-width:150px;">
|
||||
<img src="$company.logo" style="width:100%; max-width:150px;">
|
||||
</td>
|
||||
|
||||
<td>
|
||||
$invoice_number_label: $invoice_number <br>
|
||||
$invoice_date_label: $invoice_date <br>
|
||||
$invoice_number_label: $number <br>
|
||||
$invoice_date_label: $date <br>
|
||||
$invoice_due_date_label: $due_date
|
||||
|
||||
</td>
|
||||
|
@ -66,8 +66,8 @@ $(function() {
|
||||
},
|
||||
columns: [
|
||||
|
||||
{data: 'payment_date', name: 'payment_date', title: '{{ctrans('texts.payment_date')}}', visible: true},
|
||||
{data: 'payment_type_id', name: 'payment_type_id', title: '{{ctrans('texts.payment_type_id')}}', visible: true},
|
||||
{data: 'date', name: 'date', title: '{{ctrans('texts.payment_date')}}', visible: true},
|
||||
{data: 'type_id', name: 'type_id', title: '{{ctrans('texts.payment_type_id')}}', visible: true},
|
||||
{data: 'amount', name: 'amount', title: '{{ctrans('texts.amount')}}', visible: true},
|
||||
{data: 'transaction_reference', name: 'transaction_reference', title: '{{ctrans('texts.transaction_reference')}}', visible: true},
|
||||
{data: 'status_id', name: 'status_id', title: '{{ctrans('texts.status')}}', visible: true},
|
||||
|
Loading…
x
Reference in New Issue
Block a user