document typo..
This commit is contained in:
parent
7f318911fd
commit
12e063eaff
@ -123,4 +123,11 @@ abstract class Document extends Component
|
||||
|
||||
return $hide;
|
||||
}
|
||||
|
||||
public function getClassFromConfig($type, $config_key)
|
||||
{
|
||||
$class_key = 'type.' . $type . '.class.' . $config_key;
|
||||
|
||||
return config($class_key, '');
|
||||
}
|
||||
}
|
||||
|
@ -360,14 +360,14 @@ abstract class DocumentForm extends Base
|
||||
return $contact_type;
|
||||
}
|
||||
|
||||
if ($contact_type = config("type.{$type}.contact_type")) {
|
||||
if ($contact_type = config('type.' . $type . '.contact_type')) {
|
||||
return $contact_type;
|
||||
}
|
||||
|
||||
// set default type
|
||||
$type = Document::INVOICE_TYPE;
|
||||
|
||||
return config("type.{$type}.contact_type");
|
||||
return config('type.' . $type . '.contact_type');
|
||||
}
|
||||
|
||||
protected function getTextAddContact($type, $textAddContact)
|
||||
@ -480,28 +480,25 @@ abstract class DocumentForm extends Base
|
||||
];
|
||||
}
|
||||
|
||||
protected function getIssuedAt($type, $document, $issued_at)
|
||||
protected function getIssuedAt($type, $document, $issuedAt)
|
||||
{
|
||||
if (!empty($issued_at)) {
|
||||
return $issued_at;
|
||||
if (!empty($issuedAt)) {
|
||||
return $issuedAt;
|
||||
}
|
||||
|
||||
if ($document) {
|
||||
return $document->issued_at;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'bill':
|
||||
case 'expense':
|
||||
case 'purchase':
|
||||
$issued_at = request()->get('billed_at', Date::now()->toDateString());
|
||||
break;
|
||||
default:
|
||||
$issued_at = request()->get('invoiced_at', Date::now()->toDateString());
|
||||
break;
|
||||
$issued_at = $type . '_at';
|
||||
|
||||
if (request()->has($issued_at)) {
|
||||
$issuedAt = request()->get($issued_at);
|
||||
} else {
|
||||
request()->get('invoiced_at', Date::now()->toDateString());
|
||||
}
|
||||
|
||||
return $issued_at;
|
||||
return $issuedAt;
|
||||
}
|
||||
|
||||
protected function getDocumentNumber($type, $document, $document_number)
|
||||
@ -514,15 +511,10 @@ abstract class DocumentForm extends Base
|
||||
return $document->document_number;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'bill':
|
||||
case 'expense':
|
||||
case 'purchase':
|
||||
$document_number = $this->getNextDocumentNumber(Document::BILL_TYPE);
|
||||
break;
|
||||
default:
|
||||
$document_number = $this->getNextDocumentNumber(Document::INVOICE_TYPE);
|
||||
break;
|
||||
$document_number = $this->getNextDocumentNumber($type);
|
||||
|
||||
if (empty($document_number)) {
|
||||
$document_number = $this->getNextDocumentNumber(Document::INVOICE_TYPE);
|
||||
}
|
||||
|
||||
return $document_number;
|
||||
@ -537,6 +529,8 @@ abstract class DocumentForm extends Base
|
||||
if ($document) {
|
||||
return $document->due_at;
|
||||
}
|
||||
|
||||
$addDays = (setting($type . '.payment_terms', 0)) ? setting($type . '.payment_terms', 0) : setting('invoice.payment_terms', 0);
|
||||
|
||||
switch ($type) {
|
||||
case 'bill':
|
||||
@ -545,7 +539,7 @@ abstract class DocumentForm extends Base
|
||||
$due_at = request()->get('billed_at', Date::now()->toDateString());
|
||||
break;
|
||||
default:
|
||||
$due_at = Date::parse(request()->get('invoiced_at', Date::now()->toDateString()))->addDays(setting('invoice.payment_terms', 0))->toDateString();
|
||||
$due_at = Date::parse(request()->get('invoiced_at', Date::now()->toDateString()))->addDays($addDays)->toDateString();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -292,13 +292,7 @@ abstract class DocumentIndex extends Base
|
||||
return $page;
|
||||
}
|
||||
|
||||
$route = $this->getRouteFromConfig($type, 'update');
|
||||
|
||||
if (!empty($route)) {
|
||||
return $route;
|
||||
}
|
||||
|
||||
return config("type.{$type}.route.prefix");
|
||||
return config('type.' . $type . '.route.prefix', 'invoices');
|
||||
}
|
||||
|
||||
protected function getDocsPath($type, $docsPath)
|
||||
@ -307,6 +301,12 @@ abstract class DocumentIndex extends Base
|
||||
return $docsPath;
|
||||
}
|
||||
|
||||
$docs_path = config('type.' . $type . '.docs_path');
|
||||
|
||||
if (!empty($docs_path)) {
|
||||
return $docs_path;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'sale':
|
||||
case 'income':
|
||||
@ -401,18 +401,23 @@ abstract class DocumentIndex extends Base
|
||||
if (!empty($searchStringModel)) {
|
||||
return $searchStringModel;
|
||||
}
|
||||
|
||||
$search_string_model = config('type.' . $type . '.search_string_model');
|
||||
|
||||
switch ($type) {
|
||||
case 'sale':
|
||||
case 'income':
|
||||
case 'invoice':
|
||||
$searchStringModel = 'App\Models\Sale\Invoice';
|
||||
break;
|
||||
case 'bill':
|
||||
case 'expense':
|
||||
case 'purchase':
|
||||
$searchStringModel = 'App\Models\Purchase\Bill';
|
||||
break;
|
||||
if (!empty($search_string_model)) {
|
||||
return $search_string_model;
|
||||
}
|
||||
|
||||
if ($group = config('type.' . $type . '.group')) {
|
||||
$group = Str::studly(Str::plural($group, 1)) . '\\';
|
||||
}
|
||||
|
||||
$prefix = Str::studly(Str::plural(config('type.' . $type . '.route.prefix'), 1))
|
||||
|
||||
if ($alias = config('type.' . $type . '.alias')) {
|
||||
$searchStringModel = 'Modules\\' . Str::studly($alias) .'\Models\\' . $group . $prefix;
|
||||
} else {
|
||||
$searchStringModel = 'App\Models\\' . $group . $prefix;
|
||||
}
|
||||
|
||||
return $searchStringModel;
|
||||
@ -441,17 +446,32 @@ abstract class DocumentIndex extends Base
|
||||
return $bulkActions;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'sale':
|
||||
case 'income':
|
||||
case 'invoice':
|
||||
$bulkActionClass = 'App\BulkActions\Sales\Invoices';
|
||||
break;
|
||||
case 'bill':
|
||||
case 'expense':
|
||||
case 'purchase':
|
||||
$bulkActionClass = 'App\BulkActions\Purchases\Bills';
|
||||
break;
|
||||
$bulk_actions = config('type.' . $type . '.bulk_actions');
|
||||
|
||||
if (!empty($bulk_actions)) {
|
||||
return $bulk_actions;
|
||||
}
|
||||
|
||||
$file_name = '';
|
||||
|
||||
if ($group = config('type.' . $type . '.group')) {
|
||||
$file_name .= Str::studly($group) . '\\';
|
||||
}
|
||||
|
||||
if ($prefix = config('type.' . $type . '.route.prefix')) {
|
||||
$file_name .= Str::studly($prefix);
|
||||
}
|
||||
|
||||
if ($alias = config('type.' . $type . '.alias')) {
|
||||
$module = module($alias);
|
||||
|
||||
if (!$module instanceof Module) {
|
||||
return;
|
||||
}
|
||||
|
||||
$bulkActionClass = 'Modules\\' . $module->getStudlyName() . '\BulkActions\\' . $file_name;
|
||||
} else {
|
||||
$bulkActionClass = 'App\BulkActions\\' . $file_name;
|
||||
}
|
||||
|
||||
if (class_exists($bulkActionClass)) {
|
||||
@ -496,6 +516,12 @@ abstract class DocumentIndex extends Base
|
||||
return $classBulkAction;
|
||||
}
|
||||
|
||||
$class = $this->getTextFromConfig($type, 'bulk_action');
|
||||
|
||||
if (!empty($class)) {
|
||||
return $class;
|
||||
}
|
||||
|
||||
return 'col-sm-2 col-md-1 col-lg-1 col-xl-1 d-none d-sm-block';
|
||||
}
|
||||
|
||||
@ -524,6 +550,12 @@ abstract class DocumentIndex extends Base
|
||||
return $classDocumentNumber;
|
||||
}
|
||||
|
||||
$class = $this->getTextFromConfig($type, 'document_number');
|
||||
|
||||
if (!empty($class)) {
|
||||
return $class;
|
||||
}
|
||||
|
||||
return 'col-md-2 col-lg-1 col-xl-1 d-none d-md-block';
|
||||
}
|
||||
|
||||
@ -554,6 +586,12 @@ abstract class DocumentIndex extends Base
|
||||
return $classContactName;
|
||||
}
|
||||
|
||||
$class = $this->getTextFromConfig($type, 'contact_name');
|
||||
|
||||
if (!empty($class)) {
|
||||
return $class;
|
||||
}
|
||||
|
||||
return 'col-xs-4 col-sm-4 col-md-4 col-lg-2 col-xl-2 text-left';
|
||||
}
|
||||
|
||||
@ -567,6 +605,12 @@ abstract class DocumentIndex extends Base
|
||||
return $classAmount;
|
||||
}
|
||||
|
||||
$class = $this->getTextFromConfig($type, 'amount');
|
||||
|
||||
if (!empty($class)) {
|
||||
return $class;
|
||||
}
|
||||
|
||||
return 'col-xs-4 col-sm-4 col-md-3 col-lg-2 col-xl-2 text-right';
|
||||
}
|
||||
|
||||
@ -606,6 +650,12 @@ abstract class DocumentIndex extends Base
|
||||
return $classIssuedAt;
|
||||
}
|
||||
|
||||
$class = $this->getTextFromConfig($type, 'issued_at');
|
||||
|
||||
if (!empty($class)) {
|
||||
return $class;
|
||||
}
|
||||
|
||||
return 'col-lg-2 col-xl-2 d-none d-lg-block text-left';
|
||||
}
|
||||
|
||||
@ -630,6 +680,12 @@ abstract class DocumentIndex extends Base
|
||||
return $classDueAt;
|
||||
}
|
||||
|
||||
$class = $this->getTextFromConfig($type, 'due_at');
|
||||
|
||||
if (!empty($class)) {
|
||||
return $class;
|
||||
}
|
||||
|
||||
if ($classDueAt = $this->getClass('classDueAt')) {
|
||||
return $classDueAt;
|
||||
}
|
||||
@ -664,6 +720,12 @@ abstract class DocumentIndex extends Base
|
||||
return $classStatus;
|
||||
}
|
||||
|
||||
$class = $this->getTextFromConfig($type, 'status');
|
||||
|
||||
if (!empty($class)) {
|
||||
return $class;
|
||||
}
|
||||
|
||||
return 'col-lg-1 col-xl-1 d-none d-lg-block text-center';
|
||||
}
|
||||
|
||||
@ -677,6 +739,12 @@ abstract class DocumentIndex extends Base
|
||||
return $classActions;
|
||||
}
|
||||
|
||||
$class = $this->getTextFromConfig($type, 'actions');
|
||||
|
||||
if (!empty($class)) {
|
||||
return $class;
|
||||
}
|
||||
|
||||
return 'col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1 text-center';
|
||||
}
|
||||
|
||||
|
@ -553,16 +553,12 @@ abstract class DocumentShow extends Base
|
||||
return $documentTemplate;
|
||||
}
|
||||
|
||||
$documentTemplate = 'default';
|
||||
|
||||
switch ($type) {
|
||||
case 'sale':
|
||||
case 'income':
|
||||
case 'invoice':
|
||||
$documentTemplate = setting('invoice.template', 'default');
|
||||
break;
|
||||
if ($template = config('type.' . $type . 'template', false)) {
|
||||
return $template;
|
||||
}
|
||||
|
||||
$documentTemplate = setting($type . '.template', 'default');
|
||||
|
||||
return $documentTemplate;
|
||||
}
|
||||
|
||||
@ -963,6 +959,12 @@ abstract class DocumentShow extends Base
|
||||
return $classHeaderStatus;
|
||||
}
|
||||
|
||||
$class = $this->getTextFromConfig($type, 'header_status');
|
||||
|
||||
if (!empty($class)) {
|
||||
return $class;
|
||||
}
|
||||
|
||||
return 'col-md-2';
|
||||
}
|
||||
|
||||
@ -972,6 +974,12 @@ abstract class DocumentShow extends Base
|
||||
return $classHeaderContact;
|
||||
}
|
||||
|
||||
$class = $this->getTextFromConfig($type, 'header_contact');
|
||||
|
||||
if (!empty($class)) {
|
||||
return $class;
|
||||
}
|
||||
|
||||
return 'col-md-6';
|
||||
}
|
||||
|
||||
@ -981,6 +989,12 @@ abstract class DocumentShow extends Base
|
||||
return $classHeaderAmount;
|
||||
}
|
||||
|
||||
$class = $this->getTextFromConfig($type, 'header_amount');
|
||||
|
||||
if (!empty($class)) {
|
||||
return $class;
|
||||
}
|
||||
|
||||
return 'col-md-2';
|
||||
}
|
||||
|
||||
@ -990,6 +1004,12 @@ abstract class DocumentShow extends Base
|
||||
return $classHeaderDueAt;
|
||||
}
|
||||
|
||||
$class = $this->getTextFromConfig($type, 'header_due_at');
|
||||
|
||||
if (!empty($class)) {
|
||||
return $class;
|
||||
}
|
||||
|
||||
return 'col-md-2';
|
||||
}
|
||||
|
||||
@ -1001,6 +1021,10 @@ abstract class DocumentShow extends Base
|
||||
|
||||
$hideTimelineStatuses = ['paid', 'cancelled'];
|
||||
|
||||
if ($timelime_statuses = config('type.' . $type . 'timeline_statuses')) {
|
||||
$hideTimelineStatuses = $timelime_statuses;
|
||||
}
|
||||
|
||||
return $hideTimelineStatuses;
|
||||
}
|
||||
|
||||
|
@ -175,18 +175,12 @@ abstract class DocumentTemplate extends Base
|
||||
return $documentTemplate;
|
||||
}
|
||||
|
||||
// $documentTemplate = 'components.documents.template.default';
|
||||
$documentTemplate = 'default';
|
||||
|
||||
switch ($type) {
|
||||
case 'sale':
|
||||
case 'income':
|
||||
case 'invoice':
|
||||
// $documentTemplate = 'components.documents.template.' . setting('invoice.template', 'default');
|
||||
$documentTemplate = setting('invoice.template', 'default');
|
||||
break;
|
||||
if ($template = config('type.' . $type . 'template', false)) {
|
||||
return $template;
|
||||
}
|
||||
|
||||
$documentTemplate = setting($type . '.template', 'default');
|
||||
|
||||
return $documentTemplate;
|
||||
}
|
||||
|
||||
@ -229,19 +223,12 @@ abstract class DocumentTemplate extends Base
|
||||
return $backgroundColor;
|
||||
}
|
||||
|
||||
$backgroundColor = '#55588b';
|
||||
|
||||
switch ($type) {
|
||||
case 'bill':
|
||||
case 'expense':
|
||||
case 'purchase':
|
||||
$backgroundColor = setting('bill.color');
|
||||
break;
|
||||
default:
|
||||
$backgroundColor = setting('invoice.color');
|
||||
break;
|
||||
if ($background_color = config('type.' . $type . 'color', false)) {
|
||||
return $background_color;
|
||||
}
|
||||
|
||||
$backgroundColor = setting($type . '.color', '#55588b');
|
||||
|
||||
return $backgroundColor;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user