diff --git a/app/Abstracts/View/Components/Documents/Index.php b/app/Abstracts/View/Components/Documents/Index.php index 10cd142a9..a5e77a69f 100644 --- a/app/Abstracts/View/Components/Documents/Index.php +++ b/app/Abstracts/View/Components/Documents/Index.php @@ -161,6 +161,21 @@ abstract class Index extends Component /** @var string */ public $textIssuedAt; + /** @var bool */ + public $hideStartedAt; + + /** @var bool */ + public $hideEndedAt; + + /** @var string */ + public $classStartedAtAndEndedAt; + + /** @var string */ + public $textStartedAt; + + /** @var string */ + public $textEndedAt; + /** @var bool */ public $hideStatus; @@ -170,6 +185,21 @@ abstract class Index extends Component /** @var bool */ public $hideContactName; + /** @var bool */ + public $hideCategory; + + /** @var string */ + public $textCategory; + + /** @var bool */ + public $hideFrequency; + + /** @var string */ + public $classFrequencyAndDuration; + + /** @var bool */ + public $hideDuration; + /** @var bool */ public $hideDocumentNumber; @@ -237,7 +267,10 @@ abstract class Index extends Component bool $hideSearchString = false, bool $hideBulkAction = false, string $searchStringModel = '', string $bulkActionClass = '', array $bulkActions = [], array $bulkActionRouteParameters = [], string $searchRoute = '', string $classBulkAction = '', bool $hideDueAt = false, bool $hideIssuedAt = false, string $classDueAtAndIssueAt = '', string $textDueAt = '', string $textIssuedAt = '', + bool $hideStartedAt = false, bool $hideEndedAt = false, string $classStartedAtAndEndedAt = '', string $textStartedAt = '', string $textEndedAt = '', bool $hideStatus = false, string $classStatus = '', + bool $hideCategory = false, string $textCategory = '', + bool $hideFrequency = false, bool $hideDuration = false, string $classFrequencyAndDuration = '', bool $hideContactName = false, bool $hideDocumentNumber = false, string $classContactNameAndDocumentNumber = '', string $textContactName = '', string $showContactRoute = '', string $textDocumentNumber = '', bool $hideAmount = false, string $classAmount = '', bool $hideShow = false, string $showRoute = '', bool $hideEdit = false, string $editRoute = '', bool $hideDuplicate = false, string $duplicateRoute = '', @@ -320,9 +353,22 @@ abstract class Index extends Component $this->textDueAt = $this->getTextDueAt($type, $textDueAt); $this->textIssuedAt = $this->getTextIssuedAt($type, $textIssuedAt); + $this->hideStartedAt = $hideStartedAt; + $this->hideEndedAt = $hideEndedAt; + $this->classStartedAtAndEndedAt = $this->getClassStartedAndEndedAt($type, $classStartedAtAndEndedAt); + $this->textStartedAt = $this->getTextStartedAt($type, $textStartedAt); + $this->textEndedAt = $this->getTextEndedAt($type, $textEndedAt); + $this->hideStatus = $hideStatus; $this->classStatus = $this->getClassStatus($type, $classStatus); + $this->hideCategory = $hideCategory; + $this->textCategory = $this->getTextCategory($type, $textCategory); + + $this->hideFrequency = $hideFrequency; + $this->hideDuration = $hideDuration; + $this->classFrequencyAndDuration = $this->getClassFrequencyAndDuration($type, $classFrequencyAndDuration); + $this->hideContactName = $hideContactName; $this->hideDocumentNumber = $hideDocumentNumber; $this->classContactNameAndDocumentNumber = $this->getClassContactNameAndDocumentNumber($type, $classContactNameAndDocumentNumber); @@ -606,6 +652,66 @@ abstract class Index extends Component return 'invoices.invoice_date'; } + protected function getClassStartedAndEndedAt($type, $classStartedAtAndEndedAt) + { + if (! empty($classStartedAtAndEndedAt)) { + return $classStartedAtAndEndedAt; + } + + $class = $this->getClassFromConfig($type, 'started_at_and_end_at'); + + if (! empty($class)) { + return $class; + } + + return 'w-4/12 table-title hidden sm:table-cell'; + } + + protected function getClassFrequencyAndDuration($type, $classFrequencyAndDuration) + { + if (! empty($classFrequencyAndDuration)) { + return $classFrequencyAndDuration; + } + + $class = $this->getClassFromConfig($type, 'frequency_and_duration'); + + if (! empty($class)) { + return $class; + } + + return 'w-2/12'; + } + + protected function getTextStartedAt($type, $textStartedAt) + { + if (! empty($textStartedAt)) { + return $textStartedAt; + } + + $translation = $this->getTextFromConfig($type, 'started_at', 'started_date'); + + if (! empty($translation)) { + return $translation; + } + + return 'general.start_date'; + } + + protected function getTextEndedAt($type, $textEndedAt) + { + if (! empty($textEndedAt)) { + return $textEndedAt; + } + + $translation = $this->getTextFromConfig($type, 'ended_at', 'ended_date'); + + if (! empty($translation)) { + return $translation; + } + + return 'recurring.last_issued'; + } + protected function getClassStatus($type, $classStatus) { if (! empty($classStatus)) { @@ -621,6 +727,21 @@ abstract class Index extends Component return 'w-3/12 table-title hidden sm:table-cell'; } + protected function getTextCategory($type, $textCategory) + { + if (!empty($textCategory)) { + return $textCategory; + } + + $translation = $this->getTextFromConfig($type, 'categories', 'categories', 'trans_choice'); + + if (!empty($translation)) { + return $translation; + } + + return 'general.categories'; + } + protected function getClassContactNameAndDocumentNumber($type, $classContactNameAndDocumentNumber) { if (! empty($classContactNameAndDocumentNumber)) { diff --git a/resources/views/components/documents/index/recurring_templates.blade.php b/resources/views/components/documents/index/recurring_templates.blade.php index a85ce9b77..d1c7a5f96 100644 --- a/resources/views/components/documents/index/recurring_templates.blade.php +++ b/resources/views/components/documents/index/recurring_templates.blade.php @@ -7,56 +7,116 @@ @endif - + @stack('stated_at_and_ended_at_th_start') + @if (! $hideStartedAt || ! $hideEndedAt) + + @stack('stated_at_th_start') + @if (! $hideStartedAt) + @endif + @stack('stated_at_th_end') + + @stack('ended_at_th_start') + @if (! $hideEndedAt) {{ trans('recurring.last_issued') }} + @endif + @stack('ended_at_th_end') + @endif + @stack('stated_at_and_ended_at_th_end') + @stack('contact_name_and_category_th_start') + @if (! $hideContactName || ! $hideCategory) + @stack('contact_name_th_start') + @if (! $hideContactName) + @endif + @stack('contact_name_th_end') + + @stack('category_th_start') + @if (! $hideCategory) - + + @endif + @stack('category_th_end') + @endif + @stack('contact_name_and_category_th_end') - + @stack('status_th_start') + @if (! $hideStatus) + + @stack('status_th_inside_start') + @stack('status_th_inside_end') + @endif + @stack('status_th_end') - + @stack('frequency_and_duration_th_start') + @if (! $hideFrequency || ! $hideDuration) + + @stack('frequency_th_start') + @if (! $hideFrequency) {{ trans('recurring.frequency') }} + @endif + @stack('frequency_th_end') + + @stack('duration_th_start') + @if (! $hideDuration) {{ trans('recurring.duration') }} + @endif + @stack('duration_th_end') + @endif + @stack('frequency_and_duration_th_end') - + @stack('amount_th_start') + @if (! $hideAmount) + + @stack('amount_th_inside_start') + @stack('amount_th_inside_end') + @endif + @stack('amount_th_end') @foreach($documents as $item) - @if (! $hideBulkAction) + @if (! $hideBulkAction) - @endif + @endif - + @stack('stated_at_and_ended_at_td_start') + @if (! $hideStartedAt || ! $hideEndedAt) + + @stack('stated_at_td_start') + @if (! $hideStartedAt) + @endif + @stack('stated_at_td_end') + + @stack('ended_at_td_start') + @if (! $hideEndedAt) @if ($item->recurring->status == 'ended') @if ($last = $item->recurring->documents->last()?->issued_at) @@ -70,24 +130,55 @@ @endif @endif + @endif + @stack('ended_at_td_end') + @endif + @stack('stated_at_and_ended_at_td_end') + @stack('contact_name_and_category_td_start') + @if (! $hideContactName || ! $hideCategory) + @stack('contact_name_td_start') + @if (! $hideContactName) {{ $item->contact_name }} + @endif + @stack('contact_name_td_end') + + @stack('category_td_start') + @if (! $hideCategory)
+ @endif + @stack('category_td_end')
+ @endif + @stack('contact_name_and_category_td_end') - - - + @stack('status_td_start') + @if (!$hideStatus) + + @stack('status_td_inside_start') + + @stack('status_td_inside_end') + + @endif + @stack('status_td_end') - + @stack('frequency_and_duration_td_start') + @if (! $hideFrequency || ! $hideDuration) + + @stack('frequency_td_start') + @if (! $hideFrequency) @if ($item->recurring->interval > 1) recurring->frequency) }} @endif + @endif + @stack('frequency_td_end') + + @stack('duration_td_start') + @if (! $hideDuration) @if ($item->recurring->limit_by == 'count') @if ($item->recurring->limit_count == 0) @@ -115,11 +211,21 @@ {{ trans('recurring.ends_date', ['date' => company_date($item->recurring->limit_date)]) }} @endif + @endif + @stack('duration_td_end') + @endif + @stack('frequency_and_duration_td_end') - + @stack('amount_td_start') + @if (! $hideAmount) + + @stack('amount_td_inside_start') + @stack('amount_td_inside_end') + @endif + @stack('amount_td_end')