Show and Print item line component add
This commit is contained in:
parent
409173c22d
commit
d33ba81f87
@ -16,6 +16,8 @@ abstract class DocumentTemplate extends Component
|
||||
|
||||
public $type;
|
||||
|
||||
public $item;
|
||||
|
||||
public $document;
|
||||
|
||||
/** @var string */
|
||||
@ -111,7 +113,7 @@ abstract class DocumentTemplate extends Component
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
$type, $document, $documentTemplate = '', $logo = '', $backgroundColor = '',
|
||||
$type, $item = false, $document, $documentTemplate = '', $logo = '', $backgroundColor = '',
|
||||
bool $hideFooter = false, bool $hideCompanyLogo = false, bool $hideCompanyDetails = false,
|
||||
bool $hideCompanyName = false, bool $hideCompanyAddress = false, bool $hideCompanyTaxNumber = false, bool $hideCompanyPhone = false, bool $hideCompanyEmail = false, bool $hideContactInfo = false,
|
||||
bool $hideContactName = false, bool $hideContactAddress = false, bool $hideContactTaxNumber = false, bool $hideContactPhone = false, bool $hideContactEmail = false,
|
||||
@ -121,6 +123,7 @@ abstract class DocumentTemplate extends Component
|
||||
string $textItems = '', string $textQuantity = '', string $textPrice = '', string $textAmount = ''
|
||||
) {
|
||||
$this->type = $type;
|
||||
$this->item = $item;
|
||||
$this->document = $document;
|
||||
$this->documentTemplate = $this->getDocumentTemplate($type, $documentTemplate);
|
||||
$this->logo = $this->getLogo($logo);
|
||||
|
18
app/View/Components/Documents/Template/LineItem.php
Normal file
18
app/View/Components/Documents/Template/LineItem.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Documents\Form;
|
||||
|
||||
use App\Abstracts\View\Components\DocumentTemplate as Component;
|
||||
|
||||
class LineItem extends Component
|
||||
{
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.documents.template.line-item');
|
||||
}
|
||||
}
|
@ -201,7 +201,18 @@
|
||||
|
||||
<tbody>
|
||||
@foreach($document->items as $item)
|
||||
@include('partials.documents.item.print', ['document' => $document])
|
||||
<x-documents.template.line-item
|
||||
type="{{ $type }}"
|
||||
:item="$item"
|
||||
:document="$document"
|
||||
hide-items="{{ $hideItems }}"
|
||||
hide-name="{{ $hideName }}"
|
||||
hide-description="{{ $hideDescription }}"
|
||||
hide-quantity="{{ $hideQuantity }}"
|
||||
hide-price="{{ $hidePrice }}"
|
||||
hide-discount="{{ $hideDiscount }}"
|
||||
hide-amount="{{ $hideAmount }}"
|
||||
/>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -187,7 +187,18 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($document->items as $item)
|
||||
@include('partials.documents.item.print', ['document' => $document])
|
||||
<x-documents.template.line-item
|
||||
type="{{ $type }}"
|
||||
:item="$item"
|
||||
:document="$document"
|
||||
hide-items="{{ $hideItems }}"
|
||||
hide-name="{{ $hideName }}"
|
||||
hide-description="{{ $hideDescription }}"
|
||||
hide-quantity="{{ $hideQuantity }}"
|
||||
hide-price="{{ $hidePrice }}"
|
||||
hide-discount="{{ $hideDiscount }}"
|
||||
hide-amount="{{ $hideAmount }}"
|
||||
/>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -11,6 +11,8 @@
|
||||
<br><small>{!! \Illuminate\Support\Str::limit($item->item->description, 500) !!}</small>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@stack('item_custom_fields')
|
||||
</td>
|
||||
@endif
|
||||
@stack('name_td_end')
|
@ -175,7 +175,18 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($document->items as $item)
|
||||
@include('partials.documents.item.print', ['document' => $document])
|
||||
<x-documents.template.line-item
|
||||
type="{{ $type }}"
|
||||
:item="$item"
|
||||
:document="$document"
|
||||
hide-items="{{ $hideItems }}"
|
||||
hide-name="{{ $hideName }}"
|
||||
hide-description="{{ $hideDescription }}"
|
||||
hide-quantity="{{ $hideQuantity }}"
|
||||
hide-price="{{ $hidePrice }}"
|
||||
hide-discount="{{ $hideDiscount }}"
|
||||
hide-amount="{{ $hideAmount }}"
|
||||
/>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -1,43 +0,0 @@
|
||||
<tr class="d-flex flex-nowrap">
|
||||
@stack('name_td_start')
|
||||
@if (!$hideItems || (!$hideName && !$hideDescription))
|
||||
<td class="col-xs-4 col-sm-5 pl-5">
|
||||
@if (!$hideName)
|
||||
{{ $item->name }}
|
||||
@endif
|
||||
|
||||
@if (!$hideDescription)
|
||||
@if (!empty($item->item->description))
|
||||
<br><small class="text-pre-nowrap">{!! \Illuminate\Support\Str::limit($item->item->description, 500) !!}<small>
|
||||
@endif
|
||||
@endif
|
||||
</td>
|
||||
@endif
|
||||
@stack('name_td_end')
|
||||
|
||||
@stack('quantity_td_start')
|
||||
@if (!$hideQuantity)
|
||||
<td class="col-xs-4 col-sm-1 text-center">{{ $item->quantity }}</td>
|
||||
@endif
|
||||
@stack('quantity_td_end')
|
||||
|
||||
@stack('price_td_start')
|
||||
@if (!$hidePrice)
|
||||
<td class="col-sm-3 text-right d-none d-sm-block">@money($item->price, $document->currency_code, true)</td>
|
||||
@endif
|
||||
@stack('price_td_end')
|
||||
|
||||
@if (!$hideDiscount)
|
||||
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
|
||||
@stack('discount_td_start')
|
||||
<td class="col-sm-1 text-center d-none d-sm-block">{{ $item->discount }}</td>
|
||||
@stack('discount_td_end')
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@stack('total_td_start')
|
||||
@if (!$hideAmount)
|
||||
<td class="col-xs-4 col-sm-3 text-right pr-5">@money($item->total, $document->currency_code, true)</td>
|
||||
@endif
|
||||
@stack('total_td_end')
|
||||
</tr>
|
Loading…
x
Reference in New Issue
Block a user