Format dates for client
This commit is contained in:
parent
ae02953a8f
commit
3900529e83
2 changed files with 11 additions and 1 deletions
|
|
@ -12,8 +12,10 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Models\BaseModel;
|
||||
use App\Models\DateFormat;
|
||||
use App\Models\Filterable;
|
||||
use App\Utils\Number;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
|
|
@ -21,6 +23,7 @@ class Payment extends BaseModel
|
|||
{
|
||||
use MakesHash;
|
||||
use Filterable;
|
||||
use MakesDates;
|
||||
|
||||
const STATUS_PENDING = 1;
|
||||
const STATUS_VOIDED = 2;
|
||||
|
|
@ -99,6 +102,13 @@ class Payment extends BaseModel
|
|||
return Number::formatMoney($this->amount, $this->client);
|
||||
}
|
||||
|
||||
public function clientPaymentDate()
|
||||
{
|
||||
$date_format = DateFormat::find($this->client->getSetting('date_format_id'));
|
||||
|
||||
return $this->createClientDate($this->payment_date, $this->client->timezone()->name)->format($date_format->format);
|
||||
}
|
||||
|
||||
public static function badgeForStatus(int $status)
|
||||
{
|
||||
switch ($status) {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-responsive-sm table-bordered">
|
||||
<tr><td style="text-align: right;">{{ctrans('texts.payment_date')}}</td><td>{{$payment->payment_date}}</td></tr>
|
||||
<tr><td style="text-align: right;">{{ctrans('texts.payment_date')}}</td><td>{!! $payment->clientPaymentDate() !!}</td></tr>
|
||||
<tr><td style="text-align: right;">{{ctrans('texts.transaction_reference')}}</td><td>{{$payment->transaction_reference}}</td></tr>
|
||||
<tr><td style="text-align: right;">{{ctrans('texts.method')}}</td><td>{{$payment->type->name}}</td></tr>
|
||||
<tr><td style="text-align: right;">{{ctrans('texts.amount')}}</td><td>{{$payment->formattedAmount()}}</td></tr>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue