Invoice time support (#269)

* Changed invoice date to datetime

* Fixed code style errors

* Update TimeFormatsController.php

* Update TimeFormatter.php

* Update TimeFormatsController namespace

* Fix missing comma in language file

* Fix formatting

---------

Co-authored-by: troky <troky2001@yahoo.com>
This commit is contained in:
Darko Gjorgjijoski
2025-01-12 13:32:47 +01:00
committed by GitHub
parent 32e03b98a3
commit f52b73f517
14 changed files with 242 additions and 3 deletions

View File

@@ -227,6 +227,9 @@ class Company extends Model implements HasMedia
'fiscal_year' => '1-12',
'carbon_date_format' => 'Y/m/d',
'moment_date_format' => 'YYYY/MM/DD',
'carbon_time_format' => 'H:i',
'moment_time_format' => 'HH:mm',
'invoice_use_time' => 'NO',
'notification_email' => 'noreply@invoiceshelf.com',
'notify_invoice_viewed' => 'NO',
'notify_estimate_viewed' => 'NO',

View File

@@ -195,6 +195,12 @@ class Invoice extends Model implements HasMedia
public function getFormattedInvoiceDateAttribute($value)
{
$dateFormat = CompanySetting::getSetting('carbon_date_format', $this->company_id);
$timeFormat = CompanySetting::getSetting('carbon_time_format', $this->company_id);
$invoiceTimeEnabled = CompanySetting::getSetting('invoice_use_time', $this->company_id);
if ($invoiceTimeEnabled === 'YES') {
$dateFormat .= ' '.$timeFormat;
}
return Carbon::parse($this->invoice_date)->translatedFormat($dateFormat);
}