move document statutes keys..
This commit is contained in:
@ -713,7 +713,17 @@ abstract class DocumentIndex extends Base
|
||||
return $translation;
|
||||
}
|
||||
|
||||
return $default_key;
|
||||
$alias = config('type.' . $type . '.alias');
|
||||
|
||||
if (!empty($alias)) {
|
||||
$translation = $alias . '::' . config('type.' . $type . '.translation.prefix') . '.statuses';
|
||||
|
||||
if (is_array(trans($$translation))) {
|
||||
return $translation . '.';
|
||||
}
|
||||
}
|
||||
|
||||
return 'documents.statuses.';
|
||||
}
|
||||
|
||||
protected function getClassStatus($type, $classStatus)
|
||||
|
@ -637,17 +637,27 @@ abstract class DocumentShow extends Base
|
||||
{
|
||||
if (!empty($textHistoryStatus)) {
|
||||
return $textHistoryStatus;
|
||||
}
|
||||
}
|
||||
|
||||
$default_key = config('type.' . $type . '.translation.prefix') . '.statuses.';
|
||||
|
||||
$translation = $this->getTextFromConfig($type, 'history_status', $default_key);
|
||||
$translation = $this->getTextFromConfig($type, 'document_status', $default_key);
|
||||
|
||||
if (!empty($translation)) {
|
||||
return $translation;
|
||||
}
|
||||
|
||||
return $default_key;
|
||||
$alias = config('type.' . $type . '.alias');
|
||||
|
||||
if (!empty($alias)) {
|
||||
$translation = $alias . '::' . config('type.' . $type . '.translation.prefix') . '.statuses';
|
||||
|
||||
if (is_array(trans($$translation))) {
|
||||
return $translation . '.';
|
||||
}
|
||||
}
|
||||
|
||||
return 'documents.statuses.';
|
||||
}
|
||||
|
||||
protected function getRouteButtonAddNew($type, $routeButtonAddNew)
|
||||
|
@ -104,7 +104,7 @@ class PaymentReceived extends Notification
|
||||
$this->invoice->document_number,
|
||||
money($this->invoice->amount, $this->invoice->currency_code, true),
|
||||
company_date($this->invoice->due_at),
|
||||
trans('invoices.statuses.' . $this->invoice->status),
|
||||
trans('documents.statuses.' . $this->invoice->status),
|
||||
URL::signedRoute('signed.invoices.show', [$this->invoice->id, 'company_id' => $this->invoice->company_id]),
|
||||
route('invoices.show', $this->invoice->id),
|
||||
route('portal.invoices.show', $this->invoice->id),
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Traits;
|
||||
|
||||
use App\Models\Document\Document;
|
||||
use App\Abstracts\View\Components\Document as DocumentComponent;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
@ -50,10 +51,14 @@ trait Documents
|
||||
],
|
||||
];
|
||||
|
||||
$statuses = collect($list[$type])->each(function ($code) use ($type) {
|
||||
// @todo get dynamic path
|
||||
//$trans_key = $this->getTextDocumentStatuses($type);
|
||||
$trans_key = 'documents.statuses.';
|
||||
|
||||
$statuses = collect($list[$type])->each(function ($code) use ($type, $trans_key) {
|
||||
$item = new \stdClass();
|
||||
$item->code = $code;
|
||||
$item->name = trans(Str::plural($type) . '.statuses.' . $code);
|
||||
$item->name = trans($trans_key . $code);
|
||||
|
||||
return $item;
|
||||
});
|
||||
@ -70,4 +75,27 @@ trait Documents
|
||||
{
|
||||
return Str::slug($document->document_number, $separator, language()->getShortCode());
|
||||
}
|
||||
|
||||
protected function getTextDocumentStatuses($type)
|
||||
{
|
||||
$default_key = config('type.' . $type . '.translation.prefix') . '.statuses.';
|
||||
|
||||
$translation = DocumentComponent::getTextFromConfig($type, 'document_status', $default_key);
|
||||
|
||||
if (!empty($translation)) {
|
||||
return $translation;
|
||||
}
|
||||
|
||||
$alias = config('type.' . $type . '.alias');
|
||||
|
||||
if (!empty($alias)) {
|
||||
$translation = $alias . '::' . config('type.' . $type . '.translation.prefix') . '.statuses';
|
||||
|
||||
if (is_array(trans($$translation))) {
|
||||
return $translation . '.';
|
||||
}
|
||||
}
|
||||
|
||||
return 'documents.statuses.';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user