From 94866bf68d002dade4bf681621cb01e8256b857b Mon Sep 17 00:00:00 2001 From: Pavel Mironchik Date: Wed, 17 Feb 2021 09:34:55 +0600 Subject: [PATCH 1/3] Fix a typo. --- app/Abstracts/View/Components/Document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Abstracts/View/Components/Document.php b/app/Abstracts/View/Components/Document.php index a9942ac91..82323a590 100644 --- a/app/Abstracts/View/Components/Document.php +++ b/app/Abstracts/View/Components/Document.php @@ -11,7 +11,7 @@ abstract class Document extends Component { $translation = ''; - // if set config trasnlation config_key + // if set config translation config_key if ($translation = config('type.' . $type . '.translation.' . $config_key)) { return $translation; } From 3ae138de8934f7514cda9341e71802107fd04c4c Mon Sep 17 00:00:00 2001 From: Pavel Mironchik Date: Wed, 17 Feb 2021 09:36:52 +0600 Subject: [PATCH 2/3] Show correct text in a delete modal for modules. --- .../View/Components/DocumentIndex.php | 25 ++++++++++++++++++- .../documents/index/card-body.blade.php | 4 +-- .../documents/index/content.blade.php | 2 ++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/app/Abstracts/View/Components/DocumentIndex.php b/app/Abstracts/View/Components/DocumentIndex.php index 376606954..d22518b92 100644 --- a/app/Abstracts/View/Components/DocumentIndex.php +++ b/app/Abstracts/View/Components/DocumentIndex.php @@ -155,6 +155,12 @@ abstract class DocumentIndex extends Base /** @var string */ public $routeButtonDelete; + /** @var string */ + public $textModalDelete; + + /** @var string */ + public $valueModalDelete; + /** @var bool */ public $hideButtonShow; @@ -194,7 +200,7 @@ abstract class DocumentIndex extends Base * @return void */ public function __construct( - string $type, $documents = [], $limits = [], + string $type, $documents = [], $limits = [], string $imageEmptyPage = '', string $textEmptyPage = '', string $textPage = '', string $urlDocsPath = '', $hideEmptyPage = false, bool $checkPermissionCreate = true, string $createRoute = '', string $importRoute = '', array $importRouteParameters = [], string $exportRoute = '', bool $hideCreate = false, bool $hideImport = false, bool $hideExport = false, // Advanced @@ -204,6 +210,7 @@ abstract class DocumentIndex extends Base string $textDocumentNumber = '', string $textContactName = '', string $classAmount = '', string $textIssuedAt = '', string $textDueAt = '', string $textDocumentStatus = '', bool $checkButtonReconciled = true, bool $checkButtonCancelled = true, string $routeButtonShow = '', string $routeButtonEdit = '', string $routeButtonDuplicate = '', string $routeButtonCancelled = '', string $routeButtonDelete = '', + string $textModalDelete = '', string $valueModalDelete = 'name', bool $hideDocumentNumber = false, bool $hideContactName = false, bool $hideAmount = false, bool $hideIssuedAt = false, bool $hideDueAt = false, bool $hideStatus = false, bool $hideActions = false, bool $hideButtonShow = false, bool $hideButtonEdit = false, bool $hideButtonDuplicate = false, bool $hideButtonCancel = false, bool $hideButtonDelete = false, string $permissionCreate = '', string $permissionUpdate = '', string $permissionDelete = '' @@ -260,6 +267,9 @@ abstract class DocumentIndex extends Base $this->routeButtonCancelled = $this->getRouteButtonCancelled($type, $routeButtonCancelled); $this->routeButtonDelete = $this->getRouteButtonDelete($type, $routeButtonDelete); + $this->textModalDelete = $this->getTextModalDelete($type, $textModalDelete); + $this->valueModalDelete = $valueModalDelete; + $this->hideBulkAction = $hideBulkAction; $this->hideDocumentNumber = $hideDocumentNumber; $this->hideContactName = $hideContactName; @@ -915,6 +925,19 @@ abstract class DocumentIndex extends Base return 'invoices.destroy'; } + protected function getTextModalDelete($type, $textModalDelete) + { + if (!empty($textModalDelete)) { + return $textModalDelete; + } + + if ($alias = config('type.' . $type . '.alias')) { + return $alias . '::general.' . Str::plural(str_replace('-', '_', $type)); + } + + return ''; + } + protected function getPermissionCreate($type, $permissionCreate) { if (!empty($permissionCreate)) { diff --git a/resources/views/components/documents/index/card-body.blade.php b/resources/views/components/documents/index/card-body.blade.php index b68b322e8..e5eed5aa9 100644 --- a/resources/views/components/documents/index/card-body.blade.php +++ b/resources/views/components/documents/index/card-body.blade.php @@ -242,10 +242,10 @@ @can($permissionDelete) @if ($checkButtonReconciled) @if (!$item->reconciled) - {!! Form::deleteLink($item, $routeButtonDelete) !!} + {!! Form::deleteLink($item, $routeButtonDelete, $textModalDelete, $valueModalDelete) !!} @endif @else - {!! Form::deleteLink($item, $routeButtonDelete) !!} + {!! Form::deleteLink($item, $routeButtonDelete, $textModalDelete, $valueModalDelete) !!} @endif @endcan @endif diff --git a/resources/views/components/documents/index/content.blade.php b/resources/views/components/documents/index/content.blade.php index 03fe0a42a..5b923b298 100644 --- a/resources/views/components/documents/index/content.blade.php +++ b/resources/views/components/documents/index/content.blade.php @@ -51,6 +51,8 @@ hide-button-delete="{{ $hideButtonDelete }}" permission-delete="{{ $permissionDelete }}" route-button-delete="{{ $routeButtonDelete }}" + text-modal-delete="{{ $textModalDelete }}" + value-modal-delete="{{ $valueModalDelete }}" /> Date: Wed, 17 Feb 2021 09:41:31 +0600 Subject: [PATCH 3/3] Use the `document_number` field by default in a delete modal for documents. --- app/Abstracts/View/Components/DocumentIndex.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Abstracts/View/Components/DocumentIndex.php b/app/Abstracts/View/Components/DocumentIndex.php index d22518b92..a8449b336 100644 --- a/app/Abstracts/View/Components/DocumentIndex.php +++ b/app/Abstracts/View/Components/DocumentIndex.php @@ -210,7 +210,7 @@ abstract class DocumentIndex extends Base string $textDocumentNumber = '', string $textContactName = '', string $classAmount = '', string $textIssuedAt = '', string $textDueAt = '', string $textDocumentStatus = '', bool $checkButtonReconciled = true, bool $checkButtonCancelled = true, string $routeButtonShow = '', string $routeButtonEdit = '', string $routeButtonDuplicate = '', string $routeButtonCancelled = '', string $routeButtonDelete = '', - string $textModalDelete = '', string $valueModalDelete = 'name', + string $textModalDelete = '', string $valueModalDelete = 'document_number', bool $hideDocumentNumber = false, bool $hideContactName = false, bool $hideAmount = false, bool $hideIssuedAt = false, bool $hideDueAt = false, bool $hideStatus = false, bool $hideActions = false, bool $hideButtonShow = false, bool $hideButtonEdit = false, bool $hideButtonDuplicate = false, bool $hideButtonCancel = false, bool $hideButtonDelete = false, string $permissionCreate = '', string $permissionUpdate = '', string $permissionDelete = ''