Show correct text in a delete modal for modules.

This commit is contained in:
Pavel Mironchik 2021-02-17 09:36:52 +06:00
parent 94866bf68d
commit 3ae138de89
3 changed files with 28 additions and 3 deletions

View File

@ -155,6 +155,12 @@ abstract class DocumentIndex extends Base
/** @var string */ /** @var string */
public $routeButtonDelete; public $routeButtonDelete;
/** @var string */
public $textModalDelete;
/** @var string */
public $valueModalDelete;
/** @var bool */ /** @var bool */
public $hideButtonShow; public $hideButtonShow;
@ -204,6 +210,7 @@ abstract class DocumentIndex extends Base
string $textDocumentNumber = '', string $textContactName = '', string $classAmount = '', string $textIssuedAt = '', string $textDueAt = '', string $textDocumentStatus = '', string $textDocumentNumber = '', string $textContactName = '', string $classAmount = '', string $textIssuedAt = '', string $textDueAt = '', string $textDocumentStatus = '',
bool $checkButtonReconciled = true, bool $checkButtonCancelled = true, bool $checkButtonReconciled = true, bool $checkButtonCancelled = true,
string $routeButtonShow = '', string $routeButtonEdit = '', string $routeButtonDuplicate = '', string $routeButtonCancelled = '', string $routeButtonDelete = '', 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 $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, bool $hideButtonShow = false, bool $hideButtonEdit = false, bool $hideButtonDuplicate = false, bool $hideButtonCancel = false, bool $hideButtonDelete = false,
string $permissionCreate = '', string $permissionUpdate = '', string $permissionDelete = '' string $permissionCreate = '', string $permissionUpdate = '', string $permissionDelete = ''
@ -260,6 +267,9 @@ abstract class DocumentIndex extends Base
$this->routeButtonCancelled = $this->getRouteButtonCancelled($type, $routeButtonCancelled); $this->routeButtonCancelled = $this->getRouteButtonCancelled($type, $routeButtonCancelled);
$this->routeButtonDelete = $this->getRouteButtonDelete($type, $routeButtonDelete); $this->routeButtonDelete = $this->getRouteButtonDelete($type, $routeButtonDelete);
$this->textModalDelete = $this->getTextModalDelete($type, $textModalDelete);
$this->valueModalDelete = $valueModalDelete;
$this->hideBulkAction = $hideBulkAction; $this->hideBulkAction = $hideBulkAction;
$this->hideDocumentNumber = $hideDocumentNumber; $this->hideDocumentNumber = $hideDocumentNumber;
$this->hideContactName = $hideContactName; $this->hideContactName = $hideContactName;
@ -915,6 +925,19 @@ abstract class DocumentIndex extends Base
return 'invoices.destroy'; 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) protected function getPermissionCreate($type, $permissionCreate)
{ {
if (!empty($permissionCreate)) { if (!empty($permissionCreate)) {

View File

@ -242,10 +242,10 @@
@can($permissionDelete) @can($permissionDelete)
@if ($checkButtonReconciled) @if ($checkButtonReconciled)
@if (!$item->reconciled) @if (!$item->reconciled)
{!! Form::deleteLink($item, $routeButtonDelete) !!} {!! Form::deleteLink($item, $routeButtonDelete, $textModalDelete, $valueModalDelete) !!}
@endif @endif
@else @else
{!! Form::deleteLink($item, $routeButtonDelete) !!} {!! Form::deleteLink($item, $routeButtonDelete, $textModalDelete, $valueModalDelete) !!}
@endif @endif
@endcan @endcan
@endif @endif

View File

@ -51,6 +51,8 @@
hide-button-delete="{{ $hideButtonDelete }}" hide-button-delete="{{ $hideButtonDelete }}"
permission-delete="{{ $permissionDelete }}" permission-delete="{{ $permissionDelete }}"
route-button-delete="{{ $routeButtonDelete }}" route-button-delete="{{ $routeButtonDelete }}"
text-modal-delete="{{ $textModalDelete }}"
value-modal-delete="{{ $valueModalDelete }}"
/> />
<x-documents.index.card-footer <x-documents.index.card-footer