Document text dynamic fixed..
This commit is contained in:
parent
3c59a57a8a
commit
78996c35dd
@ -8,6 +8,7 @@ use App\Models\Document\Document;
|
|||||||
use App\Traits\Documents;
|
use App\Traits\Documents;
|
||||||
use Date;
|
use Date;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
abstract class DocumentForm extends Base
|
abstract class DocumentForm extends Base
|
||||||
{
|
{
|
||||||
use Documents;
|
use Documents;
|
||||||
@ -405,7 +406,9 @@ abstract class DocumentForm extends Base
|
|||||||
return $textAddContact;
|
return $textAddContact;
|
||||||
}
|
}
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'add_contact', Str::plural($this->contactType, 2), 'trans_choice');
|
$default_key = Str::plural(config('type.' . $type . '.contact_type'), 2);
|
||||||
|
|
||||||
|
$translation = $this->getTextFromConfig($type, 'add_contact', $default_key, 'trans_choice');
|
||||||
|
|
||||||
if (!empty($translation)) {
|
if (!empty($translation)) {
|
||||||
return [
|
return [
|
||||||
@ -426,9 +429,9 @@ abstract class DocumentForm extends Base
|
|||||||
return $textCreateNewContact;
|
return $textCreateNewContact;
|
||||||
}
|
}
|
||||||
|
|
||||||
$contact_type = Str::plural(config('type.' . $type . '.contact_type'), 2);
|
$default_key = Str::plural(config('type.' . $type . '.contact_type'), 2);
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'create_new_contact', $contact_type, 'trans_choice');
|
$translation = $this->getTextFromConfig($type, 'create_new_contact', $default_key, 'trans_choice');
|
||||||
|
|
||||||
if (!empty($translation)) {
|
if (!empty($translation)) {
|
||||||
return [
|
return [
|
||||||
@ -490,7 +493,9 @@ abstract class DocumentForm extends Base
|
|||||||
return $textChooseDifferentContact;
|
return $textChooseDifferentContact;
|
||||||
}
|
}
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'choose_different_contact', Str::plural($this->contactType, 2), 'trans_choice');
|
$default_key = Str::plural(config('type.' . $type . '.contact_type'), 2);
|
||||||
|
|
||||||
|
$translation = $this->getTextFromConfig($type, 'choose_different_contact', $default_key, 'trans_choice');
|
||||||
|
|
||||||
if (!empty($translation)) {
|
if (!empty($translation)) {
|
||||||
return [
|
return [
|
||||||
@ -732,10 +737,10 @@ abstract class DocumentForm extends Base
|
|||||||
return 'invoices.price';
|
return 'invoices.price';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTextAmount($type, $text_amount)
|
protected function getTextAmount($type, $textAmount)
|
||||||
{
|
{
|
||||||
if (!empty($text_amount)) {
|
if (!empty($textAmount)) {
|
||||||
return $text_amount;
|
return $textAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'amount');
|
$translation = $this->getTextFromConfig($type, 'amount');
|
||||||
|
@ -428,7 +428,9 @@ abstract class DocumentIndex extends Base
|
|||||||
return $textBulkAction;
|
return $textBulkAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'bulk_action', Str::plural($type, 2));
|
$default_key = config('type.' . $type . '.translation.prefix');
|
||||||
|
|
||||||
|
$translation = $this->getTextFromConfig($type, 'bulk_action', $default_key, 'trans_choice');
|
||||||
|
|
||||||
if (!empty($translation)) {
|
if (!empty($translation)) {
|
||||||
return $translation;
|
return $translation;
|
||||||
@ -529,9 +531,9 @@ abstract class DocumentIndex extends Base
|
|||||||
return $textContactName;
|
return $textContactName;
|
||||||
}
|
}
|
||||||
|
|
||||||
$contact_type = Str::plural(config('type.' . $type . '.contact_type'), 2);
|
$default_key = Str::plural(config('type.' . $type . '.contact_type'), 2);
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'contact_name', $contact_type, 'trans_choice');
|
$translation = $this->getTextFromConfig($type, 'contact_name', $default_key, 'trans_choice');
|
||||||
|
|
||||||
if (!empty($translation)) {
|
if (!empty($translation)) {
|
||||||
return $translation;
|
return $translation;
|
||||||
@ -572,7 +574,18 @@ abstract class DocumentIndex extends Base
|
|||||||
return $textIssuedAt;
|
return $textIssuedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'issued_at');
|
switch ($type) {
|
||||||
|
case 'bill':
|
||||||
|
case 'expense':
|
||||||
|
case 'purchase':
|
||||||
|
$default_key = 'bill_date';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$default_key = 'invoice_date';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$translation = $this->getTextFromConfig($type, 'issued_at', $default_key);
|
||||||
|
|
||||||
if (!empty($translation)) {
|
if (!empty($translation)) {
|
||||||
return $translation;
|
return $translation;
|
||||||
@ -600,7 +613,7 @@ abstract class DocumentIndex extends Base
|
|||||||
return $textDueAt;
|
return $textDueAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'due_at');
|
$translation = $this->getTextFromConfig($type, 'due_at', 'due_date');
|
||||||
|
|
||||||
if (!empty($translation)) {
|
if (!empty($translation)) {
|
||||||
return $translation;
|
return $translation;
|
||||||
@ -628,7 +641,7 @@ abstract class DocumentIndex extends Base
|
|||||||
return $textDocumentStatus;
|
return $textDocumentStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
$default_key = config("type.' . $type . '.translation.prefix") . '.statuses.';
|
$default_key = config('type.' . $type . '.translation.prefix') . '.statuses.';
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'document_status', $default_key);
|
$translation = $this->getTextFromConfig($type, 'document_status', $default_key);
|
||||||
|
|
||||||
|
@ -521,7 +521,7 @@ abstract class DocumentShow extends Base
|
|||||||
return $textRecurringType;
|
return $textRecurringType;
|
||||||
}
|
}
|
||||||
|
|
||||||
$default_key = config("type.' . $type . '.translation.prefix");
|
$default_key = config('type.' . $type . '.translation.prefix');
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'recurring_tye', $default_key);
|
$translation = $this->getTextFromConfig($type, 'recurring_tye', $default_key);
|
||||||
|
|
||||||
@ -538,7 +538,7 @@ abstract class DocumentShow extends Base
|
|||||||
return $textStatusMessage;
|
return $textStatusMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
$default_key = config("type.' . $type . '.translation.prefix") . '.messages.draft';
|
$default_key = config('type.' . $type . '.translation.prefix') . '.messages.draft';
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'status_message', $default_key);
|
$translation = $this->getTextFromConfig($type, 'status_message', $default_key);
|
||||||
|
|
||||||
@ -628,7 +628,7 @@ abstract class DocumentShow extends Base
|
|||||||
return $textHistories;
|
return $textHistories;
|
||||||
}
|
}
|
||||||
|
|
||||||
$default_key = config("type.' . $type . '.translation.prefix") . '.histories';
|
$default_key = config('type.' . $type . '.translation.prefix') . '.histories';
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'histories', $default_key);
|
$translation = $this->getTextFromConfig($type, 'histories', $default_key);
|
||||||
|
|
||||||
@ -645,9 +645,9 @@ abstract class DocumentShow extends Base
|
|||||||
return $textHistoryStatus;
|
return $textHistoryStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
$default_key = config("type.' . $type . '.translation.prefix") . '.statuses.';
|
$default_key = config('type.' . $type . '.translation.prefix') . '.statuses.';
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'statuses', $default_key);
|
$translation = $this->getTextFromConfig($type, 'history_status', $default_key);
|
||||||
|
|
||||||
if (!empty($translation)) {
|
if (!empty($translation)) {
|
||||||
return $translation;
|
return $translation;
|
||||||
|
@ -251,7 +251,18 @@ abstract class DocumentTemplate extends Base
|
|||||||
return $textDocumentNumber;
|
return $textDocumentNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
$translation = $this->getTextFromConfig($type, 'document_number', 'numbers');
|
switch ($type) {
|
||||||
|
case 'bill':
|
||||||
|
case 'expense':
|
||||||
|
case 'purchase':
|
||||||
|
$default_key = 'bill_number';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$default_key = 'invoice_number';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$translation = $this->getTextFromConfig($type, 'document_number', $default_key);
|
||||||
|
|
||||||
if (!empty($translation)) {
|
if (!empty($translation)) {
|
||||||
return $translation;
|
return $translation;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user